Class: Verizon::Address
- Defined in:
- lib/verizon/models/address.rb
Overview
The customer address for the line’s primary place of use, for line usage taxation.
Instance Attribute Summary collapse
-
#address_line1 ⇒ String
The street address for the line’s primary place of use.
-
#address_line2 ⇒ String
Optional additional street address information.
-
#city ⇒ String
The city for the line’s primary place of use.
-
#country ⇒ String
Either “US” or “USA” for the country of the line’s primary place of use.
-
#email_address ⇒ String
An email address for the customer.
-
#phone ⇒ String
A phone number where the customer can be reached.
-
#phone_type ⇒ String
A single letter to indicate the customer phone type.
-
#state ⇒ String
The state for the line’s primary place of use.
-
#zip ⇒ String
The ZIP code for the line’s primary place of use.
-
#zip4 ⇒ String
The ZIP+4 for the line’s primary place of use.
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.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(address_line1 = nil, city = nil, state = nil, zip = nil, country = nil, address_line2 = SKIP, zip4 = SKIP, phone = SKIP, phone_type = SKIP, email_address = SKIP) ⇒ Address
constructor
A new instance of Address.
Methods inherited from BaseModel
Constructor Details
#initialize(address_line1 = nil, city = nil, state = nil, zip = nil, country = nil, address_line2 = SKIP, zip4 = SKIP, phone = SKIP, phone_type = SKIP, email_address = SKIP) ⇒ Address
Returns a new instance of Address.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/verizon/models/address.rb', line 86 def initialize(address_line1 = nil, city = nil, state = nil, zip = nil, country = nil, address_line2 = SKIP, zip4 = SKIP, phone = SKIP, phone_type = SKIP, email_address = SKIP) @address_line1 = address_line1 @address_line2 = address_line2 unless address_line2 == SKIP @city = city @state = state @zip = zip @zip4 = zip4 unless zip4 == SKIP @country = country @phone = phone unless phone == SKIP @phone_type = phone_type unless phone_type == SKIP @email_address = email_address unless email_address == SKIP end |
Instance Attribute Details
#address_line1 ⇒ String
The street address for the line’s primary place of use. This must be a physical address for taxation; it cannot be a P.O. box.
16 17 18 |
# File 'lib/verizon/models/address.rb', line 16 def address_line1 @address_line1 end |
#address_line2 ⇒ String
Optional additional street address information.
20 21 22 |
# File 'lib/verizon/models/address.rb', line 20 def address_line2 @address_line2 end |
#city ⇒ String
The city for the line’s primary place of use.
24 25 26 |
# File 'lib/verizon/models/address.rb', line 24 def city @city end |
#country ⇒ String
Either “US” or “USA” for the country of the line’s primary place of use.
40 41 42 |
# File 'lib/verizon/models/address.rb', line 40 def country @country end |
#email_address ⇒ String
An email address for the customer.
52 53 54 |
# File 'lib/verizon/models/address.rb', line 52 def email_address @email_address end |
#phone ⇒ String
A phone number where the customer can be reached.
44 45 46 |
# File 'lib/verizon/models/address.rb', line 44 def phone @phone end |
#phone_type ⇒ String
A single letter to indicate the customer phone type.
48 49 50 |
# File 'lib/verizon/models/address.rb', line 48 def phone_type @phone_type end |
#state ⇒ String
The state for the line’s primary place of use.
28 29 30 |
# File 'lib/verizon/models/address.rb', line 28 def state @state end |
#zip ⇒ String
The ZIP code for the line’s primary place of use.
32 33 34 |
# File 'lib/verizon/models/address.rb', line 32 def zip @zip end |
#zip4 ⇒ String
The ZIP+4 for the line’s primary place of use.
36 37 38 |
# File 'lib/verizon/models/address.rb', line 36 def zip4 @zip4 end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/verizon/models/address.rb', line 109 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. address_line1 = hash.key?('addressLine1') ? hash['addressLine1'] : nil city = hash.key?('city') ? hash['city'] : nil state = hash.key?('state') ? hash['state'] : nil zip = hash.key?('zip') ? hash['zip'] : nil country = hash.key?('country') ? hash['country'] : nil address_line2 = hash.key?('addressLine2') ? hash['addressLine2'] : SKIP zip4 = hash.key?('zip4') ? hash['zip4'] : SKIP phone = hash.key?('phone') ? hash['phone'] : SKIP phone_type = hash.key?('phoneType') ? hash['phoneType'] : SKIP email_address = hash.key?('emailAddress') ? hash['emailAddress'] : SKIP # Create object from extracted values. Address.new(address_line1, city, state, zip, country, address_line2, zip4, phone, phone_type, email_address) end |
.names ⇒ Object
A mapping from model property names to API property names.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/verizon/models/address.rb', line 55 def self.names @_hash = {} if @_hash.nil? @_hash['address_line1'] = 'addressLine1' @_hash['address_line2'] = 'addressLine2' @_hash['city'] = 'city' @_hash['state'] = 'state' @_hash['zip'] = 'zip' @_hash['zip4'] = 'zip4' @_hash['country'] = 'country' @_hash['phone'] = 'phone' @_hash['phone_type'] = 'phoneType' @_hash['email_address'] = 'emailAddress' @_hash end |
.nullables ⇒ Object
An array for nullable fields
82 83 84 |
# File 'lib/verizon/models/address.rb', line 82 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
71 72 73 74 75 76 77 78 79 |
# File 'lib/verizon/models/address.rb', line 71 def self.optionals %w[ address_line2 zip4 phone phone_type email_address ] end |