Class: Google4R::Checkout::Address

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

Overview

Address instances are used in NewOrderNotification objects for the buyer’s billing and buyer’s shipping address.

Instance Attribute Summary collapse

Attributes inherited from AnonymousAddress

#address_id, #city, #country_code, #postal_code, #region

Class Method Summary collapse

Instance Attribute Details

#address1Object

Second Address line (String).



1180
1181
1182
# File 'lib/google4r/checkout/shared.rb', line 1180

def address1
  @address1
end

#address2Object

Second Address line (String optional).



1183
1184
1185
# File 'lib/google4r/checkout/shared.rb', line 1183

def address2
  @address2
end

#company_nameObject

The buyer’s company name (String; optional).



1190
1191
1192
# File 'lib/google4r/checkout/shared.rb', line 1190

def company_name
  @company_name
end

#contact_nameObject

Contact name (String, optional).



1177
1178
1179
# File 'lib/google4r/checkout/shared.rb', line 1177

def contact_name
  @contact_name
end

#emailObject

The buyer’s email address (String; optional).



1197
1198
1199
# File 'lib/google4r/checkout/shared.rb', line 1197

def email
  @email
end

#faxObject

The buyer’s phone number (String; optional).



1200
1201
1202
# File 'lib/google4r/checkout/shared.rb', line 1200

def fax
  @fax
end

#phoneObject

The buyer’s phone number (String; Optional, can be enforced in CheckoutCommand).)



1203
1204
1205
# File 'lib/google4r/checkout/shared.rb', line 1203

def phone
  @phone
end

Class Method Details

.create_from_element(element) ⇒ Object

Creates a new Address from the given REXML::Element instance.



1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
# File 'lib/google4r/checkout/shared.rb', line 1215

def self.create_from_element(element)
  result = Address.new
  
  result.address1 = element.elements['address1'].text
  result.address2 = element.elements['address2'].text rescue nil
  result.city = element.elements['city'].text
  result.company_name = element.elements['company-name'].text rescue nil
  result.contact_name = element.elements['contact-name'].text rescue nil
  result.country_code = element.elements['country-code'].text
  result.email = element.elements['email'].text rescue nil
  result.fax = element.elements['fax'].text rescue nil
  result.phone = element.elements['phone'].text rescue nil
  result.postal_code = element.elements['postal-code'].text
  result.region = element.elements['region'].text
  
  return result
end