Class: Workarea::GlobalE::AddressDetails
- Inherits:
-
Object
- Object
- Workarea::GlobalE::AddressDetails
- Defined in:
- app/services/workarea/global_e/address_details.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#address1 ⇒ String
Address line 1.
-
#address2 ⇒ String
Address line 2.
-
#address_book_id ⇒ String
Id of the current address from within the address book.
- #as_json(*args) ⇒ Object
-
#city ⇒ String
City name.
-
#company ⇒ Object
Company name.
-
#country_code ⇒ String
2-char ISO country code.
-
#email ⇒ String
E-mail address.
-
#fax ⇒ String
Fax.
-
#first_name ⇒ String
First name.
-
#initialize(user, address) ⇒ AddressDetails
constructor
A new instance of AddressDetails.
-
#is_billing ⇒ Boolean
Indicates that the current address can be used as a billing address.
-
#is_default_billing ⇒ Boolean
Indicates that the current address is the default billing address.
-
#is_default_shipping ⇒ Boolean
Indicates that the current address is the default shipping address.
-
#is_shipping ⇒ Boolean
Indicates that the current address can be used as a shipping address.
-
#last_name ⇒ String
Last name.
-
#middle_name ⇒ String
Middle name.
-
#phone1 ⇒ String
Phone 1.
-
#phone2 ⇒ String
Phone 2.
-
#salutation ⇒ String
Salutation or title (e.g. Dr., Mr., etc.).
-
#state_code ⇒ String
State or province ISO code such as AZ for Arizona (if applicable).
-
#state_or_province ⇒ String
State or province name.
-
#user_id_number ⇒ String
User’s personal ID document number.
-
#user_id_number_type ⇒ Object
User’s personal ID document type (e.g. Passport, ID card, etc.).
-
#zip ⇒ String
Zip or postal code.
Constructor Details
#initialize(user, address) ⇒ AddressDetails
Returns a new instance of AddressDetails.
6 7 8 9 |
# File 'app/services/workarea/global_e/address_details.rb', line 6 def initialize(user, address) @user = user @address = address end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
4 5 6 |
# File 'app/services/workarea/global_e/address_details.rb', line 4 def address @address end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'app/services/workarea/global_e/address_details.rb', line 4 def user @user end |
Instance Method Details
#address1 ⇒ String
Address line 1
125 126 127 |
# File 'app/services/workarea/global_e/address_details.rb', line 125 def address1 address.street end |
#address2 ⇒ String
Address line 2
133 134 135 |
# File 'app/services/workarea/global_e/address_details.rb', line 133 def address2 address.street_2 end |
#address_book_id ⇒ String
Id of the current address from within the address book
213 214 215 |
# File 'app/services/workarea/global_e/address_details.rb', line 213 def address_book_id address.id.to_s end |
#as_json(*args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/services/workarea/global_e/address_details.rb', line 11 def as_json(*args) { UserIdNumber: user_id_number, UserIdNumberType: user_id_number_type, FirstName: first_name, LastName: last_name, MiddleName: middle_name, Salutation: salutation, Phone1: phone1, Phone2: phone2, Fax: fax, Email: email, Company: company, Address1: address1, Address2: address2, City: city, StateOrProvice: state_or_province, StateCode: state_code, Zip: zip, CountryCode: country_code, IsShipping: is_shipping, IsBilling: is_billing, IsDefaultShipping: is_default_shipping, IsDefaultBilling: is_default_billing, AddressBookId: address_book_id }.compact end |
#city ⇒ String
City name
141 142 143 |
# File 'app/services/workarea/global_e/address_details.rb', line 141 def city address.city end |
#company ⇒ Object
Company name
@return [String]
117 118 119 |
# File 'app/services/workarea/global_e/address_details.rb', line 117 def company address.company end |
#country_code ⇒ String
2-char ISO country code
173 174 175 |
# File 'app/services/workarea/global_e/address_details.rb', line 173 def country_code address.country.alpha2 end |
#email ⇒ String
E-mail address
109 110 111 |
# File 'app/services/workarea/global_e/address_details.rb', line 109 def email user.email end |
#fax ⇒ String
Fax
102 103 |
# File 'app/services/workarea/global_e/address_details.rb', line 102 def fax end |
#first_name ⇒ String
First name
57 58 59 |
# File 'app/services/workarea/global_e/address_details.rb', line 57 def first_name address.first_name end |
#is_billing ⇒ Boolean
Indicates that the current address can be used as a billing address
189 190 191 |
# File 'app/services/workarea/global_e/address_details.rb', line 189 def is_billing address.last_billed_at.present? end |
#is_default_billing ⇒ Boolean
Indicates that the current address is the default billing address
205 206 207 |
# File 'app/services/workarea/global_e/address_details.rb', line 205 def is_default_billing user.default_billing_address == address end |
#is_default_shipping ⇒ Boolean
Indicates that the current address is the default shipping address
197 198 199 |
# File 'app/services/workarea/global_e/address_details.rb', line 197 def is_default_shipping user.default_shipping_address == address end |
#is_shipping ⇒ Boolean
Indicates that the current address can be used as a shipping address
181 182 183 |
# File 'app/services/workarea/global_e/address_details.rb', line 181 def is_shipping address.last_shipped_at.present? end |
#last_name ⇒ String
Last name
65 66 67 |
# File 'app/services/workarea/global_e/address_details.rb', line 65 def last_name address.last_name end |
#middle_name ⇒ String
Middle name
73 74 |
# File 'app/services/workarea/global_e/address_details.rb', line 73 def middle_name end |
#phone1 ⇒ String
Phone 1
87 88 89 |
# File 'app/services/workarea/global_e/address_details.rb', line 87 def phone1 address.phone_number end |
#phone2 ⇒ String
Phone 2
95 96 |
# File 'app/services/workarea/global_e/address_details.rb', line 95 def phone2 end |
#salutation ⇒ String
Salutation or title (e.g. Dr., Mr., etc.)
80 81 |
# File 'app/services/workarea/global_e/address_details.rb', line 80 def salutation end |
#state_code ⇒ String
State or province ISO code such as AZ for Arizona (if applicable)
157 158 159 |
# File 'app/services/workarea/global_e/address_details.rb', line 157 def state_code address.region end |
#state_or_province ⇒ String
State or province name
149 150 151 |
# File 'app/services/workarea/global_e/address_details.rb', line 149 def state_or_province address.country.subdivisions[address.region].name rescue nil end |
#user_id_number ⇒ String
User’s personal ID document number
43 44 |
# File 'app/services/workarea/global_e/address_details.rb', line 43 def user_id_number end |
#user_id_number_type ⇒ Object
User’s personal ID document type (e.g. Passport, ID card, etc.)
UserIdNumberType
50 51 |
# File 'app/services/workarea/global_e/address_details.rb', line 50 def user_id_number_type end |
#zip ⇒ String
Zip or postal code
165 166 167 |
# File 'app/services/workarea/global_e/address_details.rb', line 165 def zip address.postal_code end |