Class: AdvancedBilling::CreateCustomer
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreateCustomer
- Defined in:
- lib/advanced_billing/models/create_customer.rb
Overview
CreateCustomer Model.
Instance Attribute Summary collapse
-
#address ⇒ String
TODO: Write general description for this method.
-
#address_2 ⇒ String
TODO: Write general description for this method.
-
#cc_emails ⇒ 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.
-
#email ⇒ 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.
-
#locale ⇒ String
Set a specific language on a customer record.
-
#organization ⇒ String
TODO: Write general description for this method.
-
#parent_id ⇒ Integer
The parent ID in Chargify if applicable.
-
#phone ⇒ String
TODO: Write general description for this method.
-
#reference ⇒ String
TODO: Write general description for this method.
-
#salesforce_id ⇒ String
The Salesforce ID of the customer.
-
#state ⇒ String
TODO: Write general description for this method.
-
#tax_exempt ⇒ TrueClass | FalseClass
Set a specific language on a customer record.
-
#tax_exempt_reason ⇒ String
Set a specific language on a customer record.
-
#vat_number ⇒ String
Set a specific language on a customer record.
-
#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:, last_name:, email:, cc_emails: SKIP, organization: SKIP, reference: SKIP, address: SKIP, address_2: SKIP, city: SKIP, state: SKIP, zip: SKIP, country: SKIP, phone: SKIP, locale: SKIP, vat_number: SKIP, tax_exempt: SKIP, tax_exempt_reason: SKIP, parent_id: SKIP, salesforce_id: SKIP, additional_properties: {}) ⇒ CreateCustomer
constructor
A new instance of CreateCustomer.
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:, last_name:, email:, cc_emails: SKIP, organization: SKIP, reference: SKIP, address: SKIP, address_2: SKIP, city: SKIP, state: SKIP, zip: SKIP, country: SKIP, phone: SKIP, locale: SKIP, vat_number: SKIP, tax_exempt: SKIP, tax_exempt_reason: SKIP, parent_id: SKIP, salesforce_id: SKIP, additional_properties: {}) ⇒ CreateCustomer
Returns a new instance of CreateCustomer.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/advanced_billing/models/create_customer.rb', line 144 def initialize(first_name:, last_name:, email:, cc_emails: SKIP, organization: SKIP, reference: SKIP, address: SKIP, address_2: SKIP, city: SKIP, state: SKIP, zip: SKIP, country: SKIP, phone: SKIP, locale: SKIP, vat_number: SKIP, tax_exempt: SKIP, tax_exempt_reason: SKIP, parent_id: SKIP, salesforce_id: 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 @last_name = last_name @email = email @cc_emails = cc_emails unless cc_emails == SKIP @organization = organization unless organization == SKIP @reference = reference unless reference == 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 @phone = phone unless phone == SKIP @locale = locale unless locale == SKIP @vat_number = vat_number unless vat_number == SKIP @tax_exempt = tax_exempt unless tax_exempt == SKIP @tax_exempt_reason = tax_exempt_reason unless tax_exempt_reason == SKIP @parent_id = parent_id unless parent_id == SKIP @salesforce_id = salesforce_id unless salesforce_id == SKIP end |
Instance Attribute Details
#address ⇒ String
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/create_customer.rb', line 38 def address @address end |
#address_2 ⇒ String
TODO: Write general description for this method
42 43 44 |
# File 'lib/advanced_billing/models/create_customer.rb', line 42 def address_2 @address_2 end |
#cc_emails ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/create_customer.rb', line 26 def cc_emails @cc_emails end |
#city ⇒ String
TODO: Write general description for this method
46 47 48 |
# File 'lib/advanced_billing/models/create_customer.rb', line 46 def city @city end |
#country ⇒ String
TODO: Write general description for this method
58 59 60 |
# File 'lib/advanced_billing/models/create_customer.rb', line 58 def country @country end |
#email ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/create_customer.rb', line 22 def email @email end |
#first_name ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/create_customer.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_customer.rb', line 18 def last_name @last_name end |
#locale ⇒ String
Set a specific language on a customer record.
66 67 68 |
# File 'lib/advanced_billing/models/create_customer.rb', line 66 def locale @locale end |
#organization ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/create_customer.rb', line 30 def organization @organization end |
#parent_id ⇒ Integer
The parent ID in Chargify if applicable. Parent is another Customer object.
83 84 85 |
# File 'lib/advanced_billing/models/create_customer.rb', line 83 def parent_id @parent_id end |
#phone ⇒ String
TODO: Write general description for this method
62 63 64 |
# File 'lib/advanced_billing/models/create_customer.rb', line 62 def phone @phone end |
#reference ⇒ String
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/create_customer.rb', line 34 def reference @reference end |
#salesforce_id ⇒ String
The Salesforce ID of the customer
87 88 89 |
# File 'lib/advanced_billing/models/create_customer.rb', line 87 def salesforce_id @salesforce_id end |
#state ⇒ String
TODO: Write general description for this method
50 51 52 |
# File 'lib/advanced_billing/models/create_customer.rb', line 50 def state @state end |
#tax_exempt ⇒ TrueClass | FalseClass
Set a specific language on a customer record.
74 75 76 |
# File 'lib/advanced_billing/models/create_customer.rb', line 74 def tax_exempt @tax_exempt end |
#tax_exempt_reason ⇒ String
Set a specific language on a customer record.
78 79 80 |
# File 'lib/advanced_billing/models/create_customer.rb', line 78 def tax_exempt_reason @tax_exempt_reason end |
#vat_number ⇒ String
Set a specific language on a customer record.
70 71 72 |
# File 'lib/advanced_billing/models/create_customer.rb', line 70 def vat_number @vat_number end |
#zip ⇒ String
TODO: Write general description for this method
54 55 56 |
# File 'lib/advanced_billing/models/create_customer.rb', line 54 def zip @zip end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/advanced_billing/models/create_customer.rb', line 177 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. first_name = hash.key?('first_name') ? hash['first_name'] : nil last_name = hash.key?('last_name') ? hash['last_name'] : nil email = hash.key?('email') ? hash['email'] : nil cc_emails = hash.key?('cc_emails') ? hash['cc_emails'] : SKIP organization = hash.key?('organization') ? hash['organization'] : SKIP reference = hash.key?('reference') ? hash['reference'] : 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 phone = hash.key?('phone') ? hash['phone'] : SKIP locale = hash.key?('locale') ? hash['locale'] : SKIP vat_number = hash.key?('vat_number') ? hash['vat_number'] : SKIP tax_exempt = hash.key?('tax_exempt') ? hash['tax_exempt'] : SKIP tax_exempt_reason = hash.key?('tax_exempt_reason') ? hash['tax_exempt_reason'] : SKIP parent_id = hash.key?('parent_id') ? hash['parent_id'] : SKIP salesforce_id = hash.key?('salesforce_id') ? hash['salesforce_id'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. CreateCustomer.new(first_name: first_name, last_name: last_name, email: email, cc_emails: cc_emails, organization: organization, reference: reference, address: address, address_2: address_2, city: city, state: state, zip: zip, country: country, phone: phone, locale: locale, vat_number: vat_number, tax_exempt: tax_exempt, tax_exempt_reason: tax_exempt_reason, parent_id: parent_id, salesforce_id: salesforce_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/advanced_billing/models/create_customer.rb', line 90 def self.names @_hash = {} if @_hash.nil? @_hash['first_name'] = 'first_name' @_hash['last_name'] = 'last_name' @_hash['email'] = 'email' @_hash['cc_emails'] = 'cc_emails' @_hash['organization'] = 'organization' @_hash['reference'] = 'reference' @_hash['address'] = 'address' @_hash['address_2'] = 'address_2' @_hash['city'] = 'city' @_hash['state'] = 'state' @_hash['zip'] = 'zip' @_hash['country'] = 'country' @_hash['phone'] = 'phone' @_hash['locale'] = 'locale' @_hash['vat_number'] = 'vat_number' @_hash['tax_exempt'] = 'tax_exempt' @_hash['tax_exempt_reason'] = 'tax_exempt_reason' @_hash['parent_id'] = 'parent_id' @_hash['salesforce_id'] = 'salesforce_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
137 138 139 140 141 142 |
# File 'lib/advanced_billing/models/create_customer.rb', line 137 def self.nullables %w[ parent_id salesforce_id ] end |
.optionals ⇒ Object
An array for optional fields
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/advanced_billing/models/create_customer.rb', line 115 def self.optionals %w[ cc_emails organization reference address address_2 city state zip country phone locale vat_number tax_exempt tax_exempt_reason parent_id salesforce_id ] end |