Class: AlexaSkillsRuby::JsonObjects::BaseRequest
- Inherits:
-
AlexaSkillsRuby::JsonObject
- Object
- AlexaSkillsRuby::JsonObject
- AlexaSkillsRuby::JsonObjects::BaseRequest
- Defined in:
- lib/alexa_skills_ruby/json_objects/base_request.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from AlexaSkillsRuby::JsonObject
#as_json, attribute, inherited, #initialize, json_object_attribute, #populate_from_json, #serialize_attributes, #to_json
Constructor Details
This class inherits a constructor from AlexaSkillsRuby::JsonObject
Class Method Details
.new(*args, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/alexa_skills_ruby/json_objects/base_request.rb', line 6 def self.new(*args, &block) json = args.first subclass = case when self != BaseRequest nil when json.nil? nil when json['type'] == 'LaunchRequest' LaunchRequest when json['type'] == 'IntentRequest' IntentRequest when json['type'] == 'SessionEndedRequest' SessionEndedRequest else nil end if subclass subclass.new(*args, &block) else super end end |
Instance Method Details
#intent_name ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/alexa_skills_ruby/json_objects/base_request.rb', line 30 def intent_name if self.is_a? IntentRequest self.intent.name else nil end end |