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).



1160
1161
1162
# File 'lib/google4r/checkout/shared.rb', line 1160

def address1
  @address1
end

#address2Object

Second Address line (String optional).



1163
1164
1165
# File 'lib/google4r/checkout/shared.rb', line 1163

def address2
  @address2
end

#company_nameObject

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



1170
1171
1172
# File 'lib/google4r/checkout/shared.rb', line 1170

def company_name
  @company_name
end

#contact_nameObject

Contact name (String, optional).



1157
1158
1159
# File 'lib/google4r/checkout/shared.rb', line 1157

def contact_name
  @contact_name
end

#emailObject

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



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

def email
  @email
end

#faxObject

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



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

def fax
  @fax
end

#phoneObject

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



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

def phone
  @phone
end

Class Method Details

.create_from_element(element) ⇒ Object

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



1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
# File 'lib/google4r/checkout/shared.rb', line 1195

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