Class: OryClient::Subscription
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- OryClient::Subscription
- Defined in:
- lib/ory-client/models/subscription.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#currency ⇒ Object
The currency of the subscription.
-
#current_interval ⇒ Object
The currently active interval of the subscription monthly Monthly yearly Yearly.
-
#current_plan ⇒ Object
The currently active plan of the subscription.
-
#current_plan_details ⇒ Object
Returns the value of attribute current_plan_details.
-
#customer_id ⇒ Object
The ID of the stripe customer.
-
#id ⇒ Object
The ID of the subscription.
-
#interval_changes_to ⇒ Object
Returns the value of attribute interval_changes_to.
-
#ongoing_stripe_checkout_id ⇒ Object
Returns the value of attribute ongoing_stripe_checkout_id.
-
#payed_until ⇒ Object
Until when the subscription is payed.
-
#plan_changes_at ⇒ Object
Returns the value of attribute plan_changes_at.
-
#plan_changes_to ⇒ Object
Returns the value of attribute plan_changes_to.
-
#status ⇒ Object
For ‘collection_method=charge_automatically` a subscription moves into
incompleteif the initial payment attempt fails. -
#stripe_checkout_expires_at ⇒ Object
Returns the value of attribute stripe_checkout_expires_at.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.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.
- #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_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Subscription
Initializes the object
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 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 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 |
# File 'lib/ory-client/models/subscription.rb', line 140 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OryClient::Subscription` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OryClient::Subscription`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] else self.created_at = nil end if attributes.key?(:'currency') self.currency = attributes[:'currency'] else self.currency = nil end if attributes.key?(:'current_interval') self.current_interval = attributes[:'current_interval'] else self.current_interval = nil end if attributes.key?(:'current_plan') self.current_plan = attributes[:'current_plan'] else self.current_plan = nil end if attributes.key?(:'current_plan_details') self.current_plan_details = attributes[:'current_plan_details'] end if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] else self.customer_id = nil end if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'interval_changes_to') self.interval_changes_to = attributes[:'interval_changes_to'] else self.interval_changes_to = nil end if attributes.key?(:'ongoing_stripe_checkout_id') self.ongoing_stripe_checkout_id = attributes[:'ongoing_stripe_checkout_id'] end if attributes.key?(:'payed_until') self.payed_until = attributes[:'payed_until'] else self.payed_until = nil end if attributes.key?(:'plan_changes_at') self.plan_changes_at = attributes[:'plan_changes_at'] end if attributes.key?(:'plan_changes_to') self.plan_changes_to = attributes[:'plan_changes_to'] else self.plan_changes_to = nil end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = nil end if attributes.key?(:'stripe_checkout_expires_at') self.stripe_checkout_expires_at = attributes[:'stripe_checkout_expires_at'] end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] else self.updated_at = nil end end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
18 19 20 |
# File 'lib/ory-client/models/subscription.rb', line 18 def created_at @created_at end |
#currency ⇒ Object
The currency of the subscription. To change this, a new subscription must be created. usd USD eur Euro
21 22 23 |
# File 'lib/ory-client/models/subscription.rb', line 21 def currency @currency end |
#current_interval ⇒ Object
The currently active interval of the subscription monthly Monthly yearly Yearly
24 25 26 |
# File 'lib/ory-client/models/subscription.rb', line 24 def current_interval @current_interval end |
#current_plan ⇒ Object
The currently active plan of the subscription
27 28 29 |
# File 'lib/ory-client/models/subscription.rb', line 27 def current_plan @current_plan end |
#current_plan_details ⇒ Object
Returns the value of attribute current_plan_details.
29 30 31 |
# File 'lib/ory-client/models/subscription.rb', line 29 def current_plan_details @current_plan_details end |
#customer_id ⇒ Object
The ID of the stripe customer
32 33 34 |
# File 'lib/ory-client/models/subscription.rb', line 32 def customer_id @customer_id end |
#id ⇒ Object
The ID of the subscription
35 36 37 |
# File 'lib/ory-client/models/subscription.rb', line 35 def id @id end |
#interval_changes_to ⇒ Object
Returns the value of attribute interval_changes_to.
37 38 39 |
# File 'lib/ory-client/models/subscription.rb', line 37 def interval_changes_to @interval_changes_to end |
#ongoing_stripe_checkout_id ⇒ Object
Returns the value of attribute ongoing_stripe_checkout_id.
39 40 41 |
# File 'lib/ory-client/models/subscription.rb', line 39 def ongoing_stripe_checkout_id @ongoing_stripe_checkout_id end |
#payed_until ⇒ Object
Until when the subscription is payed
42 43 44 |
# File 'lib/ory-client/models/subscription.rb', line 42 def payed_until @payed_until end |
#plan_changes_at ⇒ Object
Returns the value of attribute plan_changes_at.
44 45 46 |
# File 'lib/ory-client/models/subscription.rb', line 44 def plan_changes_at @plan_changes_at end |
#plan_changes_to ⇒ Object
Returns the value of attribute plan_changes_to.
46 47 48 |
# File 'lib/ory-client/models/subscription.rb', line 46 def plan_changes_to @plan_changes_to end |
#status ⇒ Object
For ‘collection_method=charge_automatically` a subscription moves into incomplete if the initial payment attempt fails. A subscription in this status can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an active status. If the first invoice is not paid within 23 hours, the subscription transitions to incomplete_expired. This is a terminal status, the open invoice will be voided and no further invoices will be generated. A subscription that is currently in a trial period is trialing and moves to active when the trial period is over. A subscription can only enter a paused status [when a trial ends without a payment method](stripe.com/billing/subscriptions/trials#create-free-trials-without-payment). A paused subscription doesn’t generate invoices and can be resumed after your customer adds their payment method. The paused status is different from [pausing collection](stripe.com/billing/subscriptions/pause-payment), which still generates invoices and leaves the subscription’s status unchanged. If subscription ‘collection_method=charge_automatically`, it becomes past_due when payment is required but cannot be paid (due to failed payment or awaiting additional user actions). Once Stripe has exhausted all payment retry attempts, the subscription will become canceled or unpaid (depending on your subscriptions settings). If subscription `collection_method=send_invoice` it becomes past_due when its invoice is not paid by the due date, and canceled or unpaid if it is still not paid by an additional deadline after that. Note that when a subscription has a status of unpaid, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.
49 50 51 |
# File 'lib/ory-client/models/subscription.rb', line 49 def status @status end |
#stripe_checkout_expires_at ⇒ Object
Returns the value of attribute stripe_checkout_expires_at.
51 52 53 |
# File 'lib/ory-client/models/subscription.rb', line 51 def stripe_checkout_expires_at @stripe_checkout_expires_at end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
53 54 55 |
# File 'lib/ory-client/models/subscription.rb', line 53 def updated_at @updated_at end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
99 100 101 |
# File 'lib/ory-client/models/subscription.rb', line 99 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
104 105 106 |
# File 'lib/ory-client/models/subscription.rb', line 104 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/ory-client/models/subscription.rb', line 78 def self.attribute_map { :'created_at' => :'created_at', :'currency' => :'currency', :'current_interval' => :'current_interval', :'current_plan' => :'current_plan', :'current_plan_details' => :'current_plan_details', :'customer_id' => :'customer_id', :'id' => :'id', :'interval_changes_to' => :'interval_changes_to', :'ongoing_stripe_checkout_id' => :'ongoing_stripe_checkout_id', :'payed_until' => :'payed_until', :'plan_changes_at' => :'plan_changes_at', :'plan_changes_to' => :'plan_changes_to', :'status' => :'status', :'stripe_checkout_expires_at' => :'stripe_checkout_expires_at', :'updated_at' => :'updated_at' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
# File 'lib/ory-client/models/subscription.rb', line 428 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
130 131 132 133 134 135 136 |
# File 'lib/ory-client/models/subscription.rb', line 130 def self.openapi_nullable Set.new([ :'interval_changes_to', :'ongoing_stripe_checkout_id', :'plan_changes_to', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/ory-client/models/subscription.rb', line 109 def self.openapi_types { :'created_at' => :'Time', :'currency' => :'String', :'current_interval' => :'String', :'current_plan' => :'String', :'current_plan_details' => :'PlanDetails', :'customer_id' => :'String', :'id' => :'String', :'interval_changes_to' => :'String', :'ongoing_stripe_checkout_id' => :'String', :'payed_until' => :'Time', :'plan_changes_at' => :'Time', :'plan_changes_to' => :'String', :'status' => :'String', :'stripe_checkout_expires_at' => :'Time', :'updated_at' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/ory-client/models/subscription.rb', line 393 def ==(o) return true if self.equal?(o) self.class == o.class && created_at == o.created_at && currency == o.currency && current_interval == o.current_interval && current_plan == o.current_plan && current_plan_details == o.current_plan_details && customer_id == o.customer_id && id == o.id && interval_changes_to == o.interval_changes_to && ongoing_stripe_checkout_id == o.ongoing_stripe_checkout_id && payed_until == o.payed_until && plan_changes_at == o.plan_changes_at && plan_changes_to == o.plan_changes_to && status == o.status && stripe_checkout_expires_at == o.stripe_checkout_expires_at && updated_at == o.updated_at end |
#eql?(o) ⇒ Boolean
415 416 417 |
# File 'lib/ory-client/models/subscription.rb', line 415 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
421 422 423 |
# File 'lib/ory-client/models/subscription.rb', line 421 def hash [created_at, currency, current_interval, current_plan, current_plan_details, customer_id, id, interval_changes_to, ongoing_stripe_checkout_id, payed_until, plan_changes_at, plan_changes_to, status, stripe_checkout_expires_at, updated_at].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/ory-client/models/subscription.rb', line 239 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @currency.nil? invalid_properties.push('invalid value for "currency", currency cannot be nil.') end if @current_interval.nil? invalid_properties.push('invalid value for "current_interval", current_interval cannot be nil.') end if @current_plan.nil? invalid_properties.push('invalid value for "current_plan", current_plan cannot be nil.') end if @customer_id.nil? invalid_properties.push('invalid value for "customer_id", customer_id cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @payed_until.nil? invalid_properties.push('invalid value for "payed_until", payed_until cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @updated_at.nil? invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
450 451 452 453 454 455 456 457 458 459 460 461 462 |
# File 'lib/ory-client/models/subscription.rb', line 450 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 |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/ory-client/models/subscription.rb', line 283 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @created_at.nil? return false if @currency.nil? currency_validator = EnumAttributeValidator.new('String', ["usd", "eur"]) return false unless currency_validator.valid?(@currency) return false if @current_interval.nil? current_interval_validator = EnumAttributeValidator.new('String', ["monthly", "yearly"]) return false unless current_interval_validator.valid?(@current_interval) return false if @current_plan.nil? return false if @customer_id.nil? return false if @id.nil? return false if @payed_until.nil? return false if @status.nil? return false if @updated_at.nil? true end |