Class: Solifyn::Subscription
- Inherits:
-
Object
- Object
- Solifyn::Subscription
- Defined in:
- lib/solifyn/models/subscription.rb
Overview
Represents a customer subscription membership resource, containing current billing terms, plan, status, and metadata.
Instance Attribute Summary collapse
-
#cancel_at_period_end ⇒ Object
Whether the subscription is set to cancel at the end of the billing period.
-
#cancel_option ⇒ Object
The cancel option details.
-
#canceled_at ⇒ Object
Timestamp when the subscription was canceled.
-
#cancellation_reason ⇒ Object
The reason for cancellation.
-
#checkout_configuration_id ⇒ Object
The checkout configuration ID used.
-
#company ⇒ Object
The company context details.
-
#created_at ⇒ Object
Timestamp when the subscription was created.
-
#currency ⇒ Object
The currency used for payments.
-
#customer_id ⇒ Object
The business customer ID.
-
#id ⇒ Object
The unique ID of the subscription.
-
#joined_at ⇒ Object
Timestamp when the member joined.
-
#license_key ⇒ Object
The license key associated with this subscription.
-
#manage_url ⇒ Object
The management URL for the billing/subscription.
-
#member ⇒ Object
The member details.
-
#metadata ⇒ Object
Additional metadata for the subscription.
-
#payment_collection_paused ⇒ Object
Whether the payment collection is currently paused.
-
#plan ⇒ Object
The plan associated with this subscription.
-
#price ⇒ Object
The price/amount of the membership.
-
#product ⇒ Object
The product associated with the subscription.
-
#promo_code ⇒ Object
The promo code applied to the subscription.
-
#renewal_period_end ⇒ Object
End timestamp of the current renewal period.
-
#renewal_period_start ⇒ Object
Start timestamp of the current renewal period.
-
#status ⇒ Object
The status of the subscription (e.g. completed, active, trialing, past_due, canceled).
-
#type ⇒ Object
The type of the membership plan.
-
#updated_at ⇒ Object
Timestamp when the subscription was last updated.
-
#user ⇒ Object
The user details.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
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
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 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 |
# File 'lib/solifyn/models/subscription.rb', line 174 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Solifyn::Subscription` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Solifyn::Subscription`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = nil end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] else self.created_at = nil end if attributes.key?(:'joined_at') self.joined_at = attributes[:'joined_at'] else self.joined_at = nil end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] else self.updated_at = nil end if attributes.key?(:'manage_url') self.manage_url = attributes[:'manage_url'] else self.manage_url = nil end if attributes.key?(:'member') self.member = attributes[:'member'] else self.member = nil end if attributes.key?(:'user') self.user = attributes[:'user'] else self.user = nil end if attributes.key?(:'renewal_period_start') self.renewal_period_start = attributes[:'renewal_period_start'] else self.renewal_period_start = nil end if attributes.key?(:'renewal_period_end') self.renewal_period_end = attributes[:'renewal_period_end'] else self.renewal_period_end = nil end if attributes.key?(:'cancel_at_period_end') self.cancel_at_period_end = attributes[:'cancel_at_period_end'] else self.cancel_at_period_end = nil end if attributes.key?(:'cancel_option') self.cancel_option = attributes[:'cancel_option'] else self.cancel_option = nil end if attributes.key?(:'cancellation_reason') self.cancellation_reason = attributes[:'cancellation_reason'] else self.cancellation_reason = nil end if attributes.key?(:'canceled_at') self.canceled_at = attributes[:'canceled_at'] else self.canceled_at = nil end if attributes.key?(:'currency') self.currency = attributes[:'currency'] else self.currency = nil end if attributes.key?(:'company') self.company = attributes[:'company'] else self.company = nil end if attributes.key?(:'plan') self.plan = attributes[:'plan'] else self.plan = nil end if attributes.key?(:'promo_code') self.promo_code = attributes[:'promo_code'] else self.promo_code = nil end if attributes.key?(:'product') self.product = attributes[:'product'] else self.product = nil end if attributes.key?(:'license_key') self.license_key = attributes[:'license_key'] else self.license_key = nil end if attributes.key?(:'metadata') self. = attributes[:'metadata'] else self. = nil end if attributes.key?(:'payment_collection_paused') self.payment_collection_paused = attributes[:'payment_collection_paused'] else self.payment_collection_paused = nil end if attributes.key?(:'checkout_configuration_id') self.checkout_configuration_id = attributes[:'checkout_configuration_id'] else self.checkout_configuration_id = nil end if attributes.key?(:'price') self.price = attributes[:'price'] end if attributes.key?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] end end |
Instance Attribute Details
#cancel_at_period_end ⇒ Object
Whether the subscription is set to cancel at the end of the billing period
50 51 52 |
# File 'lib/solifyn/models/subscription.rb', line 50 def cancel_at_period_end @cancel_at_period_end end |
#cancel_option ⇒ Object
The cancel option details
53 54 55 |
# File 'lib/solifyn/models/subscription.rb', line 53 def cancel_option @cancel_option end |
#canceled_at ⇒ Object
Timestamp when the subscription was canceled
59 60 61 |
# File 'lib/solifyn/models/subscription.rb', line 59 def canceled_at @canceled_at end |
#cancellation_reason ⇒ Object
The reason for cancellation
56 57 58 |
# File 'lib/solifyn/models/subscription.rb', line 56 def cancellation_reason @cancellation_reason end |
#checkout_configuration_id ⇒ Object
The checkout configuration ID used
86 87 88 |
# File 'lib/solifyn/models/subscription.rb', line 86 def checkout_configuration_id @checkout_configuration_id end |
#company ⇒ Object
The company context details
65 66 67 |
# File 'lib/solifyn/models/subscription.rb', line 65 def company @company end |
#created_at ⇒ Object
Timestamp when the subscription was created
26 27 28 |
# File 'lib/solifyn/models/subscription.rb', line 26 def created_at @created_at end |
#currency ⇒ Object
The currency used for payments
62 63 64 |
# File 'lib/solifyn/models/subscription.rb', line 62 def currency @currency end |
#customer_id ⇒ Object
The business customer ID
95 96 97 |
# File 'lib/solifyn/models/subscription.rb', line 95 def customer_id @customer_id end |
#id ⇒ Object
The unique ID of the subscription
20 21 22 |
# File 'lib/solifyn/models/subscription.rb', line 20 def id @id end |
#joined_at ⇒ Object
Timestamp when the member joined
29 30 31 |
# File 'lib/solifyn/models/subscription.rb', line 29 def joined_at @joined_at end |
#license_key ⇒ Object
The license key associated with this subscription
77 78 79 |
# File 'lib/solifyn/models/subscription.rb', line 77 def license_key @license_key end |
#manage_url ⇒ Object
The management URL for the billing/subscription
35 36 37 |
# File 'lib/solifyn/models/subscription.rb', line 35 def manage_url @manage_url end |
#member ⇒ Object
The member details
38 39 40 |
# File 'lib/solifyn/models/subscription.rb', line 38 def member @member end |
#metadata ⇒ Object
Additional metadata for the subscription
80 81 82 |
# File 'lib/solifyn/models/subscription.rb', line 80 def @metadata end |
#payment_collection_paused ⇒ Object
Whether the payment collection is currently paused
83 84 85 |
# File 'lib/solifyn/models/subscription.rb', line 83 def payment_collection_paused @payment_collection_paused end |
#plan ⇒ Object
The plan associated with this subscription
68 69 70 |
# File 'lib/solifyn/models/subscription.rb', line 68 def plan @plan end |
#price ⇒ Object
The price/amount of the membership
89 90 91 |
# File 'lib/solifyn/models/subscription.rb', line 89 def price @price end |
#product ⇒ Object
The product associated with the subscription
74 75 76 |
# File 'lib/solifyn/models/subscription.rb', line 74 def product @product end |
#promo_code ⇒ Object
The promo code applied to the subscription
71 72 73 |
# File 'lib/solifyn/models/subscription.rb', line 71 def promo_code @promo_code end |
#renewal_period_end ⇒ Object
End timestamp of the current renewal period
47 48 49 |
# File 'lib/solifyn/models/subscription.rb', line 47 def renewal_period_end @renewal_period_end end |
#renewal_period_start ⇒ Object
Start timestamp of the current renewal period
44 45 46 |
# File 'lib/solifyn/models/subscription.rb', line 44 def renewal_period_start @renewal_period_start end |
#status ⇒ Object
The status of the subscription (e.g. completed, active, trialing, past_due, canceled)
23 24 25 |
# File 'lib/solifyn/models/subscription.rb', line 23 def status @status end |
#type ⇒ Object
The type of the membership plan
92 93 94 |
# File 'lib/solifyn/models/subscription.rb', line 92 def type @type end |
#updated_at ⇒ Object
Timestamp when the subscription was last updated
32 33 34 |
# File 'lib/solifyn/models/subscription.rb', line 32 def updated_at @updated_at end |
#user ⇒ Object
The user details
41 42 43 |
# File 'lib/solifyn/models/subscription.rb', line 41 def user @user end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
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 572 573 574 575 576 577 |
# File 'lib/solifyn/models/subscription.rb', line 540 def self._deserialize(type, value) case type.to_sym when :Time Time.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 # models (e.g. Pet) or oneOf klass = Solifyn.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
130 131 132 |
# File 'lib/solifyn/models/subscription.rb', line 130 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/solifyn/models/subscription.rb', line 98 def self.attribute_map { :'id' => :'id', :'status' => :'status', :'created_at' => :'created_at', :'joined_at' => :'joined_at', :'updated_at' => :'updated_at', :'manage_url' => :'manage_url', :'member' => :'member', :'user' => :'user', :'renewal_period_start' => :'renewal_period_start', :'renewal_period_end' => :'renewal_period_end', :'cancel_at_period_end' => :'cancel_at_period_end', :'cancel_option' => :'cancel_option', :'cancellation_reason' => :'cancellation_reason', :'canceled_at' => :'canceled_at', :'currency' => :'currency', :'company' => :'company', :'plan' => :'plan', :'promo_code' => :'promo_code', :'product' => :'product', :'license_key' => :'license_key', :'metadata' => :'metadata', :'payment_collection_paused' => :'payment_collection_paused', :'checkout_configuration_id' => :'checkout_configuration_id', :'price' => :'price', :'type' => :'type', :'customer_id' => :'customerId' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 |
# File 'lib/solifyn/models/subscription.rb', line 516 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif 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[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
167 168 169 170 |
# File 'lib/solifyn/models/subscription.rb', line 167 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 164 |
# File 'lib/solifyn/models/subscription.rb', line 135 def self.openapi_types { :'id' => :'String', :'status' => :'String', :'created_at' => :'Time', :'joined_at' => :'Time', :'updated_at' => :'Time', :'manage_url' => :'String', :'member' => :'SubscriptionMemberDto', :'user' => :'SubscriptionUserDto', :'renewal_period_start' => :'Object', :'renewal_period_end' => :'Object', :'cancel_at_period_end' => :'Boolean', :'cancel_option' => :'Object', :'cancellation_reason' => :'Object', :'canceled_at' => :'Object', :'currency' => :'String', :'company' => :'SubscriptionCompanyDto', :'plan' => :'SubscriptionPlanDto', :'promo_code' => :'Object', :'product' => :'SubscriptionProductDto', :'license_key' => :'Object', :'metadata' => :'Object', :'payment_collection_paused' => :'Boolean', :'checkout_configuration_id' => :'String', :'price' => :'Object', :'type' => :'Object', :'customer_id' => :'Object' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
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 |
# File 'lib/solifyn/models/subscription.rb', line 470 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && status == o.status && created_at == o.created_at && joined_at == o.joined_at && updated_at == o.updated_at && manage_url == o.manage_url && member == o.member && user == o.user && renewal_period_start == o.renewal_period_start && renewal_period_end == o.renewal_period_end && cancel_at_period_end == o.cancel_at_period_end && cancel_option == o.cancel_option && cancellation_reason == o.cancellation_reason && canceled_at == o.canceled_at && currency == o.currency && company == o.company && plan == o.plan && promo_code == o.promo_code && product == o.product && license_key == o.license_key && == o. && payment_collection_paused == o.payment_collection_paused && checkout_configuration_id == o.checkout_configuration_id && price == o.price && type == o.type && customer_id == o.customer_id end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
611 612 613 614 615 616 617 618 619 620 621 622 623 |
# File 'lib/solifyn/models/subscription.rb', line 611 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 |
#eql?(o) ⇒ Boolean
503 504 505 |
# File 'lib/solifyn/models/subscription.rb', line 503 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
509 510 511 |
# File 'lib/solifyn/models/subscription.rb', line 509 def hash [id, status, created_at, joined_at, updated_at, manage_url, member, user, renewal_period_start, renewal_period_end, cancel_at_period_end, cancel_option, cancellation_reason, canceled_at, currency, company, plan, promo_code, product, license_key, , payment_collection_paused, checkout_configuration_id, price, type, customer_id].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/solifyn/models/subscription.rb', line 340 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @joined_at.nil? invalid_properties.push('invalid value for "joined_at", joined_at cannot be nil.') end if @updated_at.nil? invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.') end if @manage_url.nil? invalid_properties.push('invalid value for "manage_url", manage_url cannot be nil.') end if @member.nil? invalid_properties.push('invalid value for "member", member cannot be nil.') end if @user.nil? invalid_properties.push('invalid value for "user", user cannot be nil.') end if @renewal_period_start.nil? invalid_properties.push('invalid value for "renewal_period_start", renewal_period_start cannot be nil.') end if @renewal_period_end.nil? invalid_properties.push('invalid value for "renewal_period_end", renewal_period_end cannot be nil.') end if @cancel_at_period_end.nil? invalid_properties.push('invalid value for "cancel_at_period_end", cancel_at_period_end cannot be nil.') end if @cancel_option.nil? invalid_properties.push('invalid value for "cancel_option", cancel_option cannot be nil.') end if @cancellation_reason.nil? invalid_properties.push('invalid value for "cancellation_reason", cancellation_reason cannot be nil.') end if @canceled_at.nil? invalid_properties.push('invalid value for "canceled_at", canceled_at cannot be nil.') end if @currency.nil? invalid_properties.push('invalid value for "currency", currency cannot be nil.') end if @company.nil? invalid_properties.push('invalid value for "company", company cannot be nil.') end if @plan.nil? invalid_properties.push('invalid value for "plan", plan cannot be nil.') end if @promo_code.nil? invalid_properties.push('invalid value for "promo_code", promo_code cannot be nil.') end if @product.nil? invalid_properties.push('invalid value for "product", product cannot be nil.') end if @license_key.nil? invalid_properties.push('invalid value for "license_key", license_key cannot be nil.') end if @metadata.nil? invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') end if @payment_collection_paused.nil? invalid_properties.push('invalid value for "payment_collection_paused", payment_collection_paused cannot be nil.') end if @checkout_configuration_id.nil? invalid_properties.push('invalid value for "checkout_configuration_id", checkout_configuration_id cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
587 588 589 |
# File 'lib/solifyn/models/subscription.rb', line 587 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
593 594 595 596 597 598 599 600 601 602 603 604 605 |
# File 'lib/solifyn/models/subscription.rb', line 593 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
581 582 583 |
# File 'lib/solifyn/models/subscription.rb', line 581 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'lib/solifyn/models/subscription.rb', line 440 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @status.nil? return false if @created_at.nil? return false if @joined_at.nil? return false if @updated_at.nil? return false if @manage_url.nil? return false if @member.nil? return false if @user.nil? return false if @renewal_period_start.nil? return false if @renewal_period_end.nil? return false if @cancel_at_period_end.nil? return false if @cancel_option.nil? return false if @cancellation_reason.nil? return false if @canceled_at.nil? return false if @currency.nil? return false if @company.nil? return false if @plan.nil? return false if @promo_code.nil? return false if @product.nil? return false if @license_key.nil? return false if @metadata.nil? return false if @payment_collection_paused.nil? return false if @checkout_configuration_id.nil? true end |