Class: Bfwd::Subscription
- Inherits:
-
Object
- Object
- Bfwd::Subscription
- Defined in:
- lib/bf_ruby2/models/subscription.rb
Overview
Subscription
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#account_id ⇒ Object
href="\"POST\",\"GET\"">description“:”“,”verbs“:.
-
#aggregate_all_subscriptions_on_account ⇒ Object
{ "default":"true", "description":"Whether the subscription will aggregate all other subscriptions on the account.","verbs":["GET", "PUT", "POST"]}.
-
#changed_by ⇒ Object
{ "description" : "ID of the user who last updated the entity.", "verbs":[] }.
-
#contract_start ⇒ Object
of the contracted period. This will be after a trial, if one exists“,”verbs“:.
-
#created ⇒ Object
{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }.
-
#credit_enabled ⇒ Object
{ "default":"true", "description":"Can credit-notes be used to pay outstanding invoices for this subscription.","verbs":["GET", "PUT", "POST"]}.
-
#crm_id ⇒ Object
href="\"POST\",\"PUT\",\"GET\"">description“:”“,”verbs“:.
-
#current_period_end ⇒ Object
of the current period invoiced for. This can be manually updated to extend trials or delay invoice generation.“,”verbs“:.
-
#current_period_end_explicit ⇒ Object
for the initial subscription period. Allows periods to align to a date or time regardless of purchase date/time.“,”verbs“:.
-
#current_period_start ⇒ Object
of the current invoice period. At the end of this period, a new new invoice will be generated“,”verbs“:.
-
#current_time ⇒ Object
current time — from the point of view of the subscription.“,”verbs“:.
-
#description ⇒ Object
href="\"POST\",\"PUT\",\"GET\"">description“:”“,”verbs“:.
-
#dunning ⇒ Object
{ "default":"false", "description":"Are there outstanding invoices which are currently in dunning.","verbs":["GET", "PUT", "POST"]}.
-
#failed_payment_behaviour ⇒ Object
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> — Demotes the subscription to theFailedstate as soon as the dunning period is exceeded.
<span class=\"label label-default\">None</span> — The subscription is allowed to continue in theAwaitingPaymentstate indefinitely even if the dunning period is exceeded.For slow payment cycles — or when manual invoice remediation is common — <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“:. -
#fixed_terms ⇒ Object
of fixed terms that have been or are applied to the subscription“,”verbs“:.
-
#id ⇒ Object
href="\"GET\"">description“:”“,”verbs“:.
-
#initial_period_start ⇒ Object
of the first successful period“,”verbs“:.
-
#locked ⇒ Object
the subscription is locked, it will not be processed by the system","verbs":[].
-
#managed_by ⇒ Object
system is responsible for managing the subscription.","verbs":[].
-
#metadata ⇒ Object
{ "description" : "Add metadata.", "verbs“: }.
-
#name ⇒ Object
definable friendly name for the subscription.“,”verbs“:.
-
#organization_id ⇒ Object
associated with the subscription.","verbs":[].
-
#parent_id ⇒ Object
href="\"GET\"">description“:”“,”verbs“:.
-
#payment_method_subscription_links ⇒ Object
Returns the value of attribute payment_method_subscription_links.
-
#payment_terms ⇒ Object
Returns the value of attribute payment_terms.
-
#pricing_component_values ⇒ Object
quantities for each pricing component of the rate-plan. Values should be set for all pricing components of the rate-plan apart from the usage components. Usage components should be added when the usage is known, this is often after the end of the current billing cycle.","verbs":["GET", "POST"].
-
#product_id ⇒ Object
href="\"GET\"">description“:”“,”verbs“:.
-
#product_rate_plan_id ⇒ Object
of the rate-plan being billed for.“,”verbs“:.
-
#purchase_order ⇒ Object
{ "default": " ", "description":"Purchase order associated with the subscription. If specified this is copied to any invoices issued for this subscription.“,”verbs“:}.
-
#state ⇒ Object
<span class=\"label label-default\">Provisioned</span> subscription can be updated to either <span class=\"label label-default\">Trial</span> or <span class=\"label label-default\">AwaitingPayment</span>, this will start the subscription. Any updates to the state of a non-<span class=\"label label-default\">Provisioned</span> will be ignored. To cancel or otherwise amend a subscription please use the explict amendment calls.", "description":"A <span class=\"label label-default\">Provisioned</span> subscription will not begin until marked as <span class=\"label label-default\">Trial</span> or <span class=\"label label-default\">AwaitingPayment</span>. Trial subscriptions transition to <span class=\"label label-default\">AwaitingPayment</span> when the trial period is over. On subscription renewal the state becomes <span class=\"label label-default\">AwaitingPayment</span>. Once outstanding invoices are paid the state changes to <span class=\"label label-default\">Paid</span>. A subscription is set as either <span class=\"label label-default\">Failed</span> or left as <span class=\"label label-default\">AwaitingPayment</span>, depending on the rate-plan configuration. If a subscription is non-recurring or fixed-term and ends naturally, it will be marked as <span class=\"label label-default\">Expired</span>. If all payment attempts have failed a subscription is marked as <span class=\"label label-default\">Cancelled</span> if it has been manually ended. Once a subscription is marked as <span class=\"label label-default\">Failed</span>, <span class=\"label label-default\">Expired</span>, or <span class=\"label label-default\">Cancelled</span> no invoices other than a final invoice will be issued. Note: Updating account card details will not lead to BillForward automatically retrying payment, manual payment attempts can be made.“,”verbs“:.
-
#subscription_end ⇒ Object
a subscription will end. This may be in the future if the cancellation is at the end of the current period.“,”verbs“:.
-
#successful_periods ⇒ Object
of paid-for periods billing, excluding trials, since the subscription started.“,”verbs“:.
-
#time_offset ⇒ Object
far in the future is the entity (in seconds) compared to the BillForward server’s time.“,”verbs“:.
-
#total_periods ⇒ Object
number of subscription periods.“,”verbs“:.
-
#trial_end ⇒ Object
end time of the trial period, if one existed“,”verbs“:.
-
#type ⇒ Object
on product", "description“:”“,”verbs“:.
-
#updated ⇒ Object
{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }.
-
#version_end ⇒ Object
the current version of the subscription ended, null indicates current version.“,”verbs“:.
-
#version_id ⇒ Object
href="\"GET\"">description“:”“,”verbs“:.
-
#version_number ⇒ Object
version number of the subscription, starts at 1.“,”verbs“:.
-
#version_start ⇒ Object
the current version of the subscription started.“,”verbs“:.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Subscription
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Subscription
Initializes the object
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 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 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 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'lib/bf_ruby2/models/subscription.rb', line 268 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?(:'versionID') self.version_id = attributes[:'versionID'] end if attributes.has_key?(:'crmID') self.crm_id = attributes[:'crmID'] end if attributes.has_key?(:'accountID') self.account_id = attributes[:'accountID'] end if attributes.has_key?(:'organizationID') self.organization_id = attributes[:'organizationID'] end if attributes.has_key?(:'productID') self.product_id = attributes[:'productID'] end if attributes.has_key?(:'productRatePlanID') self.product_rate_plan_id = attributes[:'productRatePlanID'] end if attributes.has_key?(:'parentID') self.parent_id = attributes[:'parentID'] end if attributes.has_key?(:'name') self.name = attributes[:'name'] end if attributes.has_key?(:'description') self.description = attributes[:'description'] end if attributes.has_key?(:'type') self.type = attributes[:'type'] end if attributes.has_key?(:'state') self.state = attributes[:'state'] end if attributes.has_key?(:'currentPeriodStart') self.current_period_start = attributes[:'currentPeriodStart'] end if attributes.has_key?(:'currentPeriodEnd') self.current_period_end = attributes[:'currentPeriodEnd'] end if attributes.has_key?(:'contractStart') self.contract_start = attributes[:'contractStart'] end if attributes.has_key?(:'subscriptionEnd') self.subscription_end = attributes[:'subscriptionEnd'] end if attributes.has_key?(:'currentPeriodEndExplicit') self.current_period_end_explicit = attributes[:'currentPeriodEndExplicit'] end if attributes.has_key?(:'initialPeriodStart') self.initial_period_start = attributes[:'initialPeriodStart'] end if attributes.has_key?(:'successfulPeriods') self.successful_periods = attributes[:'successfulPeriods'] end if attributes.has_key?(:'totalPeriods') self.total_periods = attributes[:'totalPeriods'] end if attributes.has_key?(:'trialEnd') self.trial_end = attributes[:'trialEnd'] end if attributes.has_key?(:'dunning') self.dunning = attributes[:'dunning'] else self.dunning = false end if attributes.has_key?(:'locked') self.locked = attributes[:'locked'] end if attributes.has_key?(:'managedBy') self.managed_by = attributes[:'managedBy'] end if attributes.has_key?(:'versionStart') self.version_start = attributes[:'versionStart'] end if attributes.has_key?(:'versionEnd') self.version_end = attributes[:'versionEnd'] end if attributes.has_key?(:'versionNumber') self.version_number = attributes[:'versionNumber'] end if attributes.has_key?(:'creditEnabled') self.credit_enabled = attributes[:'creditEnabled'] else self.credit_enabled = false end if attributes.has_key?(:'aggregateAllSubscriptionsOnAccount') self.aggregate_all_subscriptions_on_account = attributes[:'aggregateAllSubscriptionsOnAccount'] else self.aggregate_all_subscriptions_on_account = false end if attributes.has_key?(:'pricingComponentValues') if (value = attributes[:'pricingComponentValues']).is_a?(Array) self.pricing_component_values = value end end if attributes.has_key?(:'paymentMethodSubscriptionLinks') if (value = attributes[:'paymentMethodSubscriptionLinks']).is_a?(Array) self.payment_method_subscription_links = value end end if attributes.has_key?(:'fixedTerms') if (value = attributes[:'fixedTerms']).is_a?(Array) self.fixed_terms = value end end if attributes.has_key?(:'currentTime') self.current_time = attributes[:'currentTime'] end if attributes.has_key?(:'timeOffset') self.time_offset = attributes[:'timeOffset'] end if attributes.has_key?(:'paymentTerms') self.payment_terms = attributes[:'paymentTerms'] end if attributes.has_key?(:'purchaseOrder') self.purchase_order = attributes[:'purchaseOrder'] end if attributes.has_key?(:'failedPaymentBehaviour') self.failed_payment_behaviour = attributes[:'failedPaymentBehaviour'] end end |
Instance Attribute Details
#account_id ⇒ Object
href="\"POST\",\"GET\"">description“:”“,”verbs“:
51 52 53 |
# File 'lib/bf_ruby2/models/subscription.rb', line 51 def account_id @account_id end |
#aggregate_all_subscriptions_on_account ⇒ Object
{ "default":"true", "description":"Whether the subscription will aggregate all other subscriptions on the account.","verbs":["GET", "PUT", "POST"]}
126 127 128 |
# File 'lib/bf_ruby2/models/subscription.rb', line 126 def aggregate_all_subscriptions_on_account @aggregate_all_subscriptions_on_account end |
#changed_by ⇒ Object
{ "description" : "ID of the user who last updated the entity.", "verbs":[] }
33 34 35 |
# File 'lib/bf_ruby2/models/subscription.rb', line 33 def changed_by @changed_by end |
#contract_start ⇒ Object
of the contracted period. This will be after a trial, if one exists“,”verbs“:
84 85 86 |
# File 'lib/bf_ruby2/models/subscription.rb', line 84 def contract_start @contract_start end |
#created ⇒ Object
{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }
30 31 32 |
# File 'lib/bf_ruby2/models/subscription.rb', line 30 def created @created end |
#credit_enabled ⇒ Object
{ "default":"true", "description":"Can credit-notes be used to pay outstanding invoices for this subscription.","verbs":["GET", "PUT", "POST"]}
123 124 125 |
# File 'lib/bf_ruby2/models/subscription.rb', line 123 def credit_enabled @credit_enabled end |
#crm_id ⇒ Object
href="\"POST\",\"PUT\",\"GET\"">description“:”“,”verbs“:
48 49 50 |
# File 'lib/bf_ruby2/models/subscription.rb', line 48 def crm_id @crm_id end |
#current_period_end ⇒ Object
of the current period invoiced for. This can be manually updated to extend trials or delay invoice generation.“,”verbs“:
81 82 83 |
# File 'lib/bf_ruby2/models/subscription.rb', line 81 def current_period_end @current_period_end end |
#current_period_end_explicit ⇒ Object
for the initial subscription period. Allows periods to align to a date or time regardless of purchase date/time.“,”verbs“:
90 91 92 |
# File 'lib/bf_ruby2/models/subscription.rb', line 90 def current_period_end_explicit @current_period_end_explicit end |
#current_period_start ⇒ Object
of the current invoice period. At the end of this period, a new new invoice will be generated“,”verbs“:
78 79 80 |
# File 'lib/bf_ruby2/models/subscription.rb', line 78 def current_period_start @current_period_start end |
#current_time ⇒ Object
current time — from the point of view of the subscription.“,”verbs“:
137 138 139 |
# File 'lib/bf_ruby2/models/subscription.rb', line 137 def current_time @current_time end |
#description ⇒ Object
href="\"POST\",\"PUT\",\"GET\"">description“:”“,”verbs“:
69 70 71 |
# File 'lib/bf_ruby2/models/subscription.rb', line 69 def description @description end |
#dunning ⇒ Object
{ "default":"false", "description":"Are there outstanding invoices which are currently in dunning.","verbs":["GET", "PUT", "POST"]}
105 106 107 |
# File 'lib/bf_ruby2/models/subscription.rb', line 105 def dunning @dunning end |
#failed_payment_behaviour ⇒ Object
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> — Demotes the subscription to the Failed state as soon as the dunning period is exceeded.
<span class=\"label label-default\">None</span> — The subscription is allowed to continue in the AwaitingPayment state indefinitely even if the dunning period is exceeded.For slow payment cycles — or when manual invoice remediation is common — <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“:
148 149 150 |
# File 'lib/bf_ruby2/models/subscription.rb', line 148 def failed_payment_behaviour @failed_payment_behaviour end |
#fixed_terms ⇒ Object
of fixed terms that have been or are applied to the subscription“,”verbs“:
134 135 136 |
# File 'lib/bf_ruby2/models/subscription.rb', line 134 def fixed_terms @fixed_terms end |
#id ⇒ Object
href="\"GET\"">description“:”“,”verbs“:
42 43 44 |
# File 'lib/bf_ruby2/models/subscription.rb', line 42 def id @id end |
#initial_period_start ⇒ Object
of the first successful period“,”verbs“:
93 94 95 |
# File 'lib/bf_ruby2/models/subscription.rb', line 93 def initial_period_start @initial_period_start end |
#locked ⇒ Object
the subscription is locked, it will not be processed by the system","verbs":[]
108 109 110 |
# File 'lib/bf_ruby2/models/subscription.rb', line 108 def locked @locked end |
#managed_by ⇒ Object
system is responsible for managing the subscription.","verbs":[]
111 112 113 |
# File 'lib/bf_ruby2/models/subscription.rb', line 111 def managed_by @managed_by end |
#metadata ⇒ Object
{ "description" : "Add metadata.", "verbs“: }
39 40 41 |
# File 'lib/bf_ruby2/models/subscription.rb', line 39 def @metadata end |
#name ⇒ Object
definable friendly name for the subscription.“,”verbs“:
66 67 68 |
# File 'lib/bf_ruby2/models/subscription.rb', line 66 def name @name end |
#organization_id ⇒ Object
associated with the subscription.","verbs":[]
54 55 56 |
# File 'lib/bf_ruby2/models/subscription.rb', line 54 def organization_id @organization_id end |
#parent_id ⇒ Object
href="\"GET\"">description“:”“,”verbs“:
63 64 65 |
# File 'lib/bf_ruby2/models/subscription.rb', line 63 def parent_id @parent_id end |
#payment_method_subscription_links ⇒ Object
Returns the value of attribute payment_method_subscription_links.
131 132 133 |
# File 'lib/bf_ruby2/models/subscription.rb', line 131 def payment_method_subscription_links @payment_method_subscription_links end |
#payment_terms ⇒ Object
Returns the value of attribute payment_terms.
142 143 144 |
# File 'lib/bf_ruby2/models/subscription.rb', line 142 def payment_terms @payment_terms end |
#pricing_component_values ⇒ Object
quantities for each pricing component of the rate-plan. Values should be set for all pricing components of the rate-plan apart from the usage components. Usage components should be added when the usage is known, this is often after the end of the current billing cycle.","verbs":["GET", "POST"]
129 130 131 |
# File 'lib/bf_ruby2/models/subscription.rb', line 129 def pricing_component_values @pricing_component_values end |
#product_id ⇒ Object
href="\"GET\"">description“:”“,”verbs“:
57 58 59 |
# File 'lib/bf_ruby2/models/subscription.rb', line 57 def product_id @product_id end |
#product_rate_plan_id ⇒ Object
of the rate-plan being billed for.“,”verbs“:
60 61 62 |
# File 'lib/bf_ruby2/models/subscription.rb', line 60 def product_rate_plan_id @product_rate_plan_id end |
#purchase_order ⇒ Object
{ "default": " ", "description":"Purchase order associated with the subscription. If specified this is copied to any invoices issued for this subscription.“,”verbs“:}
145 146 147 |
# File 'lib/bf_ruby2/models/subscription.rb', line 145 def purchase_order @purchase_order end |
#state ⇒ Object
<span class=\"label label-default\">Provisioned</span> subscription can be updated to either <span class=\"label label-default\">Trial</span> or <span class=\"label label-default\">AwaitingPayment</span>, this will start the subscription. Any updates to the state of a non-<span class=\"label label-default\">Provisioned</span> will be ignored. To cancel or otherwise amend a subscription please use the explict amendment calls.", "description":"A <span class=\"label label-default\">Provisioned</span> subscription will not begin until marked as <span class=\"label label-default\">Trial</span> or <span class=\"label label-default\">AwaitingPayment</span>. Trial subscriptions transition to <span class=\"label label-default\">AwaitingPayment</span> when the trial period is over. On subscription renewal the state becomes <span class=\"label label-default\">AwaitingPayment</span>. Once outstanding invoices are paid the state changes to <span class=\"label label-default\">Paid</span>. A subscription is set as either <span class=\"label label-default\">Failed</span> or left as <span class=\"label label-default\">AwaitingPayment</span>, depending on the rate-plan configuration. If a subscription is non-recurring or fixed-term and ends naturally, it will be marked as <span class=\"label label-default\">Expired</span>. If all payment attempts have failed a subscription is marked as <span class=\"label label-default\">Cancelled</span> if it has been manually ended. Once a subscription is marked as <span class=\"label label-default\">Failed</span>, <span class=\"label label-default\">Expired</span>, or <span class=\"label label-default\">Cancelled</span> no invoices other than a final invoice will be issued. Note: Updating account card details will not lead to BillForward automatically retrying payment, manual payment attempts can be made.“,”verbs“:
75 76 77 |
# File 'lib/bf_ruby2/models/subscription.rb', line 75 def state @state end |
#subscription_end ⇒ Object
a subscription will end. This may be in the future if the cancellation is at the end of the current period.“,”verbs“:
87 88 89 |
# File 'lib/bf_ruby2/models/subscription.rb', line 87 def subscription_end @subscription_end end |
#successful_periods ⇒ Object
of paid-for periods billing, excluding trials, since the subscription started.“,”verbs“:
96 97 98 |
# File 'lib/bf_ruby2/models/subscription.rb', line 96 def successful_periods @successful_periods end |
#time_offset ⇒ Object
far in the future is the entity (in seconds) compared to the BillForward server’s time.“,”verbs“:
140 141 142 |
# File 'lib/bf_ruby2/models/subscription.rb', line 140 def time_offset @time_offset end |
#total_periods ⇒ Object
number of subscription periods.“,”verbs“:
99 100 101 |
# File 'lib/bf_ruby2/models/subscription.rb', line 99 def total_periods @total_periods end |
#trial_end ⇒ Object
end time of the trial period, if one existed“,”verbs“:
102 103 104 |
# File 'lib/bf_ruby2/models/subscription.rb', line 102 def trial_end @trial_end end |
#type ⇒ Object
on product", "description“:”“,”verbs“:
72 73 74 |
# File 'lib/bf_ruby2/models/subscription.rb', line 72 def type @type end |
#updated ⇒ Object
{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }
36 37 38 |
# File 'lib/bf_ruby2/models/subscription.rb', line 36 def updated @updated end |
#version_end ⇒ Object
the current version of the subscription ended, null indicates current version.“,”verbs“:
117 118 119 |
# File 'lib/bf_ruby2/models/subscription.rb', line 117 def version_end @version_end end |
#version_id ⇒ Object
href="\"GET\"">description“:”“,”verbs“:
45 46 47 |
# File 'lib/bf_ruby2/models/subscription.rb', line 45 def version_id @version_id end |
#version_number ⇒ Object
version number of the subscription, starts at 1.“,”verbs“:
120 121 122 |
# File 'lib/bf_ruby2/models/subscription.rb', line 120 def version_number @version_number end |
#version_start ⇒ Object
the current version of the subscription started.“,”verbs“:
114 115 116 |
# File 'lib/bf_ruby2/models/subscription.rb', line 114 def version_start @version_start end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 210 211 212 213 214 215 216 217 |
# File 'lib/bf_ruby2/models/subscription.rb', line 173 def self.attribute_map { :'created' => :'created', :'changed_by' => :'changedBy', :'updated' => :'updated', :'metadata' => :'metadata', :'id' => :'id', :'version_id' => :'versionID', :'crm_id' => :'crmID', :'account_id' => :'accountID', :'organization_id' => :'organizationID', :'product_id' => :'productID', :'product_rate_plan_id' => :'productRatePlanID', :'parent_id' => :'parentID', :'name' => :'name', :'description' => :'description', :'type' => :'type', :'state' => :'state', :'current_period_start' => :'currentPeriodStart', :'current_period_end' => :'currentPeriodEnd', :'contract_start' => :'contractStart', :'subscription_end' => :'subscriptionEnd', :'current_period_end_explicit' => :'currentPeriodEndExplicit', :'initial_period_start' => :'initialPeriodStart', :'successful_periods' => :'successfulPeriods', :'total_periods' => :'totalPeriods', :'trial_end' => :'trialEnd', :'dunning' => :'dunning', :'locked' => :'locked', :'managed_by' => :'managedBy', :'version_start' => :'versionStart', :'version_end' => :'versionEnd', :'version_number' => :'versionNumber', :'credit_enabled' => :'creditEnabled', :'aggregate_all_subscriptions_on_account' => :'aggregateAllSubscriptionsOnAccount', :'pricing_component_values' => :'pricingComponentValues', :'payment_method_subscription_links' => :'paymentMethodSubscriptionLinks', :'fixed_terms' => :'fixedTerms', :'current_time' => :'currentTime', :'time_offset' => :'timeOffset', :'payment_terms' => :'paymentTerms', :'purchase_order' => :'purchaseOrder', :'failed_payment_behaviour' => :'failedPaymentBehaviour' } end |
.swagger_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/bf_ruby2/models/subscription.rb', line 220 def self.swagger_types { :'created' => :'DateTime', :'changed_by' => :'String', :'updated' => :'DateTime', :'metadata' => :'DynamicMetadata', :'id' => :'String', :'version_id' => :'String', :'crm_id' => :'String', :'account_id' => :'String', :'organization_id' => :'String', :'product_id' => :'String', :'product_rate_plan_id' => :'String', :'parent_id' => :'String', :'name' => :'String', :'description' => :'String', :'type' => :'String', :'state' => :'String', :'current_period_start' => :'DateTime', :'current_period_end' => :'DateTime', :'contract_start' => :'DateTime', :'subscription_end' => :'DateTime', :'current_period_end_explicit' => :'DateTime', :'initial_period_start' => :'DateTime', :'successful_periods' => :'Integer', :'total_periods' => :'Integer', :'trial_end' => :'DateTime', :'dunning' => :'BOOLEAN', :'locked' => :'String', :'managed_by' => :'String', :'version_start' => :'DateTime', :'version_end' => :'DateTime', :'version_number' => :'Integer', :'credit_enabled' => :'BOOLEAN', :'aggregate_all_subscriptions_on_account' => :'BOOLEAN', :'pricing_component_values' => :'Array<PricingComponentValue>', :'payment_method_subscription_links' => :'Array<PaymentMethodSubscriptionLink>', :'fixed_terms' => :'Array<FixedTerm>', :'current_time' => :'DateTime', :'time_offset' => :'Integer', :'payment_terms' => :'Integer', :'purchase_order' => :'String', :'failed_payment_behaviour' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
527 528 529 530 531 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 568 569 570 571 |
# File 'lib/bf_ruby2/models/subscription.rb', line 527 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 && version_id == o.version_id && crm_id == o.crm_id && account_id == o.account_id && organization_id == o.organization_id && product_id == o.product_id && product_rate_plan_id == o.product_rate_plan_id && parent_id == o.parent_id && name == o.name && description == o.description && type == o.type && state == o.state && current_period_start == o.current_period_start && current_period_end == o.current_period_end && contract_start == o.contract_start && subscription_end == o.subscription_end && current_period_end_explicit == o.current_period_end_explicit && initial_period_start == o.initial_period_start && successful_periods == o.successful_periods && total_periods == o.total_periods && trial_end == o.trial_end && dunning == o.dunning && locked == o.locked && managed_by == o.managed_by && version_start == o.version_start && version_end == o.version_end && version_number == o.version_number && credit_enabled == o.credit_enabled && aggregate_all_subscriptions_on_account == o.aggregate_all_subscriptions_on_account && pricing_component_values == o.pricing_component_values && payment_method_subscription_links == o.payment_method_subscription_links && fixed_terms == o.fixed_terms && current_time == o.current_time && time_offset == o.time_offset && payment_terms == o.payment_terms && purchase_order == o.purchase_order && failed_payment_behaviour == o.failed_payment_behaviour end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
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 642 643 644 645 |
# File 'lib/bf_ruby2/models/subscription.rb', line 609 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 =~ /^(true|t|yes|y|1)$/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
675 676 677 678 679 680 681 682 683 684 685 686 687 |
# File 'lib/bf_ruby2/models/subscription.rb', line 675 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
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 |
# File 'lib/bf_ruby2/models/subscription.rb', line 588 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/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
575 576 577 |
# File 'lib/bf_ruby2/models/subscription.rb', line 575 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
581 582 583 |
# File 'lib/bf_ruby2/models/subscription.rb', line 581 def hash [created, changed_by, updated, , id, version_id, crm_id, account_id, organization_id, product_id, product_rate_plan_id, parent_id, name, description, type, state, current_period_start, current_period_end, contract_start, subscription_end, current_period_end_explicit, initial_period_start, successful_periods, total_periods, trial_end, dunning, locked, managed_by, version_start, version_end, version_number, credit_enabled, aggregate_all_subscriptions_on_account, pricing_component_values, payment_method_subscription_links, fixed_terms, current_time, time_offset, payment_terms, purchase_order, failed_payment_behaviour].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
454 455 456 457 |
# File 'lib/bf_ruby2/models/subscription.rb', line 454 def list_invalid_properties invalid_properties = Array.new return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
655 656 657 |
# File 'lib/bf_ruby2/models/subscription.rb', line 655 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
661 662 663 664 665 666 667 668 669 |
# File 'lib/bf_ruby2/models/subscription.rb', line 661 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_s ⇒ String
Returns the string representation of the object
649 650 651 |
# File 'lib/bf_ruby2/models/subscription.rb', line 649 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 |
# File 'lib/bf_ruby2/models/subscription.rb', line 461 def valid? return false if @id.nil? return false if @account_id.nil? return false if @organization_id.nil? return false if @product_id.nil? return false if @product_rate_plan_id.nil? return false if @name.nil? type_validator = EnumAttributeValidator.new('String', ["Subscription", "FixedTerm", "Trial"]) return false unless type_validator.valid?(@type) return false if @state.nil? state_validator = EnumAttributeValidator.new('String', ["Trial", "Provisioned", "Paid", "AwaitingPayment", "Cancelled", "Failed", "Expired"]) return false unless state_validator.valid?(@state) return false if @initial_period_start.nil? return false if @trial_end.nil? managed_by_validator = EnumAttributeValidator.new('String', ["BillForward", "Stripe"]) return false unless managed_by_validator.valid?(@managed_by) return false if @version_start.nil? return false if @version_number.nil? return false if @current_time.nil? failed_payment_behaviour_validator = EnumAttributeValidator.new('String', ["CancelSubscription", "None"]) return false unless failed_payment_behaviour_validator.valid?(@failed_payment_behaviour) return true end |