Class: AlexaRuby::Card

Inherits:
Object
  • Object
show all
Defined in:
lib/alexa_ruby/response/card.rb

Overview

Class for Amazon Alexa app cards

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCard

Initialize new card object



7
8
9
# File 'lib/alexa_ruby/response/card.rb', line 7

def initialize
  @obj = {}
end

Instance Attribute Details

#objObject

Returns the value of attribute obj.



4
5
6
# File 'lib/alexa_ruby/response/card.rb', line 4

def obj
  @obj
end

Instance Method Details

#build(opts) ⇒ Object

Build card object

Parameters:

  • opts (Hash)

    card parameters:

    • type - card type

    • title - card title

    • subtitle - card subtitle

    • content - card body content



18
19
20
21
22
23
# File 'lib/alexa_ruby/response/card.rb', line 18

def build(opts)
  @obj[:type] = opts[:type]
  @obj[:title] = opts[:title] unless opts[:title].nil?
  @obj[:subtitle] = opts[:subtitle] unless opts[:subtitle].nil?
  @obj[:content] = opts[:content] unless opts[:content].nil?
end