Class: Dustbag::ItemAttributes
- Inherits:
-
Object
- Object
- Dustbag::ItemAttributes
show all
- Includes:
- Parser::Node
- Defined in:
- lib/dustbag/item_attributes.rb
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
#actors ⇒ Object
22
23
24
|
# File 'lib/dustbag/item_attributes.rb', line 22
def actors
repeated_subnodes_text('Actor')
end
|
#adult_product? ⇒ Boolean
75
76
77
|
# File 'lib/dustbag/item_attributes.rb', line 75
def adult_product?
subnode_text('IsAdultProduct') == '1'
end
|
#authors ⇒ Object
33
34
35
|
# File 'lib/dustbag/item_attributes.rb', line 33
def authors
repeated_subnodes_text('Author')
end
|
#creators ⇒ Object
26
27
28
29
30
31
|
# File 'lib/dustbag/item_attributes.rb', line 26
def creators
repeated_subnodes('Creator').inject({}) do |acc, val|
acc[val['Role']] = val.text
acc
end
end
|
#ean_list ⇒ Object
37
38
39
40
41
42
|
# File 'lib/dustbag/item_attributes.rb', line 37
def ean_list
list = subnode('EANList')
list && list.locate('EANListElement').map do |element|
element.text
end
end
|
#features ⇒ Object
44
45
46
|
# File 'lib/dustbag/item_attributes.rb', line 44
def features
repeated_subnodes_text('Feature')
end
|
#labels ⇒ Object
48
49
50
|
# File 'lib/dustbag/item_attributes.rb', line 48
def labels
repeated_subnodes_text('Label')
end
|
#list_price ⇒ Object
63
64
65
|
# File 'lib/dustbag/item_attributes.rb', line 63
def list_price
Price.parse(subnode('ListPrice'))
end
|
#publication_date ⇒ Object
71
72
73
|
# File 'lib/dustbag/item_attributes.rb', line 71
def publication_date
Date.parse(subnode_text('PublicationDate')) rescue nil
end
|
#release_date ⇒ Object
67
68
69
|
# File 'lib/dustbag/item_attributes.rb', line 67
def release_date
Date.parse(subnode_text('ReleaseDate')) rescue nil
end
|
#trade_in_value ⇒ Object
52
53
54
|
# File 'lib/dustbag/item_attributes.rb', line 52
def trade_in_value
Price.parse(subnode('TradeInValue'))
end
|
#upc_list ⇒ Object
56
57
58
59
60
61
|
# File 'lib/dustbag/item_attributes.rb', line 56
def upc_list
list = subnode('UPCList')
list && list.locate('UPCListElement').map do |element|
element.text
end
end
|