Module: StrawberryAPI::Client::CustomMetadataFields

Included in:
StrawberryAPI::Client
Defined in:
lib/strawberry_api/client/custom_metadata_fields.rb

Instance Method Summary collapse

Instance Method Details

#custom_metadata_field(id:) ⇒ StrawberryAPI::Feature

Fetches a ustom metadata field

Parameters:

  • id (Integer)

    Id of the ustom metadata field to retrieve

Returns:



22
23
24
25
# File 'lib/strawberry_api/client/custom_metadata_fields.rb', line 22

def (id:)
   data = get("/custom_metadata_fields/#{id}").parse['custommetadatafield']
   data.nil? ? nil : CustomMetadataField.new(data)
end

#custom_metadata_fieldsArray<StrawberryAPI::CustomMetadataField>

Fetches all custom metadata fields

Returns:



10
11
12
13
14
# File 'lib/strawberry_api/client/custom_metadata_fields.rb', line 10

def 
  get("/custom_metadata_fields").parse['array']&.map do |field|
    CustomMetadataField.new(field)
  end
end

#update_custom_metadata_field(id:, options: {}) ⇒ StrawberryAPI::CustomMetadataField

Updates a custom metadata field

Parameters:

  • id (Interger)

    Id of the custom metadata field to update

  • options (Hash)

    Hash of options

Returns:



34
35
36
37
# File 'lib/strawberry_api/client/custom_metadata_fields.rb', line 34

def (id:, options: {})
  data = put("/custom_metadata_fields/#{id}", body: options.to_json).parse['custommetadatafield']
  data.nil? ? nil : CustomMetadataField.new(data)
end