class Alexa::API::CategoryBrowse

Constants

DEFAULT_RESPONSE_GROUP

Public Instance Methods

categories() click to toggle source

Response attributes

# 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 = {}) click to toggle source
# 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_categories() click to toggle source
# 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_bars() click to toggle source
# 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
request_id() click to toggle source
# File lib/alexa/api/category_browse.rb, line 40
def request_id
  @request_id ||= safe_retrieve(parsed_body, "CategoryBrowseResponse", "Response", "OperationRequest", "RequestId")
end
status_code() click to toggle source
# File lib/alexa/api/category_browse.rb, line 36
def status_code
  @status_code ||= safe_retrieve(parsed_body, "CategoryBrowseResponse", "Response", "ResponseStatus", "StatusCode")
end

Private Instance Methods

descriptions_param() click to toggle source
# File lib/alexa/api/category_browse.rb, line 59
def descriptions_param
  arguments[:descriptions].to_s.capitalize
end
params() click to toggle source
# File lib/alexa/api/category_browse.rb, line 46
def params
  {
    "Action"        => "CategoryBrowse",
    "ResponseGroup" => response_group_param,
    "Path"          => arguments[:path],
    "Descriptions"  => descriptions_param
  }
end
response_group_param() click to toggle source
# File lib/alexa/api/category_browse.rb, line 55
def response_group_param
  arguments[:response_group].sort.map { |group| camelize(group) }.join(",")
end