class Majestic::Api::ItemInfoResponse

Public Class Methods

new(response) click to toggle source
Calls superclass method
# File lib/majestic/api/item_info_response.rb, line 5
def initialize(response)
  super(response)
  
  raise_exceptions_if_necessary
  parse_item_info_objects
end

Public Instance Methods

parse_item_info_objects() click to toggle source
# 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() click to toggle source
# 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.error_message)
  end unless success?
end