Class: Fb::Messenger::Template::GenericItem

Inherits:
Object
  • Object
show all
Defined in:
lib/fb/messenger/templates/generic_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ GenericItem

Returns a new instance of GenericItem.



7
8
9
10
11
12
# File 'lib/fb/messenger/templates/generic_item.rb', line 7

def initialize(opts = {})
  @title = opts[:title]
  @subtitle = opts[:subtitle]
  @image_url = opts[:image_url]
  @buttons = opts[:buttons] || []
end

Instance Attribute Details

#buttonsObject

Returns the value of attribute buttons.



5
6
7
# File 'lib/fb/messenger/templates/generic_item.rb', line 5

def buttons
  @buttons
end

#image_urlObject

Returns the value of attribute image_url.



5
6
7
# File 'lib/fb/messenger/templates/generic_item.rb', line 5

def image_url
  @image_url
end

#subtitleObject

Returns the value of attribute subtitle.



5
6
7
# File 'lib/fb/messenger/templates/generic_item.rb', line 5

def subtitle
  @subtitle
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/fb/messenger/templates/generic_item.rb', line 5

def title
  @title
end

Instance Method Details

#templateObject



14
15
16
17
18
19
20
21
# File 'lib/fb/messenger/templates/generic_item.rb', line 14

def template
  {
    title: title,
    subtitle: subtitle,
    image_url: image_url,
    buttons: buttons.map(&:template)
  }
end