Class: InvisibleHand::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/invisiblehand/page.rb

Constant Summary collapse

FIELDS =

Array of fields that exist on a page returned from the InvisibleHand API.

[
  :title,
  :deeplink,
  :original_url,
  :price,
  :currency,
  :pnp,
  :image_url,
  :retailer_name,
  :price_confidence,
  :live_price_url,
  :ean,
  :upc,
  :brand,
  :model,
  :mpn,
  :isbn,
  :asin,
  :category,
]

Instance Method Summary collapse

Constructor Details

#initialize(raw, api) ⇒ Page

Returns a new instance of Page.



28
29
30
31
32
# File 'lib/invisiblehand/page.rb', line 28

def initialize raw, api
  @api = api
  @raw = raw
  FIELDS.each { |key| self.send("#{key}=", @raw[key.to_s]) }
end

Instance Method Details

#live_price(opts = {}) ⇒ Object



34
35
36
# File 'lib/invisiblehand/page.rb', line 34

def live_price opts = {}
  @api.live_price(self.live_price_url, opts)
end