Class: ApiReference::NewCustomer

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

Overview

NewCustomer 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(name:, email:, metadata: SKIP, timezone: SKIP, external_customer_id: 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, email_delivery: SKIP, tax_configuration: SKIP, reporting_configuration: SKIP, accounting_sync_configuration: SKIP, additional_emails: SKIP, hierarchy: SKIP, payment_configuration: SKIP) ⇒ NewCustomer

Returns a new instance of NewCustomer.



205
206
207
208
209
210
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
# File 'lib/api_reference/models/new_customer.rb', line 205

def initialize(name:, email:, metadata: SKIP, timezone: SKIP,
               external_customer_id: 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,
               email_delivery: SKIP, tax_configuration: SKIP,
               reporting_configuration: SKIP,
               accounting_sync_configuration: SKIP, additional_emails: SKIP,
               hierarchy: SKIP, payment_configuration: SKIP)
  @metadata =  unless  == SKIP
  @name = name
  @email = email
  @timezone = timezone unless timezone == SKIP
  @external_customer_id = external_customer_id unless external_customer_id == 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
  @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
  @additional_emails = additional_emails unless additional_emails == SKIP
  @hierarchy = hierarchy unless hierarchy == SKIP
  @payment_configuration = payment_configuration unless payment_configuration == SKIP
end

Instance Attribute Details

#accounting_sync_configurationNewAccountingSyncConfiguration

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.



113
114
115
# File 'lib/api_reference/models/new_customer.rb', line 113

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])


119
120
121
# File 'lib/api_reference/models/new_customer.rb', line 119

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)


78
79
80
# File 'lib/api_reference/models/new_customer.rb', line 78

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)


85
86
87
# File 'lib/api_reference/models/new_customer.rb', line 85

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.

Returns:



62
63
64
# File 'lib/api_reference/models/new_customer.rb', line 62

def billing_address
  @billing_address
end

#currencyString

An ISO 4217 currency string used for the customer's invoices and balance. If not set at creation time, will be set at subscription creation time.

Returns:

  • (String)


67
68
69
# File 'lib/api_reference/models/new_customer.rb', line 67

def currency
  @currency
end

#emailString

A valid customer email, to be used for notifications. When Orb triggers payment through a payment gateway, this email will be used for any automatically issued receipts.

Returns:

  • (String)


26
27
28
# File 'lib/api_reference/models/new_customer.rb', line 26

def email
  @email
end

#email_deliveryTrueClass | 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)


92
93
94
# File 'lib/api_reference/models/new_customer.rb', line 92

def email_delivery
  @email_delivery
end

#external_customer_idString

An optional user-defined ID for this customer resource, used throughout the system as an alias for this Customer. Use this field to identify a customer by an existing identifier in your system.

Returns:

  • (String)


38
39
40
# File 'lib/api_reference/models/new_customer.rb', line 38

def external_customer_id
  @external_customer_id
end

#hierarchyCustomerHierarchyConfig

The hierarchical relationships for this customer.



123
124
125
# File 'lib/api_reference/models/new_customer.rb', line 123

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/new_customer.rb', line 16

def 
  @metadata
end

#nameString

The full name of the customer

Returns:

  • (String)


20
21
22
# File 'lib/api_reference/models/new_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.



128
129
130
# File 'lib/api_reference/models/new_customer.rb', line 128

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.

Returns:



50
51
52
# File 'lib/api_reference/models/new_customer.rb', line 50

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)


44
45
46
# File 'lib/api_reference/models/new_customer.rb', line 44

def payment_provider_id
  @payment_provider_id
end

#reporting_configurationNewReportingConfiguration

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.



106
107
108
# File 'lib/api_reference/models/new_customer.rb', line 106

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.

Returns:



56
57
58
# File 'lib/api_reference/models/new_customer.rb', line 56

def shipping_address
  @shipping_address
end

#tax_configurationObject

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:

  • (Object)


99
100
101
# File 'lib/api_reference/models/new_customer.rb', line 99

def tax_configuration
  @tax_configuration
end

#tax_idCustomerTaxId

An ISO 4217 currency string used for the customer's invoices and balance. If not set at creation time, will be set at subscription creation time.

Returns:



72
73
74
# File 'lib/api_reference/models/new_customer.rb', line 72

def tax_id
  @tax_id
end

#timezoneString

A timezone identifier from the IANA timezone database, such as "America/Los_Angeles". This defaults to your account's timezone if not set. This cannot be changed after customer creation.

Returns:

  • (String)


32
33
34
# File 'lib/api_reference/models/new_customer.rb', line 32

def timezone
  @timezone
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  email = hash.key?('email') ? hash['email'] : nil
   = hash.key?('metadata') ? hash['metadata'] : SKIP
  timezone = hash.key?('timezone') ? hash['timezone'] : SKIP
  external_customer_id =
    hash.key?('external_customer_id') ? hash['external_customer_id'] : 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
  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
  additional_emails =
    hash.key?('additional_emails') ? hash['additional_emails'] : SKIP
  hierarchy = CustomerHierarchyConfig.from_hash(hash['hierarchy']) if hash['hierarchy']
  payment_configuration = PaymentConfiguration.from_hash(hash['payment_configuration']) if
    hash['payment_configuration']

  # Create object from extracted values.
  NewCustomer.new(name: name,
                  email: email,
                  metadata: ,
                  timezone: timezone,
                  external_customer_id: external_customer_id,
                  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,
                  email_delivery: email_delivery,
                  tax_configuration: tax_configuration,
                  reporting_configuration: reporting_configuration,
                  accounting_sync_configuration: accounting_sync_configuration,
                  additional_emails: additional_emails,
                  hierarchy: hierarchy,
                  payment_configuration: payment_configuration)
end

.namesObject

A mapping from model property names to API property names.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/api_reference/models/new_customer.rb', line 131

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['metadata'] = 'metadata'
  @_hash['name'] = 'name'
  @_hash['email'] = 'email'
  @_hash['timezone'] = 'timezone'
  @_hash['external_customer_id'] = 'external_customer_id'
  @_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['email_delivery'] = 'email_delivery'
  @_hash['tax_configuration'] = 'tax_configuration'
  @_hash['reporting_configuration'] = 'reporting_configuration'
  @_hash['accounting_sync_configuration'] =
    'accounting_sync_configuration'
  @_hash['additional_emails'] = 'additional_emails'
  @_hash['hierarchy'] = 'hierarchy'
  @_hash['payment_configuration'] = 'payment_configuration'
  @_hash
end

.nullablesObject

An array for nullable fields



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/api_reference/models/new_customer.rb', line 182

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

.optionalsObject

An array for optional fields



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/api_reference/models/new_customer.rb', line 158

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} metadata: #{@metadata.inspect}, name: #{@name.inspect}, email:"\
  " #{@email.inspect}, timezone: #{@timezone.inspect}, external_customer_id:"\
  " #{@external_customer_id.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}, email_delivery:"\
  " #{@email_delivery.inspect}, tax_configuration: #{@tax_configuration.inspect},"\
  " reporting_configuration: #{@reporting_configuration.inspect},"\
  " accounting_sync_configuration: #{@accounting_sync_configuration.inspect},"\
  " additional_emails: #{@additional_emails.inspect}, hierarchy: #{@hierarchy.inspect},"\
  " payment_configuration: #{@payment_configuration.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/api_reference/models/new_customer.rb', line 302

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} metadata: #{@metadata}, name: #{@name}, email: #{@email}, timezone:"\
  " #{@timezone}, external_customer_id: #{@external_customer_id}, 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}, email_delivery: #{@email_delivery}, tax_configuration:"\
  " #{@tax_configuration}, reporting_configuration: #{@reporting_configuration},"\
  " accounting_sync_configuration: #{@accounting_sync_configuration}, additional_emails:"\
  " #{@additional_emails}, hierarchy: #{@hierarchy}, payment_configuration:"\
  " #{@payment_configuration}>"
end