Class: SubskribeSandboxClient::ChargeJson

Inherits:
Object
  • Object
show all
Defined in:
lib/subskribe_sandbox/models/charge_json.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ChargeJson

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 213

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'displayName')
    self.display_name = attributes[:'displayName']
  end

  if attributes.has_key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.has_key?(:'taxRateId')
    self.tax_rate_id = attributes[:'taxRateId']
  end

  if attributes.has_key?(:'unitOfMeasureId')
    self.unit_of_measure_id = attributes[:'unitOfMeasureId']
  end

  if attributes.has_key?(:'isRenewable')
    self.is_renewable = attributes[:'isRenewable']
  end

  if attributes.has_key?(:'minQuantity')
    self.min_quantity = attributes[:'minQuantity']
  end

  if attributes.has_key?(:'defaultQuantity')
    self.default_quantity = attributes[:'defaultQuantity']
  end

  if attributes.has_key?(:'maxQuantity')
    self.max_quantity = attributes[:'maxQuantity']
  end

  if attributes.has_key?(:'externalId')
    self.external_id = attributes[:'externalId']
  end

  if attributes.has_key?(:'minAmount')
    self.min_amount = attributes[:'minAmount']
  end

  if attributes.has_key?(:'maxAmount')
    self.max_amount = attributes[:'maxAmount']
  end

  if attributes.has_key?(:'recognitionRuleId')
    self.recognition_rule_id = attributes[:'recognitionRuleId']
  end

  if attributes.has_key?(:'erpId')
    self.erp_id = attributes[:'erpId']
  end

  if attributes.has_key?(:'planId')
    self.plan_id = attributes[:'planId']
  end

  if attributes.has_key?(:'amount')
    self.amount = attributes[:'amount']
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.has_key?(:'chargeModel')
    self.charge_model = attributes[:'chargeModel']
  end

  if attributes.has_key?(:'recurrence')
    self.recurrence = attributes[:'recurrence']
  end

  if attributes.has_key?(:'priceTiers')
    if (value = attributes[:'priceTiers']).is_a?(Array)
      self.price_tiers = value
    end
  end

  if attributes.has_key?(:'isDrawdown')
    self.is_drawdown = attributes[:'isDrawdown']
  end

  if attributes.has_key?(:'minimumCommitBaseChargeId')
    self.minimum_commit_base_charge_id = attributes[:'minimumCommitBaseChargeId']
  end

  if attributes.has_key?(:'overageBaseChargeId')
    self.overage_base_charge_id = attributes[:'overageBaseChargeId']
  end

  if attributes.has_key?(:'isCustom')
    self.is_custom = attributes[:'isCustom']
  end

  if attributes.has_key?(:'isListPriceEditable')
    self.is_list_price_editable = attributes[:'isListPriceEditable']
  end

  if attributes.has_key?(:'percent')
    self.percent = attributes[:'percent']
  end

  if attributes.has_key?(:'percentDerivedFrom')
    self.percent_derived_from = attributes[:'percentDerivedFrom']
  end

  if attributes.has_key?(:'targetPlanIds')
    if (value = attributes[:'targetPlanIds']).is_a?(Array)
      self.target_plan_ids = value
    end
  end

  if attributes.has_key?(:'ledgerAccountMapping')
    self. = attributes[:'ledgerAccountMapping']
  end

  if attributes.has_key?(:'durationInMonths')
    self.duration_in_months = attributes[:'durationInMonths']
  end

  if attributes.has_key?(:'isEventBased')
    self.is_event_based = attributes[:'isEventBased']
  end

  if attributes.has_key?(:'rateCardId')
    self.rate_card_id = attributes[:'rateCardId']
  end

  if attributes.has_key?(:'billingTerm')
    self.billing_term = attributes[:'billingTerm']
  end

  if attributes.has_key?(:'billingCycle')
    self.billing_cycle = attributes[:'billingCycle']
  end

  if attributes.has_key?(:'shouldTrackArr')
    self.should_track_arr = attributes[:'shouldTrackArr']
  end

  if attributes.has_key?(:'drawdown')
    self.drawdown = attributes[:'drawdown']
  end

  if attributes.has_key?(:'listPriceEditable')
    self.list_price_editable = attributes[:'listPriceEditable']
  end

  if attributes.has_key?(:'eventBased')
    self.event_based = attributes[:'eventBased']
  end

  if attributes.has_key?(:'custom')
    self.custom = attributes[:'custom']
  end
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



49
50
51
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 49

def amount
  @amount
end

#billing_cycleObject

Returns the value of attribute billing_cycle.



85
86
87
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 85

def billing_cycle
  @billing_cycle
end

#billing_termObject

Returns the value of attribute billing_term.



83
84
85
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 83

def billing_term
  @billing_term
end

#charge_modelObject

Returns the value of attribute charge_model.



53
54
55
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 53

def charge_model
  @charge_model
end

#customObject

Returns the value of attribute custom.



95
96
97
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 95

def custom
  @custom
end

#default_quantityObject

Returns the value of attribute default_quantity.



33
34
35
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 33

def default_quantity
  @default_quantity
end

#descriptionObject

Returns the value of attribute description.



23
24
25
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 23

def description
  @description
end

#display_nameObject

Returns the value of attribute display_name.



21
22
23
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 21

def display_name
  @display_name
end

#drawdownObject

Returns the value of attribute drawdown.



89
90
91
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 89

def drawdown
  @drawdown
end

#duration_in_monthsObject

Returns the value of attribute duration_in_months.



77
78
79
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 77

def duration_in_months
  @duration_in_months
end

#erp_idObject

Returns the value of attribute erp_id.



45
46
47
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 45

def erp_id
  @erp_id
end

#event_basedObject

Returns the value of attribute event_based.



93
94
95
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 93

def event_based
  @event_based
end

#external_idObject

Returns the value of attribute external_id.



37
38
39
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 37

def external_id
  @external_id
end

#idObject

Returns the value of attribute id.



17
18
19
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 17

def id
  @id
end

#is_customObject

Returns the value of attribute is_custom.



65
66
67
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 65

def is_custom
  @is_custom
end

#is_drawdownObject

Returns the value of attribute is_drawdown.



59
60
61
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 59

def is_drawdown
  @is_drawdown
end

#is_event_basedObject

Returns the value of attribute is_event_based.



79
80
81
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 79

def is_event_based
  @is_event_based
end

#is_list_price_editableObject

Returns the value of attribute is_list_price_editable.



67
68
69
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 67

def is_list_price_editable
  @is_list_price_editable
end

#is_renewableObject

Returns the value of attribute is_renewable.



29
30
31
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 29

def is_renewable
  @is_renewable
end

#ledger_account_mappingObject

Returns the value of attribute ledger_account_mapping.



75
76
77
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 75

def 
  @ledger_account_mapping
end

#list_price_editableObject

Returns the value of attribute list_price_editable.



91
92
93
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 91

def list_price_editable
  @list_price_editable
end

#max_amountObject

Returns the value of attribute max_amount.



41
42
43
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 41

def max_amount
  @max_amount
end

#max_quantityObject

Returns the value of attribute max_quantity.



35
36
37
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 35

def max_quantity
  @max_quantity
end

#min_amountObject

Returns the value of attribute min_amount.



39
40
41
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 39

def min_amount
  @min_amount
end

#min_quantityObject

Returns the value of attribute min_quantity.



31
32
33
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 31

def min_quantity
  @min_quantity
end

#minimum_commit_base_charge_idObject

Returns the value of attribute minimum_commit_base_charge_id.



61
62
63
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 61

def minimum_commit_base_charge_id
  @minimum_commit_base_charge_id
end

#nameObject

Returns the value of attribute name.



19
20
21
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 19

def name
  @name
end

#overage_base_charge_idObject

Returns the value of attribute overage_base_charge_id.



63
64
65
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 63

def overage_base_charge_id
  @overage_base_charge_id
end

#percentObject

Returns the value of attribute percent.



69
70
71
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 69

def percent
  @percent
end

#percent_derived_fromObject

Returns the value of attribute percent_derived_from.



71
72
73
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 71

def percent_derived_from
  @percent_derived_from
end

#plan_idObject

Returns the value of attribute plan_id.



47
48
49
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 47

def plan_id
  @plan_id
end

#price_tiersObject

Returns the value of attribute price_tiers.



57
58
59
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 57

def price_tiers
  @price_tiers
end

#rate_card_idObject

Returns the value of attribute rate_card_id.



81
82
83
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 81

def rate_card_id
  @rate_card_id
end

#recognition_rule_idObject

Returns the value of attribute recognition_rule_id.



43
44
45
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 43

def recognition_rule_id
  @recognition_rule_id
end

#recurrenceObject

Returns the value of attribute recurrence.



55
56
57
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 55

def recurrence
  @recurrence
end

#should_track_arrObject

Returns the value of attribute should_track_arr.



87
88
89
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 87

def should_track_arr
  @should_track_arr
end

#target_plan_idsObject

Returns the value of attribute target_plan_ids.



73
74
75
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 73

def target_plan_ids
  @target_plan_ids
end

#tax_rate_idObject

Returns the value of attribute tax_rate_id.



25
26
27
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 25

def tax_rate_id
  @tax_rate_id
end

#typeObject

Returns the value of attribute type.



51
52
53
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 51

def type
  @type
end

#unit_of_measure_idObject

Returns the value of attribute unit_of_measure_id.



27
28
29
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 27

def unit_of_measure_id
  @unit_of_measure_id
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



120
121
122
123
124
125
126
127
128
129
130
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
156
157
158
159
160
161
162
163
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 120

def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'display_name' => :'displayName',
    :'description' => :'description',
    :'tax_rate_id' => :'taxRateId',
    :'unit_of_measure_id' => :'unitOfMeasureId',
    :'is_renewable' => :'isRenewable',
    :'min_quantity' => :'minQuantity',
    :'default_quantity' => :'defaultQuantity',
    :'max_quantity' => :'maxQuantity',
    :'external_id' => :'externalId',
    :'min_amount' => :'minAmount',
    :'max_amount' => :'maxAmount',
    :'recognition_rule_id' => :'recognitionRuleId',
    :'erp_id' => :'erpId',
    :'plan_id' => :'planId',
    :'amount' => :'amount',
    :'type' => :'type',
    :'charge_model' => :'chargeModel',
    :'recurrence' => :'recurrence',
    :'price_tiers' => :'priceTiers',
    :'is_drawdown' => :'isDrawdown',
    :'minimum_commit_base_charge_id' => :'minimumCommitBaseChargeId',
    :'overage_base_charge_id' => :'overageBaseChargeId',
    :'is_custom' => :'isCustom',
    :'is_list_price_editable' => :'isListPriceEditable',
    :'percent' => :'percent',
    :'percent_derived_from' => :'percentDerivedFrom',
    :'target_plan_ids' => :'targetPlanIds',
    :'ledger_account_mapping' => :'ledgerAccountMapping',
    :'duration_in_months' => :'durationInMonths',
    :'is_event_based' => :'isEventBased',
    :'rate_card_id' => :'rateCardId',
    :'billing_term' => :'billingTerm',
    :'billing_cycle' => :'billingCycle',
    :'should_track_arr' => :'shouldTrackArr',
    :'drawdown' => :'drawdown',
    :'list_price_editable' => :'listPriceEditable',
    :'event_based' => :'eventBased',
    :'custom' => :'custom'
  }
end

.swagger_typesObject

Attribute type mapping.



166
167
168
169
170
171
172
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
209
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 166

def self.swagger_types
  {
    :'id' => :'String',
    :'name' => :'String',
    :'display_name' => :'String',
    :'description' => :'String',
    :'tax_rate_id' => :'String',
    :'unit_of_measure_id' => :'String',
    :'is_renewable' => :'BOOLEAN',
    :'min_quantity' => :'Integer',
    :'default_quantity' => :'Integer',
    :'max_quantity' => :'Integer',
    :'external_id' => :'String',
    :'min_amount' => :'Float',
    :'max_amount' => :'Float',
    :'recognition_rule_id' => :'String',
    :'erp_id' => :'String',
    :'plan_id' => :'String',
    :'amount' => :'Float',
    :'type' => :'String',
    :'charge_model' => :'String',
    :'recurrence' => :'RecurrenceJson',
    :'price_tiers' => :'Array<PriceTierJson>',
    :'is_drawdown' => :'BOOLEAN',
    :'minimum_commit_base_charge_id' => :'String',
    :'overage_base_charge_id' => :'String',
    :'is_custom' => :'BOOLEAN',
    :'is_list_price_editable' => :'BOOLEAN',
    :'percent' => :'Float',
    :'percent_derived_from' => :'String',
    :'target_plan_ids' => :'Array<String>',
    :'ledger_account_mapping' => :'LedgerAccountMapping',
    :'duration_in_months' => :'Integer',
    :'is_event_based' => :'BOOLEAN',
    :'rate_card_id' => :'String',
    :'billing_term' => :'String',
    :'billing_cycle' => :'String',
    :'should_track_arr' => :'BOOLEAN',
    :'drawdown' => :'BOOLEAN',
    :'list_price_editable' => :'BOOLEAN',
    :'event_based' => :'BOOLEAN',
    :'custom' => :'BOOLEAN'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 469

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      display_name == o.display_name &&
      description == o.description &&
      tax_rate_id == o.tax_rate_id &&
      unit_of_measure_id == o.unit_of_measure_id &&
      is_renewable == o.is_renewable &&
      min_quantity == o.min_quantity &&
      default_quantity == o.default_quantity &&
      max_quantity == o.max_quantity &&
      external_id == o.external_id &&
      min_amount == o.min_amount &&
      max_amount == o.max_amount &&
      recognition_rule_id == o.recognition_rule_id &&
      erp_id == o.erp_id &&
      plan_id == o.plan_id &&
      amount == o.amount &&
      type == o.type &&
      charge_model == o.charge_model &&
      recurrence == o.recurrence &&
      price_tiers == o.price_tiers &&
      is_drawdown == o.is_drawdown &&
      minimum_commit_base_charge_id == o.minimum_commit_base_charge_id &&
      overage_base_charge_id == o.overage_base_charge_id &&
      is_custom == o.is_custom &&
      is_list_price_editable == o.is_list_price_editable &&
      percent == o.percent &&
      percent_derived_from == o.percent_derived_from &&
      target_plan_ids == o.target_plan_ids &&
       == o. &&
      duration_in_months == o.duration_in_months &&
      is_event_based == o.is_event_based &&
      rate_card_id == o.rate_card_id &&
      billing_term == o.billing_term &&
      billing_cycle == o.billing_cycle &&
      should_track_arr == o.should_track_arr &&
      drawdown == o.drawdown &&
      list_price_editable == o.list_price_editable &&
      event_based == o.event_based &&
      custom == o.custom
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 550

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = SubskribeSandboxClient.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



616
617
618
619
620
621
622
623
624
625
626
627
628
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 616

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 529

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


516
517
518
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 516

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



522
523
524
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 522

def hash
  [id, name, display_name, description, tax_rate_id, unit_of_measure_id, is_renewable, min_quantity, default_quantity, max_quantity, external_id, min_amount, max_amount, recognition_rule_id, erp_id, plan_id, amount, type, charge_model, recurrence, price_tiers, is_drawdown, minimum_commit_base_charge_id, overage_base_charge_id, is_custom, is_list_price_editable, percent, percent_derived_from, target_plan_ids, , duration_in_months, is_event_based, rate_card_id, billing_term, billing_cycle, should_track_arr, drawdown, list_price_editable, event_based, custom].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 386

def list_invalid_properties
  invalid_properties = Array.new
  if @type.nil?
    invalid_properties.push('invalid value for "type", type cannot be nil.')
  end

  if @charge_model.nil?
    invalid_properties.push('invalid value for "charge_model", charge_model cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



596
597
598
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 596

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



602
603
604
605
606
607
608
609
610
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 602

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



590
591
592
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 590

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/subskribe_sandbox/models/charge_json.rb', line 401

def valid?
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ['ONE_TIME', 'RECURRING', 'USAGE', 'PREPAID', 'PERCENTAGE_OF'])
  return false unless type_validator.valid?(@type)
  return false if @charge_model.nil?
  charge_model_validator = EnumAttributeValidator.new('String', ['PER_UNIT', 'VOLUME', 'TIERED', 'FLAT_FEE', 'BLOCK', 'RATE_CARD_LOOKUP'])
  return false unless charge_model_validator.valid?(@charge_model)
  percent_derived_from_validator = EnumAttributeValidator.new('String', ['LIST_AMOUNT', 'SELL_AMOUNT'])
  return false unless percent_derived_from_validator.valid?(@percent_derived_from)
  billing_term_validator = EnumAttributeValidator.new('String', ['UP_FRONT', 'IN_ARREARS'])
  return false unless billing_term_validator.valid?(@billing_term)
  billing_cycle_validator = EnumAttributeValidator.new('String', ['DEFAULT', 'PAID_IN_FULL', 'MONTH', 'QUARTER', 'SEMI_ANNUAL', 'YEAR'])
  return false unless billing_cycle_validator.valid?(@billing_cycle)
  true
end