Class: GoogleCheckout::Shipping::MerchantCalculated

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

Instance Attribute Summary collapse

Attributes included from Filters

#address_filters

Attributes included from Restrictions

#shipping_restrictions

Instance Method Summary collapse

Methods included from Filters

#address_filters?, #address_filters_xml

Methods included from Restrictions

#shipping_restrictions?, #shipping_restrictions_xml

Constructor Details

#initialize(name, price, currency = 'USD') ⇒ MerchantCalculated

Returns a new instance of MerchantCalculated.



10
11
12
13
14
15
16
# File 'lib/google-checkout/shipping/merchant_calculated.rb', line 10

def initialize(name, price, currency = 'USD')
  @name = name
  @price = price
  @currency = currency
  @shipping_restrictions = {:allowed => [], :excluded => [], :allow_us_po_box => true}
  @address_filters = {:allowed => [], :excluded => [], :allow_us_po_box => true}
end

Instance Attribute Details

#currencyObject

Returns the value of attribute currency.



8
9
10
# File 'lib/google-checkout/shipping/merchant_calculated.rb', line 8

def currency
  @currency
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/google-checkout/shipping/merchant_calculated.rb', line 8

def name
  @name
end

#priceObject

Returns the value of attribute price.



8
9
10
# File 'lib/google-checkout/shipping/merchant_calculated.rb', line 8

def price
  @price
end

Instance Method Details

#to_xmlObject



18
19
20
21
22
23
24
25
# File 'lib/google-checkout/shipping/merchant_calculated.rb', line 18

def to_xml
  xml = Builder::XmlMarkup.new
  xml.tag!('merchant-calculated-shipping', :name => name) do
    xml.tag!('price', price, :currency => currency)
    xml << shipping_restrictions_xml if shipping_restrictions?
    xml << address_filters_xml if address_filters?
  end
end