Class: AlexaToolbox::Intent

Inherits:
Object
  • Object
show all
Defined in:
lib/alexa_toolbox/intent.rb

Overview

Handles the intent object in requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(intent) ⇒ Intent

Returns a new instance of Intent.

Raises:

  • (ArgumentError)


6
7
8
9
10
11
# File 'lib/alexa_toolbox/intent.rb', line 6

def initialize (intent)
  raise ArgumentError, 'Invalid Intent' if intent[:name].empty?
  @name = intent[:name]
  @confirmation_status = intent[:confirmationStatus]
  @json = intent
end

Instance Attribute Details

#confirmation_statusObject (readonly)

Returns the value of attribute confirmation_status.



4
5
6
# File 'lib/alexa_toolbox/intent.rb', line 4

def confirmation_status
  @confirmation_status
end

#jsonObject (readonly)

Returns the value of attribute json.



4
5
6
# File 'lib/alexa_toolbox/intent.rb', line 4

def json
  @json
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/alexa_toolbox/intent.rb', line 4

def name
  @name
end

Instance Method Details

#has_slots?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/alexa_toolbox/intent.rb', line 13

def has_slots?
  return self.slots != {}
end

#slotsObject



17
18
19
# File 'lib/alexa_toolbox/intent.rb', line 17

def slots
  return self.json[:slots]
end