Class: Google4R::Checkout::Address

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

Overview

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#address1Object

Second Address line (String).



275
276
277
# File 'lib/google4r/checkout/notifications.rb', line 275

def address1
  @address1
end

#address2Object

Second Address line (String optional).



278
279
280
# File 'lib/google4r/checkout/notifications.rb', line 278

def address2
  @address2
end

#cityObject

The buyer’s city name (String).



281
282
283
# File 'lib/google4r/checkout/notifications.rb', line 281

def city
  @city
end

#company_nameObject

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



284
285
286
# File 'lib/google4r/checkout/notifications.rb', line 284

def company_name
  @company_name
end

#contact_nameObject

Contact name (String, optional).



272
273
274
# File 'lib/google4r/checkout/notifications.rb', line 272

def contact_name
  @contact_name
end

#country_codeObject

The buyer’s country code (String, 2 chars, ISO 3166).



287
288
289
# File 'lib/google4r/checkout/notifications.rb', line 287

def country_code
  @country_code
end

#emailObject

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



290
291
292
# File 'lib/google4r/checkout/notifications.rb', line 290

def email
  @email
end

#faxObject

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



293
294
295
# File 'lib/google4r/checkout/notifications.rb', line 293

def fax
  @fax
end

#phoneObject

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



296
297
298
# File 'lib/google4r/checkout/notifications.rb', line 296

def phone
  @phone
end

#postal_codeObject

The buyers postal/zip code (String).



299
300
301
# File 'lib/google4r/checkout/notifications.rb', line 299

def postal_code
  @postal_code
end

#regionObject

The buyer’s geographical region (String).



302
303
304
# File 'lib/google4r/checkout/notifications.rb', line 302

def region
  @region
end

Class Method Details

.create_from_element(element) ⇒ Object

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



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/google4r/checkout/notifications.rb', line 305

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