module Messenger::Components::Attachment
Attributes
type[RW]
Public Instance Methods
all_attributes()
click to toggle source
# File lib/messenger/components/attachment.rb, line 15 def all_attributes return instance_values unless defined?(flattened_attributes) instance_values.merge! flattened_attributes end
allowed_attribute?(attribute)
click to toggle source
# File lib/messenger/components/attachment.rb, line 24 def allowed_attribute?(attribute) self.class::ATTRIBUTES.include?(attribute) end
build()
click to toggle source
# File lib/messenger/components/attachment.rb, line 6 def build { attachment: { type: @type, payload: payload } } end
build_elements(elements)
click to toggle source
# File lib/messenger/components/attachment.rb, line 28 def build_elements(elements) elements.map { |element| element.build } if elements.present? end
payload()
click to toggle source
# File lib/messenger/components/attachment.rb, line 20 def payload all_attributes.select { |attribute, value| allowed_attribute?(attribute) && value.present? } end