Class: Goods::Catalog
- Inherits:
-
Object
- Object
- Goods::Catalog
- Defined in:
- lib/goods/catalog.rb
Instance Attribute Summary collapse
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#currencies ⇒ Object
readonly
Returns the value of attribute currencies.
-
#offers ⇒ Object
readonly
Returns the value of attribute offers.
Instance Method Summary collapse
- #convert_currency(other_currency) ⇒ Object
- #date ⇒ Object
-
#initialize(params) ⇒ Catalog
constructor
A new instance of Catalog.
- #prune(level) ⇒ Object
Constructor Details
#initialize(params) ⇒ Catalog
Returns a new instance of Catalog.
5 6 7 8 9 10 11 |
# File 'lib/goods/catalog.rb', line 5 def initialize(params) if params[:string] from_string(params[:string], params[:url], params[:encoding]) else raise ArgumentError, "should provide either :string or :url param" end end |
Instance Attribute Details
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
3 4 5 |
# File 'lib/goods/catalog.rb', line 3 def categories @categories end |
#currencies ⇒ Object (readonly)
Returns the value of attribute currencies.
3 4 5 |
# File 'lib/goods/catalog.rb', line 3 def currencies @currencies end |
#offers ⇒ Object (readonly)
Returns the value of attribute offers.
3 4 5 |
# File 'lib/goods/catalog.rb', line 3 def offers @offers end |
Instance Method Details
#convert_currency(other_currency) ⇒ Object
18 19 20 |
# File 'lib/goods/catalog.rb', line 18 def convert_currency(other_currency) @offers.convert_currency(other_currency) end |
#date ⇒ Object
22 23 24 |
# File 'lib/goods/catalog.rb', line 22 def date @xml.generation_date end |
#prune(level) ⇒ Object
13 14 15 16 |
# File 'lib/goods/catalog.rb', line 13 def prune(level) @offers.prune_categories(level) @categories.prune(level) end |