Class: Ralyxa::ResponseEntities::Card
- Inherits:
-
Object
- Object
- Ralyxa::ResponseEntities::Card
- Defined in:
- lib/ralyxa/response_entities/card.rb
Constant Summary collapse
- LINK_ACCOUNT_CARD_TYPE =
'LinkAccount'.freeze
- SIMPLE_CARD_TYPE =
'Simple'.freeze
- STANDARD_CARD_TYPE =
'Standard'.freeze
Class Method Summary collapse
- .as_hash(title, body, small_image_url = nil, large_image_url = small_image_url) ⇒ Object
- .link_account ⇒ Object
Instance Method Summary collapse
-
#initialize(options) ⇒ Card
constructor
A new instance of Card.
- #to_h ⇒ Object
Constructor Details
#initialize(options) ⇒ Card
Returns a new instance of Card.
10 11 12 |
# File 'lib/ralyxa/response_entities/card.rb', line 10 def initialize() @options = end |
Class Method Details
.as_hash(title, body, small_image_url = nil, large_image_url = small_image_url) ⇒ Object
14 15 16 |
# File 'lib/ralyxa/response_entities/card.rb', line 14 def self.as_hash(title, body, small_image_url = nil, large_image_url = small_image_url) new(title: title, body: body, small_image_url: small_image_url, large_image_url: large_image_url).to_h end |
.link_account ⇒ Object
18 19 20 |
# File 'lib/ralyxa/response_entities/card.rb', line 18 def self.link_account new(link_account: true).to_h end |
Instance Method Details
#to_h ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/ralyxa/response_entities/card.rb', line 22 def to_h {}.tap do |card| add_type(card) add_title(card) if @options[:title] add_body(card) if @options[:body] add_image(card) if standard? end end |