Class: Bfwd::ProductRatePlan

Inherits:
Object
  • Object
show all
Defined in:
lib/bf_ruby2/models/product_rate_plan.rb

Overview

A rate plan describes a pricing system under which a subscription can be made to a product.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ProductRatePlan

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
# File 'lib/bf_ruby2/models/product_rate_plan.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?(:'created')
    self.created = attributes[:'created']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'createZeroValuedInvoices')
    self.create_zero_valued_invoices = attributes[:'createZeroValuedInvoices']
  else
    self.create_zero_valued_invoices = false
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#aggregating_componentsObject

list)","description":"List of AggregatingComponents — these describe pricing components whose prices should be recalculated upon invoice aggregation. For example: two subscriptions’ individual consumptions may be neither of them large enough to achieve bulk-buy discounts. When aggregated, though, the same two subscriptions’ consumption may add up to a quantity which does merit a bulk buy discount within your tiering system.“,”verbs“:



109
110
111
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 109

def aggregating_components
  @aggregating_components
end

#changed_byObject

{ "description" : "ID of the user who last updated the entity.", "verbs":[] }



22
23
24
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 22

def changed_by
  @changed_by
end

#create_zero_valued_invoicesObject

{"default":"true","description":"Whether invoices are created if they have a zero valued cost before any discounts are applied.“,”verbs“: }



67
68
69
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 67

def create_zero_valued_invoices
  @create_zero_valued_invoices
end

#createdObject

{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }



19
20
21
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 19

def created
  @created
end

#crm_idObject

ID of the rate plan.“,”verbs“:



34
35
36
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 34

def crm_id
  @crm_id
end

#currencyObject

currency of the product-rate-plan — as specified by a three-character ISO 4217 currency code (i.e. USD).“,”verbs“:



40
41
42
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 40

def currency
  @currency
end

#durationObject

of length-measures which constitute the rate plan’s period. If left unspecified: the rate plan will use the same ‘duration` number as the Product to which it belongs.“,”verbs“:



49
50
51
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 49

def duration
  @duration
end

#duration_periodObject

describing the magnitude of the rate plan’s period. If left unspecified: the rate plan will use the same ‘durationPeriod` magnitude as the Product to which it belongs.“,”verbs“:



52
53
54
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 52

def duration_period
  @duration_period
end

#failed_payment_behaviourObject

action that should be taken, should an invoice for some subscription to this rate plan remain unpaid despite the dunning period’s being exceeded.
<span class=\"label label-default\">CancelSubscription</span> &mdash; Demotes the subscription to the ‘Failed` state as soon as the dunning period is exceeded.
<span class=\"label label-default\">None</span> &mdash; The subscription is allowed to continue in the `AwaitingPayment` state indefinitely even if the dunning period is exceeded.For slow payment cycles &mdash; or when manual invoice remediation is common &mdash; <span class=\"label label-default\">None</span> is recommended.
In a heavily-automated SaaS environment, automatic cancellation via <span class=\"label label-default\">CancelSubscription</span> is recommended.“,”verbs“:



46
47
48
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 46

def failed_payment_behaviour
  @failed_payment_behaviour
end

#fixed_term_definitionsObject

list linking \"Fixed-Term Definitions\" to the rate plan.“,”verbs“:



100
101
102
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 100

def fixed_term_definitions
  @fixed_term_definitions
end

#idObject

uniquely identifying this rate plan.“,”verbs“:



31
32
33
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 31

def id
  @id
end

#invoice_issue_typeObject

class=\"label label-default\">Immediate</span>","description":"The strategy for how invoices for this plan will be issued.
<span class=\"label label-default\">Immediate</span> &mdash; All generated invoices move immediately to the ‘Unpaid’ state &mdash; beginning the payment pursuit process.
<span class=\"label label-default\">Delayed</span> &mdash; All generated invoices begin in the ‘Pending’ state. An ‘Issue Invoice’ amendment is scheduled (based on the rate plan’s ‘issueDuration` and `issuePeriod`) that will move the invoice to the ’Unpaid’ state (beginning the payment pursuit process) in accordance with the rate plan’s issuance schedule.
<span class=\"label label-default\">Manual</span> &mdash; All generated invoices sit in the ‘Pending’ state &mdash; they will not be issued to the customer unless explicit action is taken. This gives you an opportunity to review or recalculate the invoice.“verbs”:



88
89
90
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 88

def invoice_issue_type
  @invoice_issue_type
end

#issue_durationObject

of issue-length-measures between issuance of invoices for this rate plan.“”verbs“:



91
92
93
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 91

def issue_duration
  @issue_duration
end

#issue_periodObject

describing the magnitude of the invoice issuance period.“,”verbs“:



94
95
96
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 94

def issue_period
  @issue_period
end

#metadataObject

{ "description" : "Add metadata.", "verbs“: }



28
29
30
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 28

def 
  @metadata
end

#migration_behaviourObject

action that should be taken, should the pro-rata calculation result in a negative value.
<span class=\"label label-default\">NoCharge</span> &mdash; Don’t return to the customer any money.
<span class=\"label label-default\">CreditAccount</span> &mdash; Credit the customer’s account with the amount.“,”verbs“:



85
86
87
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 85

def migration_behaviour
  @migration_behaviour
end

#nameObject

friendly name &mdash; for your benefit &mdash; used to identify this rate plan within some product in BillForward. The name should reflect the fact that this rate plan provides to the customer a price tiering system within which a subscription to its Product can be made.
The rate plan’s name could describe the nature of its price tiering (e.g. \"Default pricing\", \"Student pricing\").
Remember also that rate plans can override the timing prescribed by their product. If your rate plan is defined by its overriding the default timing of its product, then that can be reflected in that rate plan’s name. (e.g. \"Student pricing - Annual").“,”verbs“:



70
71
72
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 70

def name
  @name
end

#payment_termsObject

Returns the value of attribute payment_terms.



111
112
113
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 111

def payment_terms
  @payment_terms
end

#pricing_componentsObject

pricing-components which describe the price tiering system of this rate plan. A product rate plan may have 1 or more pricing components. Each pricing component represents a different charge associated with the subscription. Pricing components are versioned.“,”verbs“:



106
107
108
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 106

def pricing_components
  @pricing_components
end

#pro_rata_modeObject

pro-rata mode for the rate plan.
<span class=\"label label-default\">None</span> &mdash; The pro-rata cost for upgrades will be ignored.
<span class=\"label label-default\">WithCoupon</span> &mdash; The pro-rata cost for upgrades will be calculated based on the time remaining for the subscription. Discounts from any attached coupons will be deducted from the pro-rated cost.
<span class=\"label label-default\">WithoutCoupon</span> &mdash; The pro-rata cost for upgrades will be calculated based on the time remaining for the subscription. Discounts from any attached coupons will not be deducted from the pro-rated cost. ","verbs":[]



64
65
66
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 64

def pro_rata_mode
  @pro_rata_mode
end

#productObject

product to which this rate plan belongs. A product is essentially a collection of rate plans, and describes the service conferred to a customer upon subscription to any of said product’s rate plans. The product serves also as a template from which its rate plans can infer default attributes.“,”verbs“:



103
104
105
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 103

def product
  @product
end

#product_idObject

of the product to which this rate plan belongs. A product is essentially a collection of rate plans, and describes the service conferred to a customer upon subscription to any of said product’s rate plans. The product serves also as a template from which its rate plans can infer default attributes.“,”verbs“:



37
38
39
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 37

def product_id
  @product_id
end

#product_typeObject

frequency of the rate plan &mdash; either recurring or non-recurring. If left unspecified: the rate plan will use the same ‘productType` frequency as the Product to which it belongs.“,”verbs“:



61
62
63
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 61

def product_type
  @product_type
end

#public_nameObject

friendly non-unique name used to identify this product-rate-plan“,”verbs“:



73
74
75
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 73

def public_name
  @public_name
end

#statusObject

current status of the rate plan.","verbs":[]



82
83
84
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 82

def status
  @status
end

#tax_statusObject

tax status of the product-rate-plan &mdash; either inclusive or exclusive.
<span class=\"label label-default\">exclusive</span>pricing indicates that the cost of the Pricing Components do not include tax; when BillForward generates an Invoice, the tax will be calculated with this price as a base.
Tax-<span class=\"label label-default\">inclusive</span>pricing indicates that the Pricing components include Tax. BillForward will still calculate tax on each invoice. Tax will be calculated from the sales price.“,”verbs“:



43
44
45
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 43

def tax_status
  @tax_status
end

#taxationObject

list linking taxation strategies to the rate plan.“,”verbs“:



97
98
99
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 97

def taxation
  @taxation
end

#trialObject

of trial-length-measures which constitute the rate plan’s trial period. If left unspecified: the rate plan will use the same ‘trial` number as the Product to which it belongs.“,”verbs“:



55
56
57
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 55

def trial
  @trial
end

#trial_periodObject

describing the magnitude of the rate plan’s trial period. If left unspecified: the rate plan will use the same ‘trialPeriod` magnitude as the Product to which it belongs.“,”verbs“:



58
59
60
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 58

def trial_period
  @trial_period
end

#updatedObject

{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }



25
26
27
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 25

def updated
  @updated
end

#valid_fromObject

UTC DateTime specifying when the rate plan is valid from.“,”verbs“:



76
77
78
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 76

def valid_from
  @valid_from
end

#valid_tillObject

UTC DateTime specifying when the product-rate-plan is valid till.“,”verbs“:



79
80
81
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 79

def valid_till
  @valid_till
end

Class Method Details

.attribute_mapObject

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



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
164
165
166
167
168
169
170
171
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 136

def self.attribute_map
  {
    :'created' => :'created',
    :'changed_by' => :'changedBy',
    :'updated' => :'updated',
    :'metadata' => :'metadata',
    :'id' => :'id',
    :'crm_id' => :'crmID',
    :'product_id' => :'productID',
    :'currency' => :'currency',
    :'tax_status' => :'taxStatus',
    :'failed_payment_behaviour' => :'failedPaymentBehaviour',
    :'duration' => :'duration',
    :'duration_period' => :'durationPeriod',
    :'trial' => :'trial',
    :'trial_period' => :'trialPeriod',
    :'product_type' => :'productType',
    :'pro_rata_mode' => :'proRataMode',
    :'create_zero_valued_invoices' => :'createZeroValuedInvoices',
    :'name' => :'name',
    :'public_name' => :'publicName',
    :'valid_from' => :'validFrom',
    :'valid_till' => :'validTill',
    :'status' => :'status',
    :'migration_behaviour' => :'migrationBehaviour',
    :'invoice_issue_type' => :'invoiceIssueType',
    :'issue_duration' => :'issueDuration',
    :'issue_period' => :'issuePeriod',
    :'taxation' => :'taxation',
    :'fixed_term_definitions' => :'fixedTermDefinitions',
    :'product' => :'product',
    :'pricing_components' => :'pricingComponents',
    :'aggregating_components' => :'aggregatingComponents',
    :'payment_terms' => :'paymentTerms'
  }
end

.swagger_typesObject

Attribute type mapping.



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/bf_ruby2/models/product_rate_plan.rb', line 174

def self.swagger_types
  {
    :'created' => :'DateTime',
    :'changed_by' => :'String',
    :'updated' => :'DateTime',
    :'metadata' => :'DynamicMetadata',
    :'id' => :'String',
    :'crm_id' => :'String',
    :'product_id' => :'String',
    :'currency' => :'String',
    :'tax_status' => :'String',
    :'failed_payment_behaviour' => :'String',
    :'duration' => :'Integer',
    :'duration_period' => :'String',
    :'trial' => :'Integer',
    :'trial_period' => :'String',
    :'product_type' => :'String',
    :'pro_rata_mode' => :'String',
    :'create_zero_valued_invoices' => :'BOOLEAN',
    :'name' => :'String',
    :'public_name' => :'String',
    :'valid_from' => :'DateTime',
    :'valid_till' => :'DateTime',
    :'status' => :'String',
    :'migration_behaviour' => :'String',
    :'invoice_issue_type' => :'String',
    :'issue_duration' => :'Integer',
    :'issue_period' => :'String',
    :'taxation' => :'Array<MutableBillingEntity>',
    :'fixed_term_definitions' => :'Array<MutableBillingEntity>',
    :'product' => :'Product',
    :'pricing_components' => :'Array<PricingComponent>',
    :'aggregating_components' => :'Array<AggregatingComponent>',
    :'payment_terms' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 532

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      created == o.created &&
      changed_by == o.changed_by &&
      updated == o.updated &&
       == o. &&
      id == o.id &&
      crm_id == o.crm_id &&
      product_id == o.product_id &&
      currency == o.currency &&
      tax_status == o.tax_status &&
      failed_payment_behaviour == o.failed_payment_behaviour &&
      duration == o.duration &&
      duration_period == o.duration_period &&
      trial == o.trial &&
      trial_period == o.trial_period &&
      product_type == o.product_type &&
      pro_rata_mode == o.pro_rata_mode &&
      create_zero_valued_invoices == o.create_zero_valued_invoices &&
      name == o.name &&
      public_name == o.public_name &&
      valid_from == o.valid_from &&
      valid_till == o.valid_till &&
      status == o.status &&
      migration_behaviour == o.migration_behaviour &&
      invoice_issue_type == o.invoice_issue_type &&
      issue_duration == o.issue_duration &&
      issue_period == o.issue_period &&
      taxation == o.taxation &&
      fixed_term_definitions == o.fixed_term_definitions &&
      product == o.product &&
      pricing_components == o.pricing_components &&
      aggregating_components == o.aggregating_components &&
      payment_terms == o.payment_terms
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



605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 605

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 = Bfwd.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



671
672
673
674
675
676
677
678
679
680
681
682
683
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 671

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



584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 584

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


571
572
573
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 571

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



577
578
579
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 577

def hash
  [created, changed_by, updated, , id, crm_id, product_id, currency, tax_status, failed_payment_behaviour, duration, duration_period, trial, trial_period, product_type, pro_rata_mode, create_zero_valued_invoices, name, public_name, valid_from, valid_till, status, migration_behaviour, invoice_issue_type, issue_duration, issue_period, taxation, fixed_term_definitions, product, pricing_components, aggregating_components, payment_terms].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properies with the reasons



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 361

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

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

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

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

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

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

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

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

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

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

  return 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



651
652
653
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 651

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



657
658
659
660
661
662
663
664
665
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 657

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



645
646
647
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 645

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



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
# File 'lib/bf_ruby2/models/product_rate_plan.rb', line 408

def valid?
  return false if @product_id.nil?
  return false if @currency.nil?
  return false if @tax_status.nil?
  tax_status_validator = EnumAttributeValidator.new('String', ["inclusive", "exclusive"])
  return false unless tax_status_validator.valid?(@tax_status)
  return false if @failed_payment_behaviour.nil?
  failed_payment_behaviour_validator = EnumAttributeValidator.new('String', ["CancelSubscription", "None"])
  return false unless failed_payment_behaviour_validator.valid?(@failed_payment_behaviour)
  return false if @duration_period.nil?
  duration_period_validator = EnumAttributeValidator.new('String', ["minutes", "days", "months", "years"])
  return false unless duration_period_validator.valid?(@duration_period)
  trial_period_validator = EnumAttributeValidator.new('String', ["none", "minutes", "days", "months"])
  return false unless trial_period_validator.valid?(@trial_period)
  product_type_validator = EnumAttributeValidator.new('String', ["nonrecurring", "recurring"])
  return false unless product_type_validator.valid?(@product_type)
  return false if @pro_rata_mode.nil?
  pro_rata_mode_validator = EnumAttributeValidator.new('String', ["None", "WithCoupon", "WithoutCoupon", "Full"])
  return false unless pro_rata_mode_validator.valid?(@pro_rata_mode)
  return false if @create_zero_valued_invoices.nil?
  return false if @name.nil?
  return false if @migration_behaviour.nil?
  migration_behaviour_validator = EnumAttributeValidator.new('String', ["NoCharge", "CreditAccount"])
  return false unless migration_behaviour_validator.valid?(@migration_behaviour)
  invoice_issue_type_validator = EnumAttributeValidator.new('String', ["Immediate", "Delayed", "Manual"])
  return false unless invoice_issue_type_validator.valid?(@invoice_issue_type)
  issue_period_validator = EnumAttributeValidator.new('String', ["minutes", "days", "months", "years"])
  return false unless issue_period_validator.valid?(@issue_period)
  return false if @pricing_components.nil?
  return true
end