Class: EME::Billing::Offer
- Inherits:
-
ObjectHash
- Object
- Hash
- ObjectHash
- EME::Billing::Offer
- Defined in:
- lib/eme/billing.rb
Instance Method Summary collapse
-
#initialize(key_values) ⇒ Offer
constructor
A new instance of Offer.
- #price(currency = "USD") ⇒ Object
Methods inherited from ObjectHash
Constructor Details
#initialize(key_values) ⇒ Offer
Returns a new instance of Offer.
426 427 428 429 430 431 432 433 434 435 |
# File 'lib/eme/billing.rb', line 426 def initialize(key_values) key_values.each do |k,v| self[k.to_sym] = v end if self[:items] local_items = [] self[:items].each {|item| local_items << Item.new(item)} self[:items] = local_items end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class EME::Billing::ObjectHash
Instance Method Details
#price(currency = "USD") ⇒ Object
437 438 439 440 |
# File 'lib/eme/billing.rb', line 437 def price(currency = "USD") prod = self.prices.select{|p| p["currency"] == currency}.first return prod["price"].to_f end |