Class: Paapi::Listing
- Inherits:
-
Object
- Object
- Paapi::Listing
- Extended by:
- Forwardable
- Defined in:
- lib/paapi/listing.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
Instance Method Summary collapse
- #amazon_fulfilled? ⇒ Boolean
- #availability ⇒ Object
- #condition ⇒ Object
- #free_shipping_eligible? ⇒ Boolean
- #get(keys) ⇒ Object
-
#initialize(data) ⇒ Listing
constructor
A new instance of Listing.
- #merchant ⇒ Object
- #price ⇒ Object
- #prime_eligible? ⇒ Boolean
Constructor Details
#initialize(data) ⇒ Listing
Returns a new instance of Listing.
11 12 13 |
# File 'lib/paapi/listing.rb', line 11 def initialize(data) @hash = data end |
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash.
10 11 12 |
# File 'lib/paapi/listing.rb', line 10 def hash @hash end |
Instance Method Details
#amazon_fulfilled? ⇒ Boolean
19 20 21 |
# File 'lib/paapi/listing.rb', line 19 def amazon_fulfilled? get(%w{DeliveryInfo IsAmazonFulfilled}) end |
#availability ⇒ Object
15 16 17 |
# File 'lib/paapi/listing.rb', line 15 def availability get(%w{Availability Message}) end |
#condition ⇒ Object
39 40 41 |
# File 'lib/paapi/listing.rb', line 39 def condition get(%w{Condition Value}) end |
#free_shipping_eligible? ⇒ Boolean
23 24 25 |
# File 'lib/paapi/listing.rb', line 23 def free_shipping_eligible? get(%w{DeliveryInfo IsFreeShippingEligible}) end |
#get(keys) ⇒ Object
43 44 45 |
# File 'lib/paapi/listing.rb', line 43 def get(keys) @hash.dig(*keys) end |
#merchant ⇒ Object
35 36 37 |
# File 'lib/paapi/listing.rb', line 35 def merchant get(%w{MerchantInfo Name}) end |
#price ⇒ Object
31 32 33 |
# File 'lib/paapi/listing.rb', line 31 def price get(%w{Price}) end |
#prime_eligible? ⇒ Boolean
27 28 29 |
# File 'lib/paapi/listing.rb', line 27 def prime_eligible? get(%w{DeliveryInfo IsPrimeEligible}) end |