Class: AdvancedBilling::UpdateCustomer

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/update_customer.rb

Overview

UpdateCustomer Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #get_additional_properties, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(first_name: SKIP, last_name: SKIP, email: SKIP, 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, surcharging: SKIP, tax_exempt_reason: SKIP, parent_id: SKIP, verified: SKIP, salesforce_id: SKIP, branding_theme_id: SKIP, additional_properties: {}) ⇒ UpdateCustomer

Returns a new instance of UpdateCustomer.



173
174
175
176
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
# File 'lib/advanced_billing/models/update_customer.rb', line 173

def initialize(first_name: SKIP, last_name: SKIP, email: SKIP,
               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, surcharging: SKIP,
               tax_exempt_reason: SKIP, parent_id: SKIP, verified: SKIP,
               salesforce_id: SKIP, branding_theme_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 unless first_name == SKIP
  @last_name = last_name unless last_name == SKIP
  @email = email unless email == SKIP
  @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
  @surcharging = surcharging unless surcharging == SKIP
  @tax_exempt_reason = tax_exempt_reason unless tax_exempt_reason == SKIP
  @parent_id = parent_id unless parent_id == SKIP
  @verified = verified unless verified == SKIP
  @salesforce_id = salesforce_id unless salesforce_id == SKIP
  @branding_theme_id = branding_theme_id unless branding_theme_id == SKIP
end

Instance Attribute Details

#addressString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/advanced_billing/models/update_customer.rb', line 38

def address
  @address
end

#address_2String

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/advanced_billing/models/update_customer.rb', line 42

def address_2
  @address_2
end

#branding_theme_idInteger

The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. This customer-level Branding Theme is used when a subscription does not have its own subscription-level Branding Theme. Available only when Branding Themes are enabled for the site.

Returns:

  • (Integer)


105
106
107
# File 'lib/advanced_billing/models/update_customer.rb', line 105

def branding_theme_id
  @branding_theme_id
end

#cc_emailsString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/advanced_billing/models/update_customer.rb', line 26

def cc_emails
  @cc_emails
end

#cityString

TODO: Write general description for this method

Returns:

  • (String)


46
47
48
# File 'lib/advanced_billing/models/update_customer.rb', line 46

def city
  @city
end

#countryString

TODO: Write general description for this method

Returns:

  • (String)


58
59
60
# File 'lib/advanced_billing/models/update_customer.rb', line 58

def country
  @country
end

#emailString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/advanced_billing/models/update_customer.rb', line 22

def email
  @email
end

#first_nameString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/advanced_billing/models/update_customer.rb', line 14

def first_name
  @first_name
end

#last_nameString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/advanced_billing/models/update_customer.rb', line 18

def last_name
  @last_name
end

#localeString

Set a specific language on a customer record.

Returns:

  • (String)


66
67
68
# File 'lib/advanced_billing/models/update_customer.rb', line 66

def locale
  @locale
end

#organizationString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/advanced_billing/models/update_customer.rb', line 30

def organization
  @organization
end

#parent_idInteger

Whether surcharging is enabled for the customer. Only applied on sites where surcharging control is enabled.

Returns:

  • (Integer)


89
90
91
# File 'lib/advanced_billing/models/update_customer.rb', line 89

def parent_id
  @parent_id
end

#phoneString

TODO: Write general description for this method

Returns:

  • (String)


62
63
64
# File 'lib/advanced_billing/models/update_customer.rb', line 62

def phone
  @phone
end

#referenceString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/advanced_billing/models/update_customer.rb', line 34

def reference
  @reference
end

#salesforce_idString

The Salesforce ID of the customer

Returns:

  • (String)


98
99
100
# File 'lib/advanced_billing/models/update_customer.rb', line 98

def salesforce_id
  @salesforce_id
end

#stateString

TODO: Write general description for this method

Returns:

  • (String)


50
51
52
# File 'lib/advanced_billing/models/update_customer.rb', line 50

def state
  @state
end

#surchargingTrueClass | FalseClass

Whether surcharging is enabled for the customer. Only applied on sites where surcharging control is enabled.

Returns:

  • (TrueClass | FalseClass)


79
80
81
# File 'lib/advanced_billing/models/update_customer.rb', line 79

def surcharging
  @surcharging
end

#tax_exemptTrueClass | FalseClass

Set a specific language on a customer record.

Returns:

  • (TrueClass | FalseClass)


74
75
76
# File 'lib/advanced_billing/models/update_customer.rb', line 74

def tax_exempt
  @tax_exempt
end

#tax_exempt_reasonString

Whether surcharging is enabled for the customer. Only applied on sites where surcharging control is enabled.

Returns:

  • (String)


84
85
86
# File 'lib/advanced_billing/models/update_customer.rb', line 84

def tax_exempt_reason
  @tax_exempt_reason
end

#vat_numberString

Set a specific language on a customer record.

Returns:

  • (String)


70
71
72
# File 'lib/advanced_billing/models/update_customer.rb', line 70

def vat_number
  @vat_number
end

#verifiedTrueClass | FalseClass

Is the customer verified to use ACH as a payment method. Available only on the Authorize.Net gateway.

Returns:

  • (TrueClass | FalseClass)


94
95
96
# File 'lib/advanced_billing/models/update_customer.rb', line 94

def verified
  @verified
end

#zipString

TODO: Write general description for this method

Returns:

  • (String)


54
55
56
# File 'lib/advanced_billing/models/update_customer.rb', line 54

def zip
  @zip
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/advanced_billing/models/update_customer.rb', line 211

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
  email = hash.key?('email') ? hash['email'] : SKIP
  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
  surcharging = hash.key?('surcharging') ? hash['surcharging'] : SKIP
  tax_exempt_reason =
    hash.key?('tax_exempt_reason') ? hash['tax_exempt_reason'] : SKIP
  parent_id = hash.key?('parent_id') ? hash['parent_id'] : SKIP
  verified = hash.key?('verified') ? hash['verified'] : SKIP
  salesforce_id = hash.key?('salesforce_id') ? hash['salesforce_id'] : SKIP
  branding_theme_id =
    hash.key?('branding_theme_id') ? hash['branding_theme_id'] : SKIP

  # Clean out expected properties from Hash.
  additional_properties = hash.reject { |k, _| names.value?(k) }

  # Create object from extracted values.
  UpdateCustomer.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,
                     surcharging: surcharging,
                     tax_exempt_reason: tax_exempt_reason,
                     parent_id: parent_id,
                     verified: verified,
                     salesforce_id: salesforce_id,
                     branding_theme_id: branding_theme_id,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



108
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
# File 'lib/advanced_billing/models/update_customer.rb', line 108

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['surcharging'] = 'surcharging'
  @_hash['tax_exempt_reason'] = 'tax_exempt_reason'
  @_hash['parent_id'] = 'parent_id'
  @_hash['verified'] = 'verified'
  @_hash['salesforce_id'] = 'salesforce_id'
  @_hash['branding_theme_id'] = 'branding_theme_id'
  @_hash
end

.nullablesObject

An array for nullable fields



164
165
166
167
168
169
170
171
# File 'lib/advanced_billing/models/update_customer.rb', line 164

def self.nullables
  %w[
    parent_id
    verified
    salesforce_id
    branding_theme_id
  ]
end

.optionalsObject

An array for optional fields



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/advanced_billing/models/update_customer.rb', line 136

def self.optionals
  %w[
    first_name
    last_name
    email
    cc_emails
    organization
    reference
    address
    address_2
    city
    state
    zip
    country
    phone
    locale
    vat_number
    tax_exempt
    surcharging
    tax_exempt_reason
    parent_id
    verified
    salesforce_id
    branding_theme_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/advanced_billing/models/update_customer.rb', line 283

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} first_name: #{@first_name.inspect}, last_name: #{@last_name.inspect},"\
  " email: #{@email.inspect}, cc_emails: #{@cc_emails.inspect}, organization:"\
  " #{@organization.inspect}, reference: #{@reference.inspect}, address: #{@address.inspect},"\
  " address_2: #{@address_2.inspect}, city: #{@city.inspect}, state: #{@state.inspect}, zip:"\
  " #{@zip.inspect}, country: #{@country.inspect}, phone: #{@phone.inspect}, locale:"\
  " #{@locale.inspect}, vat_number: #{@vat_number.inspect}, tax_exempt:"\
  " #{@tax_exempt.inspect}, surcharging: #{@surcharging.inspect}, tax_exempt_reason:"\
  " #{@tax_exempt_reason.inspect}, parent_id: #{@parent_id.inspect}, verified:"\
  " #{@verified.inspect}, salesforce_id: #{@salesforce_id.inspect}, branding_theme_id:"\
  " #{@branding_theme_id.inspect}, additional_properties: #{get_additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



270
271
272
273
274
275
276
277
278
279
280
# File 'lib/advanced_billing/models/update_customer.rb', line 270

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} 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}, surcharging: #{@surcharging},"\
  " tax_exempt_reason: #{@tax_exempt_reason}, parent_id: #{@parent_id}, verified:"\
  " #{@verified}, salesforce_id: #{@salesforce_id}, branding_theme_id: #{@branding_theme_id},"\
  " additional_properties: #{get_additional_properties}>"
end