Class: AdvancedBilling::OrganizationAddress
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::OrganizationAddress
- Defined in:
- lib/advanced_billing/models/organization_address.rb
Overview
OrganizationAddress Model.
Instance Attribute Summary collapse
-
#city ⇒ String
TODO: Write general description for this method.
-
#country ⇒ String
TODO: Write general description for this method.
-
#line2 ⇒ String
TODO: Write general description for this method.
-
#name ⇒ String
TODO: Write general description for this method.
-
#phone ⇒ String
TODO: Write general description for this method.
-
#state ⇒ String
TODO: Write general description for this method.
-
#street ⇒ String
TODO: Write general description for this method.
-
#zip ⇒ String
TODO: Write general description for this method.
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(street: SKIP, line2: SKIP, city: SKIP, state: SKIP, zip: SKIP, country: SKIP, name: SKIP, phone: SKIP, additional_properties: {}) ⇒ OrganizationAddress
constructor
A new instance of OrganizationAddress.
Methods inherited from BaseModel
Constructor Details
#initialize(street: SKIP, line2: SKIP, city: SKIP, state: SKIP, zip: SKIP, country: SKIP, name: SKIP, phone: SKIP, additional_properties: {}) ⇒ OrganizationAddress
Returns a new instance of OrganizationAddress.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/advanced_billing/models/organization_address.rb', line 86 def initialize(street: SKIP, line2: SKIP, city: SKIP, state: SKIP, zip: SKIP, country: SKIP, name: SKIP, phone: SKIP, additional_properties: {}) @street = street unless street == SKIP @line2 = line2 unless line2 == SKIP @city = city unless city == SKIP @state = state unless state == SKIP @zip = zip unless zip == SKIP @country = country unless country == SKIP @name = name unless name == SKIP @phone = phone unless phone == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#city ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/organization_address.rb', line 22 def city @city end |
#country ⇒ String
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/organization_address.rb', line 34 def country @country end |
#line2 ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/organization_address.rb', line 18 def line2 @line2 end |
#name ⇒ String
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/organization_address.rb', line 38 def name @name end |
#phone ⇒ String
TODO: Write general description for this method
42 43 44 |
# File 'lib/advanced_billing/models/organization_address.rb', line 42 def phone @phone end |
#state ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/organization_address.rb', line 26 def state @state end |
#street ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/organization_address.rb', line 14 def street @street end |
#zip ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/organization_address.rb', line 30 def zip @zip end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/advanced_billing/models/organization_address.rb', line 105 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. street = hash.key?('street') ? hash['street'] : SKIP line2 = hash.key?('line2') ? hash['line2'] : SKIP city = hash.key?('city') ? hash['city'] : SKIP state = hash.key?('state') ? hash['state'] : SKIP zip = hash.key?('zip') ? hash['zip'] : SKIP country = hash.key?('country') ? hash['country'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP phone = hash.key?('phone') ? hash['phone'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. OrganizationAddress.new(street: street, line2: line2, city: city, state: state, zip: zip, country: country, name: name, phone: phone, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/advanced_billing/models/organization_address.rb', line 45 def self.names @_hash = {} if @_hash.nil? @_hash['street'] = 'street' @_hash['line2'] = 'line2' @_hash['city'] = 'city' @_hash['state'] = 'state' @_hash['zip'] = 'zip' @_hash['country'] = 'country' @_hash['name'] = 'name' @_hash['phone'] = 'phone' @_hash end |
.nullables ⇒ Object
An array for nullable fields
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/advanced_billing/models/organization_address.rb', line 73 def self.nullables %w[ street line2 city state zip country name phone ] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/advanced_billing/models/organization_address.rb', line 59 def self.optionals %w[ street line2 city state zip country name phone ] end |