Class: GoogleCheckout::Shipping::FlatRate
- Includes:
- Restrictions
- Defined in:
- lib/google-checkout/shipping/flat_rate.rb
Instance Attribute Summary collapse
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#name ⇒ Object
Returns the value of attribute name.
-
#price ⇒ Object
Returns the value of attribute price.
Attributes included from Restrictions
Instance Method Summary collapse
-
#initialize(name, price, currency = 'USD') ⇒ FlatRate
constructor
A new instance of FlatRate.
- #to_xml ⇒ Object
Methods included from Restrictions
#shipping_restrictions?, #shipping_restrictions_xml
Constructor Details
#initialize(name, price, currency = 'USD') ⇒ FlatRate
Returns a new instance of FlatRate.
9 10 11 12 13 14 |
# File 'lib/google-checkout/shipping/flat_rate.rb', line 9 def initialize(name, price, currency = 'USD') @name = name @price = price @currency = currency @shipping_restrictions = {:allowed => [], :excluded => [], :allow_us_po_box => true} end |
Instance Attribute Details
#currency ⇒ Object
Returns the value of attribute currency.
7 8 9 |
# File 'lib/google-checkout/shipping/flat_rate.rb', line 7 def currency @currency end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/google-checkout/shipping/flat_rate.rb', line 7 def name @name end |
#price ⇒ Object
Returns the value of attribute price.
7 8 9 |
# File 'lib/google-checkout/shipping/flat_rate.rb', line 7 def price @price end |
Instance Method Details
#to_xml ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/google-checkout/shipping/flat_rate.rb', line 16 def to_xml xml = Builder::XmlMarkup.new xml.tag!('flat-rate-shipping', :name => name) do xml.tag!('price', price, :currency => currency) xml << shipping_restrictions_xml if shipping_restrictions? end end |