Class: Dustbag::Offer
Instance Attribute Summary
Attributes included from Parser::Node
#node, #subnodes
Instance Method Summary
collapse
included, #initialize, #repeated_subnodes, #repeated_subnodes_text, #subnode, #subnode_text
Instance Method Details
#amount_saved ⇒ Object
21
22
23
24
|
# File 'lib/dustbag/offer.rb', line 21
def amount_saved
savings = offer_listing && offer_listing.locate('AmountSaved').first
Price.parse(savings)
end
|
#availability ⇒ Object
26
27
28
29
|
# File 'lib/dustbag/offer.rb', line 26
def availability
availability = offer_listing && offer_listing.locate('Availability').first
availability && availability.text
end
|
#availability_attributes ⇒ Object
41
42
43
44
|
# File 'lib/dustbag/offer.rb', line 41
def availability_attributes
availability = offer_listing && offer_listing.locate('AvailabilityAttributes').first
AvailabilityAttributes.new(availability)
end
|
#condition ⇒ Object
5
6
7
8
9
|
# File 'lib/dustbag/offer.rb', line 5
def condition
offer_attrs = subnode('OfferAttributes')
condition = offer_attrs && offer_attrs.locate('Condition').first
condition && condition.text
end
|
#eligible_for_prime? ⇒ Boolean
36
37
38
39
|
# File 'lib/dustbag/offer.rb', line 36
def eligible_for_prime?
eligible = offer_listing && offer_listing.locate('IsEligibleForPrime').first
eligible && eligible.text == '1'
end
|
#eligible_for_super_saver_shipping? ⇒ Boolean
31
32
33
34
|
# File 'lib/dustbag/offer.rb', line 31
def eligible_for_super_saver_shipping?
eligible = offer_listing && offer_listing.locate('IsEligibleForSuperSaverShipping').first
eligible && eligible.text == '1'
end
|
#id ⇒ Object
11
12
13
14
|
# File 'lib/dustbag/offer.rb', line 11
def id
id = offer_listing && offer_listing.locate('OfferListingId').first
id && id.text
end
|
#price ⇒ Object
16
17
18
19
|
# File 'lib/dustbag/offer.rb', line 16
def price
price = offer_listing && offer_listing.locate('Price').first
Price.parse(price)
end
|