Class: Google4R::Checkout::UrlParameter

Inherits:
Object
  • Object
show all
Defined in:
lib/google4r/checkout/shared.rb

Overview

Url Paramaters that are available from the Google Checkout API that can be passed to the third party conversion tracker

UrlParameter objects require a parameter name, which is the name of the value to be provided to the third party conversion tracker, and a parameter type which is the name of the value, as assigned by Google Checkout.

The parameter_type must be a string, and must be a valid type, as defined in the subsequant list otherwise an Argument Error is thrown.

The :name symbol must have an associated value, and be of the String class, other an argument error will be thrown Below is a list of defined types, as assigned by Google Checkout.

buyer-id - A Google-assigned value that uniquely identifies a customer email address. order-id - A Google-assigned value that uniquely identifies an order. This value is displayed in the Merchant Center for each order. If you have implemented the Notification API, you will also see this value in all Google Checkout notifications. order-subtotal - The total cost for all of the items in the order including coupons and discounts but excluding taxes and shipping charges. order-subtotal-plus-tax - The total cost for all of the items in the order, including taxes, coupons and discounts, but excluding shipping charges. order-subtotal-plus-shipping - The total cost for all of the items in the order, including shipping charges, coupons and discounts, but excluding taxes. order-total - The total cost for all of the items in the order, including taxes, shipping charges, coupons and discounts. tax-amount - The total amount of taxes charged for an order. shipping-amount - The shipping cost associated with an order. coupon-amount - The total amount of all coupons factored into the order total. billing-city - The city associated with the order’s billing address. billing-region - The U.S. state associated with the order’s billing address. billing-postal-code - The five-digit U.S. zip code associated with the order’s billing address. billing-country-code - The two-letter ISO 3166 country code associated with the order’s billing address. shipping-city - The city associated with the order’s shipping address. shipping-region - The U.S. state associated with the order’s shipping address. shipping-postal-code - The five-digit U.S. zip code associated with the order’s shipping address. shipping-country-code - The two-letter ISO 3166 country code associated with the order’s shipping address.

Constant Summary collapse

VALID_TYPES =
['buyer-id', 'order-id', 'order-subtotal', 'order-subtotal-plus-tax', 'order-subtotal-plus-shipping', 'order-total', 'tax-amount','shipping-amount', 'coupon-amount', 'billing-city', 'billing-region', 'billing-postal-code', 'billing-country-code', 'shipping-city', 'shipping-region', 'shipping-postal-code', 'shipping-country-code'].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parameterized_url, opts) ⇒ UrlParameter

Returns a new instance of UrlParameter.

Raises:

  • (ArgumentError)


1351
1352
1353
1354
1355
1356
1357
1358
# File 'lib/google4r/checkout/shared.rb', line 1351

def initialize(parameterized_url,opts)
  raise(ArgumentError,"url-parameter type can only be #{VALID_TYPES.join(", ")}") unless VALID_TYPES.include?(opts[:type])      
  raise(ArgumentError, "Missing or invalid parameter name") unless opts[:name].kind_of?(String)      
  
  @parameterized_url = parameterized_url
  @name = opts[:name]
  @parameter_type = opts[:type]
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



1347
1348
1349
# File 'lib/google4r/checkout/shared.rb', line 1347

def name
  @name
end

#parameter_typeObject (readonly)

Returns the value of attribute parameter_type.



1347
1348
1349
# File 'lib/google4r/checkout/shared.rb', line 1347

def parameter_type
  @parameter_type
end

#parameterized_urlObject (readonly)

Returns the value of attribute parameterized_url.



1347
1348
1349
# File 'lib/google4r/checkout/shared.rb', line 1347

def parameterized_url
  @parameterized_url
end