Class: Alexa::API::CategoryBrowse

Inherits:
Base
  • Object
show all
Defined in:
lib/alexa/api/category_browse.rb

Constant Summary collapse

DEFAULT_RESPONSE_GROUP =
["categories", "related_categories", "language_categories", "letter_bars"]

Instance Attribute Summary

Attributes inherited from Base

#arguments, #response_body

Instance Method Summary collapse

Methods inherited from Base

#initialize, #parsed_body

Methods included from Utils

camelize, safe_retrieve

Constructor Details

This class inherits a constructor from Alexa::API::Base

Instance Method Details

#categoriesObject

Response attributes



20
21
22
# File 'lib/alexa/api/category_browse.rb', line 20

def categories
  @categories ||= safe_retrieve(parsed_body, "CategoryBrowseResponse", "Response", "CategoryBrowseResult", "Alexa", "CategoryBrowse", "Categories", "Category")
end

#fetch(arguments = {}) ⇒ Object

Raises:



8
9
10
11
12
13
14
15
16
17
# File 'lib/alexa/api/category_browse.rb', line 8

def fetch(arguments = {})
  raise ArgumentError.new("You must specify path") unless arguments.has_key?(:path)
  @arguments = arguments

  @arguments[:response_group] = Array(arguments.fetch(:response_group, DEFAULT_RESPONSE_GROUP))
  @arguments[:descriptions]   = arguments.fetch(:descriptions, true)

  @response_body = Alexa::Connection.new(@credentials).get(params)
  self
end

#language_categoriesObject



24
25
26
# File 'lib/alexa/api/category_browse.rb', line 24

def language_categories
  @language_categories ||= safe_retrieve(parsed_body, "CategoryBrowseResponse", "Response", "CategoryBrowseResult", "Alexa", "CategoryBrowse", "LanguageCategories", "Category")
end

#letter_barsObject



32
33
34
# File 'lib/alexa/api/category_browse.rb', line 32

def letter_bars
  @letter_bars ||= safe_retrieve(parsed_body, "CategoryBrowseResponse", "Response", "CategoryBrowseResult", "Alexa", "CategoryBrowse", "LetterBars", "Category")
end


28
29
30
# File 'lib/alexa/api/category_browse.rb', line 28

def related_categories
  @related_categories ||= safe_retrieve(parsed_body, "CategoryBrowseResponse", "Response", "CategoryBrowseResult", "Alexa", "CategoryBrowse", "RelatedCategories", "Category")
end

#request_idObject



40
41
42
# File 'lib/alexa/api/category_browse.rb', line 40

def request_id
  @request_id ||= safe_retrieve(parsed_body, "CategoryBrowseResponse", "Response", "OperationRequest", "RequestId")
end

#status_codeObject



36
37
38
# File 'lib/alexa/api/category_browse.rb', line 36

def status_code
  @status_code ||= safe_retrieve(parsed_body, "CategoryBrowseResponse", "Response", "ResponseStatus", "StatusCode")
end