Class: GoogleCheckout::Shipping::FlatRate

Inherits:
Method
  • Object
show all
Includes:
Restrictions
Defined in:
lib/google-checkout/shipping/flat_rate.rb

Instance Attribute Summary collapse

Attributes included from Restrictions

#shipping_restrictions

Instance Method Summary collapse

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

#currencyObject

Returns the value of attribute currency.



7
8
9
# File 'lib/google-checkout/shipping/flat_rate.rb', line 7

def currency
  @currency
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/google-checkout/shipping/flat_rate.rb', line 7

def name
  @name
end

#priceObject

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_xmlObject



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