Class: AdvancedBilling::InvoiceAddress
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::InvoiceAddress
- Defined in:
- lib/advanced_billing/models/invoice_address.rb
Overview
InvoiceAddress 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.
-
#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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(street: SKIP, line2: SKIP, city: SKIP, state: SKIP, zip: SKIP, country: SKIP, additional_properties: {}) ⇒ InvoiceAddress
constructor
A new instance of InvoiceAddress.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(street: SKIP, line2: SKIP, city: SKIP, state: SKIP, zip: SKIP, country: SKIP, additional_properties: {}) ⇒ InvoiceAddress
Returns a new instance of InvoiceAddress.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/advanced_billing/models/invoice_address.rb', line 72 def initialize(street: SKIP, line2: SKIP, city: SKIP, state: SKIP, zip: SKIP, country: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @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 end |
Instance Attribute Details
#city ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/invoice_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/invoice_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/invoice_address.rb', line 18 def line2 @line2 end |
#state ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/invoice_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/invoice_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/invoice_address.rb', line 30 def zip @zip end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/advanced_billing/models/invoice_address.rb', line 88 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 # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. InvoiceAddress.new(street: street, line2: line2, city: city, state: state, zip: zip, country: country, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/advanced_billing/models/invoice_address.rb', line 37 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 end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/advanced_billing/models/invoice_address.rb', line 61 def self.nullables %w[ street line2 city state zip country ] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/advanced_billing/models/invoice_address.rb', line 49 def self.optionals %w[ street line2 city state zip country ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
114 115 116 117 118 119 120 |
# File 'lib/advanced_billing/models/invoice_address.rb', line 114 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |