class Trello::Schema::Attribute::Default
Public Instance Methods
build_attributes(params, attributes)
click to toggle source
# File lib/trello/schema/attribute/default.rb, line 6 def build_attributes(params, attributes) attrs = attributes.with_indifferent_access params = params.with_indifferent_access value = if params.key?(remote_key) params[remote_key] else params[name] end attrs[name] = serializer.deserialize(value, default) attrs end
build_payload_for_create(attributes, payload)
click to toggle source
# File lib/trello/schema/attribute/default.rb, line 20 def build_payload_for_create(attributes, payload) payload ||= {} return payload unless for_action?(:create) return payload unless attributes.key?(name) value = attributes[name] return payload if value.nil? payload[remote_key] = serializer.serialize(value) payload end
build_payload_for_update(attributes, payload)
click to toggle source
# File lib/trello/schema/attribute/default.rb, line 32 def build_payload_for_update(attributes, payload) payload ||= {} return payload unless for_action?(:update) return payload unless attributes.key?(name) value = attributes[name] payload[remote_key] = serializer.serialize(value) payload end