Class: Raas::BillingAddressModel
- Defined in:
- lib/raas/models/billing_address_model.rb
Overview
Represents a Billing Address
Instance Attribute Summary collapse
-
#address_line1 ⇒ String
The address.
-
#address_line2 ⇒ String
An optional second address line.
-
#city ⇒ String
The city.
-
#country ⇒ String
The 2-letter country code.
-
#email_address ⇒ String
The billing contact’s email address.
-
#first_name ⇒ String
The first name.
-
#last_name ⇒ String
The last name.
-
#postal_code ⇒ String
The postal code.
-
#state ⇒ String
The state/province.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(first_name = nil, last_name = nil, address_line1 = nil, city = nil, state = nil, postal_code = nil, country = nil, email_address = nil, address_line2 = nil) ⇒ BillingAddressModel
constructor
A new instance of BillingAddressModel.
Methods inherited from BaseModel
Constructor Details
#initialize(first_name = nil, last_name = nil, address_line1 = nil, city = nil, state = nil, postal_code = nil, country = nil, email_address = nil, address_line2 = nil) ⇒ BillingAddressModel
Returns a new instance of BillingAddressModel.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/raas/models/billing_address_model.rb', line 58 def initialize(first_name = nil, last_name = nil, address_line1 = nil, city = nil, state = nil, postal_code = nil, country = nil, email_address = nil, address_line2 = nil) @first_name = first_name @last_name = last_name @address_line1 = address_line1 @city = city @state = state @postal_code = postal_code @country = country @email_address = email_address @address_line2 = address_line2 end |
Instance Attribute Details
#address_line1 ⇒ String
The address
17 18 19 |
# File 'lib/raas/models/billing_address_model.rb', line 17 def address_line1 @address_line1 end |
#address_line2 ⇒ String
An optional second address line
41 42 43 |
# File 'lib/raas/models/billing_address_model.rb', line 41 def address_line2 @address_line2 end |
#city ⇒ String
The city
21 22 23 |
# File 'lib/raas/models/billing_address_model.rb', line 21 def city @city end |
#country ⇒ String
The 2-letter country code
33 34 35 |
# File 'lib/raas/models/billing_address_model.rb', line 33 def country @country end |
#email_address ⇒ String
The billing contact’s email address
37 38 39 |
# File 'lib/raas/models/billing_address_model.rb', line 37 def email_address @email_address end |
#first_name ⇒ String
The first name
9 10 11 |
# File 'lib/raas/models/billing_address_model.rb', line 9 def first_name @first_name end |
#last_name ⇒ String
The last name
13 14 15 |
# File 'lib/raas/models/billing_address_model.rb', line 13 def last_name @last_name end |
#postal_code ⇒ String
The postal code
29 30 31 |
# File 'lib/raas/models/billing_address_model.rb', line 29 def postal_code @postal_code end |
#state ⇒ String
The state/province
25 26 27 |
# File 'lib/raas/models/billing_address_model.rb', line 25 def state @state end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/raas/models/billing_address_model.rb', line 79 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. first_name = hash['firstName'] last_name = hash['lastName'] address_line1 = hash['addressLine1'] city = hash['city'] state = hash['state'] postal_code = hash['postalCode'] country = hash['country'] email_address = hash['emailAddress'] address_line2 = hash['addressLine2'] # Create object from extracted values. BillingAddressModel.new(first_name, last_name, address_line1, city, state, postal_code, country, email_address, address_line2) end |
.names ⇒ Object
A mapping from model property names to API property names.
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/raas/models/billing_address_model.rb', line 44 def self.names @_hash = {} if @_hash.nil? @_hash['first_name'] = 'firstName' @_hash['last_name'] = 'lastName' @_hash['address_line1'] = 'addressLine1' @_hash['city'] = 'city' @_hash['state'] = 'state' @_hash['postal_code'] = 'postalCode' @_hash['country'] = 'country' @_hash['email_address'] = 'emailAddress' @_hash['address_line2'] = 'addressLine2' @_hash end |