class Trello::CustomFieldItem
A custom field item contains the value for a custom field on a particular card.
@!attribute [r] id
@return [String]
@!attribute [r] model_id
@return [String]
@!attribute [r] model_type
@return [String]
@!attribute [r] custom_field_id
@return [String]
@!attribute [r] option_id
@return [String]
@!attribute [rw] value
@return [Hash]
Public Instance Methods
collection_path()
click to toggle source
# File lib/trello/custom_field_item.rb, line 48 def collection_path "/cards/#{model_id}/#{collection_name}" end
element_path()
click to toggle source
# File lib/trello/custom_field_item.rb, line 52 def element_path "/cards/#{model_id}/customField/#{custom_field_id}/item" end
option_value()
click to toggle source
Need to make another call to get the actual value if the custom field type == 'list'
# File lib/trello/custom_field_item.rb, line 68 def option_value if option_id option_endpoint = "/customFields/#{custom_field_id}/options/#{option_id}" option = CustomFieldOption.from_response client.get(option_endpoint) option.value end end
remove()
click to toggle source
You can't “delete” a custom field item, you can only clear the value
# File lib/trello/custom_field_item.rb, line 57 def remove params = { value: {} } client.put(element_path, params) end
save()
click to toggle source
# File lib/trello/custom_field_item.rb, line 36 def save return update! if id payload = {} schema.attrs.each do |_, attribute| payload = attribute.build_payload_for_create(attributes, payload) end put(element_path, payload) end
type()
click to toggle source
Type is saved at the CustomField
level
# File lib/trello/custom_field_item.rb, line 63 def type custom_field.type end