Class: AdvancedBilling::CreateInvoiceAddress
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreateInvoiceAddress
- Defined in:
- lib/advanced_billing/models/create_invoice_address.rb
Overview
Overrides the default address.
Instance Attribute Summary collapse
-
#address ⇒ String
TODO: Write general description for this method.
-
#address_2 ⇒ String
TODO: Write general description for this method.
-
#city ⇒ String
TODO: Write general description for this method.
-
#country ⇒ String
TODO: Write general description for this method.
-
#first_name ⇒ String
TODO: Write general description for this method.
-
#last_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.
-
#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(first_name: SKIP, last_name: SKIP, phone: SKIP, address: SKIP, address_2: SKIP, city: SKIP, state: SKIP, zip: SKIP, country: SKIP, additional_properties: {}) ⇒ CreateInvoiceAddress
constructor
A new instance of CreateInvoiceAddress.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(first_name: SKIP, last_name: SKIP, phone: SKIP, address: SKIP, address_2: SKIP, city: SKIP, state: SKIP, zip: SKIP, country: SKIP, additional_properties: {}) ⇒ CreateInvoiceAddress
Returns a new instance of CreateInvoiceAddress.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 83 def initialize(first_name: SKIP, last_name: SKIP, phone: SKIP, address: SKIP, address_2: 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 @first_name = first_name unless first_name == SKIP @last_name = last_name unless last_name == SKIP @phone = phone unless phone == SKIP @address = address unless address == SKIP @address_2 = address_2 unless address_2 == 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
#address ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 26 def address @address end |
#address_2 ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 30 def address_2 @address_2 end |
#city ⇒ String
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 34 def city @city end |
#country ⇒ String
TODO: Write general description for this method
46 47 48 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 46 def country @country end |
#first_name ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 14 def first_name @first_name end |
#last_name ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 18 def last_name @last_name end |
#phone ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 22 def phone @phone end |
#state ⇒ String
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 38 def state @state end |
#zip ⇒ String
TODO: Write general description for this method
42 43 44 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 42 def zip @zip end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
103 104 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/create_invoice_address.rb', line 103 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. first_name = hash.key?('first_name') ? hash['first_name'] : SKIP last_name = hash.key?('last_name') ? hash['last_name'] : SKIP phone = hash.key?('phone') ? hash['phone'] : SKIP address = hash.key?('address') ? hash['address'] : SKIP address_2 = hash.key?('address_2') ? hash['address_2'] : 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. CreateInvoiceAddress.new(first_name: first_name, last_name: last_name, phone: phone, address: address, address_2: address_2, 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.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['first_name'] = 'first_name' @_hash['last_name'] = 'last_name' @_hash['phone'] = 'phone' @_hash['address'] = 'address' @_hash['address_2'] = 'address_2' @_hash['city'] = 'city' @_hash['state'] = 'state' @_hash['zip'] = 'zip' @_hash['country'] = 'country' @_hash end |
.nullables ⇒ Object
An array for nullable fields
79 80 81 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 79 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/advanced_billing/models/create_invoice_address.rb', line 64 def self.optionals %w[ first_name last_name phone address address_2 city state zip country ] end |