Class: Ralyxa::Card
- Inherits:
-
Object
- Object
- Ralyxa::Card
- Defined in:
- lib/ralyxa/card.rb
Constant Summary collapse
- SIMPLE_CARD_TYPE =
"Simple"
- STANDARD_CARD_TYPE =
"Standard"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title, body, image_url) ⇒ Card
constructor
A new instance of Card.
- #to_h ⇒ Object
Constructor Details
#initialize(title, body, image_url) ⇒ Card
Returns a new instance of Card.
6 7 8 9 10 |
# File 'lib/ralyxa/card.rb', line 6 def initialize(title, body, image_url) @title = title @body = body @image_url = image_url end |
Class Method Details
.as_hash(title, body, image_url = nil) ⇒ Object
12 13 14 |
# File 'lib/ralyxa/card.rb', line 12 def self.as_hash(title, body, image_url = nil) new(title, body, image_url).to_h end |
Instance Method Details
#to_h ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/ralyxa/card.rb', line 16 def to_h Hash.new.tap do |card| set_type(card) card[:title] = @title set_body(card) set_image(card) if @image_url end end |