Class: Alexa::API::CategoryListings
- Inherits:
-
Base
- Object
- Base
- Alexa::API::CategoryListings
show all
- Defined in:
- lib/alexa/api/category_listings.rb
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
Instance Method Details
#count ⇒ Object
22
23
24
25
26
27
|
# File 'lib/alexa/api/category_listings.rb', line 22
def count
return @count if defined?(@count)
if count = safe_retrieve(parsed_body, "CategoryListingsResponse", "Response", "CategoryListingsResult", "Alexa", "CategoryListings", "Count")
@count = count.to_i
end
end
|
#fetch(arguments = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/alexa/api/category_listings.rb', line 6
def fetch(arguments = {})
raise ArgumentError, "You must specify path" unless arguments.has_key?(:path)
@arguments = arguments
@arguments[:sort_by] = arguments.fetch(:sort_by, "popularity")
@arguments[:recursive] = arguments.fetch(:recursive, true)
@arguments[:descriptions] = arguments.fetch(:descriptions, true)
@arguments[:start] = arguments.fetch(:start, 0)
@arguments[:count] = arguments.fetch(:count, 20)
@response_body = Alexa::Connection.new(@credentials).get(params)
self
end
|
#listings ⇒ Object
36
37
38
|
# File 'lib/alexa/api/category_listings.rb', line 36
def listings
@listings ||= safe_retrieve(parsed_body, "CategoryListingsResponse", "Response", "CategoryListingsResult", "Alexa", "CategoryListings", "Listings", "Listing")
end
|
#recursive_count ⇒ Object
29
30
31
32
33
34
|
# File 'lib/alexa/api/category_listings.rb', line 29
def recursive_count
return @recursive_count if defined?(@recursive_count)
if recursive_count = safe_retrieve(parsed_body, "CategoryListingsResponse", "Response", "CategoryListingsResult", "Alexa", "CategoryListings", "RecursiveCount")
@recursive_count = recursive_count.to_i
end
end
|
#request_id ⇒ Object
44
45
46
|
# File 'lib/alexa/api/category_listings.rb', line 44
def request_id
@request_id ||= safe_retrieve(parsed_body, "CategoryListingsResponse", "Response", "OperationRequest", "RequestId")
end
|
#status_code ⇒ Object
40
41
42
|
# File 'lib/alexa/api/category_listings.rb', line 40
def status_code
@status_code ||= safe_retrieve(parsed_body, "CategoryListingsResponse", "Response", "ResponseStatus", "StatusCode")
end
|