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
|
# File 'lib/alexa/api/category_listings.rb', line 22
def count
return @count if defined?(@count)
count = safe_retrieve(parsed_body, "CategoryListingsResponse", "Response", "CategoryListingsResult", "Alexa", "CategoryListings", "Count")
@count = count ? count.to_i : nil
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
34
35
36
|
# File 'lib/alexa/api/category_listings.rb', line 34
def listings
@listings ||= safe_retrieve(parsed_body, "CategoryListingsResponse", "Response", "CategoryListingsResult", "Alexa", "CategoryListings", "Listings", "Listing")
end
|
#recursive_count ⇒ Object
28
29
30
31
32
|
# File 'lib/alexa/api/category_listings.rb', line 28
def recursive_count
return @recursive_count if defined?(@recursive_count)
recursive_count = safe_retrieve(parsed_body, "CategoryListingsResponse", "Response", "CategoryListingsResult", "Alexa", "CategoryListings", "RecursiveCount")
@recursive_count = recursive_count ? recursive_count.to_i : nil
end
|
#request_id ⇒ Object
42
43
44
|
# File 'lib/alexa/api/category_listings.rb', line 42
def request_id
@request_id ||= safe_retrieve(parsed_body, "CategoryListingsResponse", "Response", "OperationRequest", "RequestId")
end
|
#status_code ⇒ Object
38
39
40
|
# File 'lib/alexa/api/category_listings.rb', line 38
def status_code
@status_code ||= safe_retrieve(parsed_body, "CategoryListingsResponse", "Response", "ResponseStatus", "StatusCode")
end
|