Class: Majestic::Api::ItemInfoResponse
- Defined in:
- lib/majestic/api/item_info_response.rb
Instance Attribute Summary
Attributes inherited from Response
#code, #error_message, #full_error, #items, #parsed_items, #response, #success
Instance Method Summary collapse
-
#initialize(response) ⇒ ItemInfoResponse
constructor
A new instance of ItemInfoResponse.
- #parse_item_info_objects ⇒ Object
- #raise_exceptions_if_necessary ⇒ Object
Methods inherited from Response
#parse_response, #stacktrace, #success?
Constructor Details
#initialize(response) ⇒ ItemInfoResponse
Returns a new instance of ItemInfoResponse.
5 6 7 8 9 10 |
# File 'lib/majestic/api/item_info_response.rb', line 5 def initialize(response) super(response) raise_exceptions_if_necessary parse_item_info_objects end |
Instance Method Details
#parse_item_info_objects ⇒ Object
19 20 21 22 23 24 |
# File 'lib/majestic/api/item_info_response.rb', line 19 def parse_item_info_objects self.parsed_items.each do |parsed_item| item_info = Majestic::Api::ItemInfo.new(parsed_item) self.items << item_info unless self.items.include?(item_info) end if self.parsed_items && self.parsed_items.any? end |
#raise_exceptions_if_necessary ⇒ Object
12 13 14 15 16 17 |
# File 'lib/majestic/api/item_info_response.rb', line 12 def raise_exceptions_if_necessary case self.code when 'InsufficientIndexItemInfoUnits' raise Majestic::Api::InsufficientIndexItemInfoUnitsException.new(self.) end unless success? end |