Class: ApiReference::EditCustomer

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/edit_customer.rb

Overview

EditCustomer Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

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

Constructor Details

#initialize(metadata: SKIP, name: SKIP, email: SKIP, payment_provider_id: SKIP, payment_provider: SKIP, shipping_address: SKIP, billing_address: SKIP, currency: SKIP, tax_id: SKIP, auto_collection: SKIP, auto_issuance: SKIP, additional_emails: SKIP, email_delivery: SKIP, tax_configuration: SKIP, reporting_configuration: SKIP, accounting_sync_configuration: SKIP, external_customer_id: SKIP, hierarchy: SKIP, payment_configuration: SKIP, default_payment_method_id: SKIP) ⇒ EditCustomer

Returns a new instance of EditCustomer.



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
# File 'lib/api_reference/models/edit_customer.rb', line 217

def initialize(metadata: SKIP, name: SKIP, email: SKIP,
               payment_provider_id: SKIP, payment_provider: SKIP,
               shipping_address: SKIP, billing_address: SKIP,
               currency: SKIP, tax_id: SKIP, auto_collection: SKIP,
               auto_issuance: SKIP, additional_emails: SKIP,
               email_delivery: SKIP, tax_configuration: SKIP,
               reporting_configuration: SKIP,
               accounting_sync_configuration: SKIP,
               external_customer_id: SKIP, hierarchy: SKIP,
               payment_configuration: SKIP, default_payment_method_id: SKIP)
  @metadata =  unless  == SKIP
  @name = name unless name == SKIP
  @email = email unless email == SKIP
  @payment_provider_id = payment_provider_id unless payment_provider_id == SKIP
  @payment_provider = payment_provider unless payment_provider == SKIP
  @shipping_address = shipping_address unless shipping_address == SKIP
  @billing_address = billing_address unless billing_address == SKIP
  @currency = currency unless currency == SKIP
  @tax_id = tax_id unless tax_id == SKIP
  @auto_collection = auto_collection unless auto_collection == SKIP
  @auto_issuance = auto_issuance unless auto_issuance == SKIP
  @additional_emails = additional_emails unless additional_emails == SKIP
  @email_delivery = email_delivery unless email_delivery == SKIP
  @tax_configuration = tax_configuration unless tax_configuration == SKIP
  @reporting_configuration = reporting_configuration unless reporting_configuration == SKIP
  unless accounting_sync_configuration == SKIP
    @accounting_sync_configuration =
      accounting_sync_configuration
  end
  @external_customer_id = external_customer_id unless external_customer_id == SKIP
  @hierarchy = hierarchy unless hierarchy == SKIP
  @payment_configuration = payment_configuration unless payment_configuration == SKIP
  unless default_payment_method_id == SKIP
    @default_payment_method_id =
      default_payment_method_id
  end
end

Instance Attribute Details

#accounting_sync_configurationNewAccountingSyncConfiguration

Additional email addresses for this customer. If populated, these email addresses will be CC'd for customer communications. The total number of email addresses (including the primary email) cannot exceed 50.



114
115
116
# File 'lib/api_reference/models/edit_customer.rb', line 114

def accounting_sync_configuration
  @accounting_sync_configuration
end

#additional_emailsArray[String]

Additional email addresses for this customer. If populated, these email addresses will be CC'd for customer communications. The total number of email addresses (including the primary email) cannot exceed 50.

Returns:

  • (Array[String])


90
91
92
# File 'lib/api_reference/models/edit_customer.rb', line 90

def additional_emails
  @additional_emails
end

#auto_collectionTrueClass | FalseClass

Used to determine if invoices for this customer will automatically attempt to charge a saved payment method, if available. This parameter defaults to True when a payment provider is provided on customer creation.

Returns:

  • (TrueClass | FalseClass)


77
78
79
# File 'lib/api_reference/models/edit_customer.rb', line 77

def auto_collection
  @auto_collection
end

#auto_issuanceTrueClass | FalseClass

Used to determine if invoices for this customer will be automatically issued. If true, invoices will be automatically issued. If false, invoices will require manual approval.If null is specified, the customer's auto issuance setting will be inherited from the account-level setting.

Returns:

  • (TrueClass | FalseClass)


84
85
86
# File 'lib/api_reference/models/edit_customer.rb', line 84

def auto_issuance
  @auto_issuance
end

#billing_addressAddressInput

This is used for creating charges or invoices in an external system via Orb. When not in test mode:

  • the connection must first be configured in the Orb webapp.
  • if the provider is an invoicing provider (stripe_invoice, quickbooks, bill.com, netsuite), any product mappings must first be configured with the Orb team.

Returns:



57
58
59
# File 'lib/api_reference/models/edit_customer.rb', line 57

def billing_address
  @billing_address
end

#currencyString

An ISO 4217 currency string used for the customer's invoices and balance. This can only be set if the customer does not already have a currency configured. If not set at creation or update time, it will be set at subscription creation time.

Returns:

  • (String)


64
65
66
# File 'lib/api_reference/models/edit_customer.rb', line 64

def currency
  @currency
end

#default_payment_method_idString

The Orb ID of the payment method to set as this customer's default. Pass null to clear the customer's default payment method.

Returns:

  • (String)


136
137
138
# File 'lib/api_reference/models/edit_customer.rb', line 136

def default_payment_method_id
  @default_payment_method_id
end

#emailString

A valid customer email, to be used for invoicing and notifications.

Returns:

  • (String)


24
25
26
# File 'lib/api_reference/models/edit_customer.rb', line 24

def email
  @email
end

#email_deliveryTrueClass | FalseClass

Additional email addresses for this customer. If populated, these email addresses will be CC'd for customer communications. The total number of email addresses (including the primary email) cannot exceed 50.

Returns:

  • (TrueClass | FalseClass)


96
97
98
# File 'lib/api_reference/models/edit_customer.rb', line 96

def email_delivery
  @email_delivery
end

#external_customer_idString

The external customer ID. This can only be set if the customer has no existing external customer ID. Since this action may change usage quantities for all existing subscriptions, it is disallowed if the customer has issued invoices with usage line items and subject to the same restrictions as backdated subscription creation.

Returns:

  • (String)


122
123
124
# File 'lib/api_reference/models/edit_customer.rb', line 122

def external_customer_id
  @external_customer_id
end

#hierarchyCustomerHierarchyConfig

The hierarchical relationships for this customer.



126
127
128
# File 'lib/api_reference/models/edit_customer.rb', line 126

def hierarchy
  @hierarchy
end

#metadataHash[String, String]

User-specified key/value pairs for the resource. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (Hash[String, String])


16
17
18
# File 'lib/api_reference/models/edit_customer.rb', line 16

def 
  @metadata
end

#nameString

The full name of the customer

Returns:

  • (String)


20
21
22
# File 'lib/api_reference/models/edit_customer.rb', line 20

def name
  @name
end

#payment_configurationPaymentConfiguration

Payment configuration for the customer, applicable when using Orb Invoicing with a supported payment provider such as Stripe.



131
132
133
# File 'lib/api_reference/models/edit_customer.rb', line 131

def payment_configuration
  @payment_configuration
end

#payment_providerPaymentProvider1

This is used for creating charges or invoices in an external system via Orb. When not in test mode:

  • the connection must first be configured in the Orb webapp.
  • if the provider is an invoicing provider (stripe_invoice, quickbooks, bill.com, netsuite), any product mappings must first be configured with the Orb team.

Returns:



39
40
41
# File 'lib/api_reference/models/edit_customer.rb', line 39

def payment_provider
  @payment_provider
end

#payment_provider_idString

The ID of this customer in an external payments solution, such as Stripe. This is used for creating charges or invoices in the external system via Orb.

Returns:

  • (String)


30
31
32
# File 'lib/api_reference/models/edit_customer.rb', line 30

def payment_provider_id
  @payment_provider_id
end

#reporting_configurationNewReportingConfiguration

Additional email addresses for this customer. If populated, these email addresses will be CC'd for customer communications. The total number of email addresses (including the primary email) cannot exceed 50.



108
109
110
# File 'lib/api_reference/models/edit_customer.rb', line 108

def reporting_configuration
  @reporting_configuration
end

#shipping_addressAddressInput

This is used for creating charges or invoices in an external system via Orb. When not in test mode:

  • the connection must first be configured in the Orb webapp.
  • if the provider is an invoicing provider (stripe_invoice, quickbooks, bill.com, netsuite), any product mappings must first be configured with the Orb team.

Returns:



48
49
50
# File 'lib/api_reference/models/edit_customer.rb', line 48

def shipping_address
  @shipping_address
end

#tax_configurationObject

Additional email addresses for this customer. If populated, these email addresses will be CC'd for customer communications. The total number of email addresses (including the primary email) cannot exceed 50.

Returns:

  • (Object)


102
103
104
# File 'lib/api_reference/models/edit_customer.rb', line 102

def tax_configuration
  @tax_configuration
end

#tax_idCustomerTaxId

An ISO 4217 currency string used for the customer's invoices and balance. This can only be set if the customer does not already have a currency configured. If not set at creation or update time, it will be set at subscription creation time.

Returns:



71
72
73
# File 'lib/api_reference/models/edit_customer.rb', line 71

def tax_id
  @tax_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/api_reference/models/edit_customer.rb', line 256

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('metadata') ? hash['metadata'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
  payment_provider_id =
    hash.key?('payment_provider_id') ? hash['payment_provider_id'] : SKIP
  payment_provider =
    hash.key?('payment_provider') ? hash['payment_provider'] : SKIP
  shipping_address = AddressInput.from_hash(hash['shipping_address']) if
    hash['shipping_address']
  billing_address = AddressInput.from_hash(hash['billing_address']) if hash['billing_address']
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  tax_id = CustomerTaxId.from_hash(hash['tax_id']) if hash['tax_id']
  auto_collection =
    hash.key?('auto_collection') ? hash['auto_collection'] : SKIP
  auto_issuance = hash.key?('auto_issuance') ? hash['auto_issuance'] : SKIP
  additional_emails =
    hash.key?('additional_emails') ? hash['additional_emails'] : SKIP
  email_delivery =
    hash.key?('email_delivery') ? hash['email_delivery'] : SKIP
  tax_configuration =
    hash.key?('tax_configuration') ? hash['tax_configuration'] : SKIP
  if hash['reporting_configuration']
    reporting_configuration = NewReportingConfiguration.from_hash(hash['reporting_configuration'])
  end
  if hash['accounting_sync_configuration']
    accounting_sync_configuration = NewAccountingSyncConfiguration.from_hash(hash['accounting_sync_configuration'])
  end
  external_customer_id =
    hash.key?('external_customer_id') ? hash['external_customer_id'] : SKIP
  hierarchy = CustomerHierarchyConfig.from_hash(hash['hierarchy']) if hash['hierarchy']
  payment_configuration = PaymentConfiguration.from_hash(hash['payment_configuration']) if
    hash['payment_configuration']
  default_payment_method_id =
    hash.key?('default_payment_method_id') ? hash['default_payment_method_id'] : SKIP

  # Create object from extracted values.
  EditCustomer.new(metadata: ,
                   name: name,
                   email: email,
                   payment_provider_id: payment_provider_id,
                   payment_provider: payment_provider,
                   shipping_address: shipping_address,
                   billing_address: billing_address,
                   currency: currency,
                   tax_id: tax_id,
                   auto_collection: auto_collection,
                   auto_issuance: auto_issuance,
                   additional_emails: additional_emails,
                   email_delivery: email_delivery,
                   tax_configuration: tax_configuration,
                   reporting_configuration: reporting_configuration,
                   accounting_sync_configuration: accounting_sync_configuration,
                   external_customer_id: external_customer_id,
                   hierarchy: hierarchy,
                   payment_configuration: payment_configuration,
                   default_payment_method_id: default_payment_method_id)
end

.namesObject

A mapping from model property names to API property names.



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/api_reference/models/edit_customer.rb', line 139

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['metadata'] = 'metadata'
  @_hash['name'] = 'name'
  @_hash['email'] = 'email'
  @_hash['payment_provider_id'] = 'payment_provider_id'
  @_hash['payment_provider'] = 'payment_provider'
  @_hash['shipping_address'] = 'shipping_address'
  @_hash['billing_address'] = 'billing_address'
  @_hash['currency'] = 'currency'
  @_hash['tax_id'] = 'tax_id'
  @_hash['auto_collection'] = 'auto_collection'
  @_hash['auto_issuance'] = 'auto_issuance'
  @_hash['additional_emails'] = 'additional_emails'
  @_hash['email_delivery'] = 'email_delivery'
  @_hash['tax_configuration'] = 'tax_configuration'
  @_hash['reporting_configuration'] = 'reporting_configuration'
  @_hash['accounting_sync_configuration'] =
    'accounting_sync_configuration'
  @_hash['external_customer_id'] = 'external_customer_id'
  @_hash['hierarchy'] = 'hierarchy'
  @_hash['payment_configuration'] = 'payment_configuration'
  @_hash['default_payment_method_id'] = 'default_payment_method_id'
  @_hash
end

.nullablesObject

An array for nullable fields



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/api_reference/models/edit_customer.rb', line 192

def self.nullables
  %w[
    metadata
    name
    email
    payment_provider_id
    payment_provider
    shipping_address
    billing_address
    currency
    tax_id
    auto_collection
    auto_issuance
    additional_emails
    email_delivery
    tax_configuration
    reporting_configuration
    accounting_sync_configuration
    external_customer_id
    hierarchy
    payment_configuration
    default_payment_method_id
  ]
end

.optionalsObject

An array for optional fields



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/api_reference/models/edit_customer.rb', line 166

def self.optionals
  %w[
    metadata
    name
    email
    payment_provider_id
    payment_provider
    shipping_address
    billing_address
    currency
    tax_id
    auto_collection
    auto_issuance
    additional_emails
    email_delivery
    tax_configuration
    reporting_configuration
    accounting_sync_configuration
    external_customer_id
    hierarchy
    payment_configuration
    default_payment_method_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/api_reference/models/edit_customer.rb', line 334

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} metadata: #{@metadata.inspect}, name: #{@name.inspect}, email:"\
  " #{@email.inspect}, payment_provider_id: #{@payment_provider_id.inspect}, payment_provider:"\
  " #{@payment_provider.inspect}, shipping_address: #{@shipping_address.inspect},"\
  " billing_address: #{@billing_address.inspect}, currency: #{@currency.inspect}, tax_id:"\
  " #{@tax_id.inspect}, auto_collection: #{@auto_collection.inspect}, auto_issuance:"\
  " #{@auto_issuance.inspect}, additional_emails: #{@additional_emails.inspect},"\
  " email_delivery: #{@email_delivery.inspect}, tax_configuration:"\
  " #{@tax_configuration.inspect}, reporting_configuration:"\
  " #{@reporting_configuration.inspect}, accounting_sync_configuration:"\
  " #{@accounting_sync_configuration.inspect}, external_customer_id:"\
  " #{@external_customer_id.inspect}, hierarchy: #{@hierarchy.inspect}, payment_configuration:"\
  " #{@payment_configuration.inspect}, default_payment_method_id:"\
  " #{@default_payment_method_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/api_reference/models/edit_customer.rb', line 319

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} metadata: #{@metadata}, name: #{@name}, email: #{@email},"\
  " payment_provider_id: #{@payment_provider_id}, payment_provider: #{@payment_provider},"\
  " shipping_address: #{@shipping_address}, billing_address: #{@billing_address}, currency:"\
  " #{@currency}, tax_id: #{@tax_id}, auto_collection: #{@auto_collection}, auto_issuance:"\
  " #{@auto_issuance}, additional_emails: #{@additional_emails}, email_delivery:"\
  " #{@email_delivery}, tax_configuration: #{@tax_configuration}, reporting_configuration:"\
  " #{@reporting_configuration}, accounting_sync_configuration:"\
  " #{@accounting_sync_configuration}, external_customer_id: #{@external_customer_id},"\
  " hierarchy: #{@hierarchy}, payment_configuration: #{@payment_configuration},"\
  " default_payment_method_id: #{@default_payment_method_id}>"
end