Class: Fassbinder::ShippingBuilder
- Inherits:
-
Object
- Object
- Fassbinder::ShippingBuilder
- Defined in:
- lib/fassbinder/shipping_builder.rb
Constant Summary collapse
- DEFAULT_SHIPPING_CENTS =
{ 'amazon.com' => 399, 'amazon.co.uk' => 280, 'amazon.de' => 299, 'amazon.ca' => 649, 'amazon.fr' => 300, 'amazon.co.jp' => 25000 }
Instance Attribute Summary collapse
-
#shipping ⇒ Object
readonly
Returns the value of attribute shipping.
Instance Method Summary collapse
- #add_availability(hours) ⇒ Object
- #calculate_price(is_free, venue, currency) ⇒ Object
-
#initialize ⇒ ShippingBuilder
constructor
A new instance of ShippingBuilder.
Constructor Details
#initialize ⇒ ShippingBuilder
Returns a new instance of ShippingBuilder.
12 13 14 |
# File 'lib/fassbinder/shipping_builder.rb', line 12 def initialize @shipping = Kosher::Shipping.new end |
Instance Attribute Details
#shipping ⇒ Object (readonly)
Returns the value of attribute shipping.
10 11 12 |
# File 'lib/fassbinder/shipping_builder.rb', line 10 def shipping @shipping end |
Instance Method Details
#add_availability(hours) ⇒ Object
16 17 18 19 20 |
# File 'lib/fassbinder/shipping_builder.rb', line 16 def add_availability(hours) availability = Kosher::Availability.new availability.hours = hours.to_i @shipping.availability = availability end |
#calculate_price(is_free, venue, currency) ⇒ Object
22 23 24 25 |
# File 'lib/fassbinder/shipping_builder.rb', line 22 def calculate_price(is_free, venue, currency) @shipping.cents = is_free ? 0 : DEFAULT_SHIPPING_CENTS[venue] @shipping.currency = currency end |