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

#initialize(params) ⇒ Hash

Initialize new card object

Parameters:

  • params (Hash)

    card parameters: type [String] card type, can be “Simple”, “Standard” or “LinkAccount” title [String] card title content [String] card content (line breaks must be already included) small_image_url [String] an URL for small card image large_image_url [String] an URL for large card image

Raises:

  • (ArgumentError)

    if card type is unknown


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

def initialize(params)
  @obj = {}
  @obj[:type] = params[:type] || 'Simple'
  raise ArgumentError, 'Unknown card type' unless valid_type?
  @params = params
  build
end

Instance Attribute Details

#objObject (readonly)

Returns the value of attribute obj


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

def obj
  @obj
end