Class: Mudbase::PaymentSubscription
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Mudbase::PaymentSubscription
- Defined in:
- lib/mudbase/models/payment_subscription.rb
Overview
Subscription record (id, plan, status, currentPeriodEnd, etc.).
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#_id ⇒ Object
Returns the value of attribute _id.
-
#amount ⇒ Object
Subscription amount.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#early_payment_allowed ⇒ Object
Returns the value of attribute early_payment_allowed.
-
#grace_period_days ⇒ Object
Grace period in days.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#late_payment_allowed ⇒ Object
Returns the value of attribute late_payment_allowed.
-
#merchant ⇒ Object
Merchant ID.
-
#network ⇒ Object
Returns the value of attribute network.
-
#next_payment_at ⇒ Object
Next payment due date.
-
#project ⇒ Object
Project ID.
-
#proration_enabled ⇒ Object
Returns the value of attribute proration_enabled.
-
#status ⇒ Object
Returns the value of attribute status.
-
#token ⇒ Object
Returns the value of attribute token.
-
#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 = {}) ⇒ PaymentSubscription
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 = {}) ⇒ PaymentSubscription
Initializes the object
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 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 |
# File 'lib/mudbase/models/payment_subscription.rb', line 136 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Mudbase::PaymentSubscription` 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 `Mudbase::PaymentSubscription`. 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?(:'_id') self._id = attributes[:'_id'] end if attributes.key?(:'merchant') self.merchant = attributes[:'merchant'] end if attributes.key?(:'project') self.project = attributes[:'project'] end if attributes.key?(:'amount') self.amount = attributes[:'amount'] end if attributes.key?(:'interval') self.interval = attributes[:'interval'] end if attributes.key?(:'network') self.network = attributes[:'network'] end if attributes.key?(:'token') self.token = attributes[:'token'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'next_payment_at') self.next_payment_at = attributes[:'next_payment_at'] end if attributes.key?(:'grace_period_days') self.grace_period_days = attributes[:'grace_period_days'] else self.grace_period_days = 3 end if attributes.key?(:'early_payment_allowed') self.early_payment_allowed = attributes[:'early_payment_allowed'] else self.early_payment_allowed = true end if attributes.key?(:'late_payment_allowed') self.late_payment_allowed = attributes[:'late_payment_allowed'] else self.late_payment_allowed = true end if attributes.key?(:'proration_enabled') self.proration_enabled = attributes[:'proration_enabled'] else self.proration_enabled = false end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] end end |
Instance Attribute Details
#_id ⇒ Object
Returns the value of attribute _id.
19 20 21 |
# File 'lib/mudbase/models/payment_subscription.rb', line 19 def _id @_id end |
#amount ⇒ Object
Subscription amount
28 29 30 |
# File 'lib/mudbase/models/payment_subscription.rb', line 28 def amount @amount end |
#created_at ⇒ Object
Returns the value of attribute created_at.
50 51 52 |
# File 'lib/mudbase/models/payment_subscription.rb', line 50 def created_at @created_at end |
#early_payment_allowed ⇒ Object
Returns the value of attribute early_payment_allowed.
44 45 46 |
# File 'lib/mudbase/models/payment_subscription.rb', line 44 def early_payment_allowed @early_payment_allowed end |
#grace_period_days ⇒ Object
Grace period in days
42 43 44 |
# File 'lib/mudbase/models/payment_subscription.rb', line 42 def grace_period_days @grace_period_days end |
#interval ⇒ Object
Returns the value of attribute interval.
30 31 32 |
# File 'lib/mudbase/models/payment_subscription.rb', line 30 def interval @interval end |
#late_payment_allowed ⇒ Object
Returns the value of attribute late_payment_allowed.
46 47 48 |
# File 'lib/mudbase/models/payment_subscription.rb', line 46 def late_payment_allowed @late_payment_allowed end |
#merchant ⇒ Object
Merchant ID
22 23 24 |
# File 'lib/mudbase/models/payment_subscription.rb', line 22 def merchant @merchant end |
#network ⇒ Object
Returns the value of attribute network.
32 33 34 |
# File 'lib/mudbase/models/payment_subscription.rb', line 32 def network @network end |
#next_payment_at ⇒ Object
Next payment due date
39 40 41 |
# File 'lib/mudbase/models/payment_subscription.rb', line 39 def next_payment_at @next_payment_at end |
#project ⇒ Object
Project ID
25 26 27 |
# File 'lib/mudbase/models/payment_subscription.rb', line 25 def project @project end |
#proration_enabled ⇒ Object
Returns the value of attribute proration_enabled.
48 49 50 |
# File 'lib/mudbase/models/payment_subscription.rb', line 48 def proration_enabled @proration_enabled end |
#status ⇒ Object
Returns the value of attribute status.
36 37 38 |
# File 'lib/mudbase/models/payment_subscription.rb', line 36 def status @status end |
#token ⇒ Object
Returns the value of attribute token.
34 35 36 |
# File 'lib/mudbase/models/payment_subscription.rb', line 34 def token @token end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
52 53 54 |
# File 'lib/mudbase/models/payment_subscription.rb', line 52 def updated_at @updated_at end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
98 99 100 |
# File 'lib/mudbase/models/payment_subscription.rb', line 98 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
103 104 105 |
# File 'lib/mudbase/models/payment_subscription.rb', line 103 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/mudbase/models/payment_subscription.rb', line 77 def self.attribute_map { :'_id' => :'_id', :'merchant' => :'merchant', :'project' => :'project', :'amount' => :'amount', :'interval' => :'interval', :'network' => :'network', :'token' => :'token', :'status' => :'status', :'next_payment_at' => :'nextPaymentAt', :'grace_period_days' => :'gracePeriodDays', :'early_payment_allowed' => :'earlyPaymentAllowed', :'late_payment_allowed' => :'latePaymentAllowed', :'proration_enabled' => :'prorationEnabled', :'created_at' => :'createdAt', :'updated_at' => :'updatedAt' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/mudbase/models/payment_subscription.rb', line 319 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
129 130 131 132 |
# File 'lib/mudbase/models/payment_subscription.rb', line 129 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/mudbase/models/payment_subscription.rb', line 108 def self.openapi_types { :'_id' => :'String', :'merchant' => :'String', :'project' => :'String', :'amount' => :'Float', :'interval' => :'String', :'network' => :'String', :'token' => :'String', :'status' => :'String', :'next_payment_at' => :'Time', :'grace_period_days' => :'Integer', :'early_payment_allowed' => :'Boolean', :'late_payment_allowed' => :'Boolean', :'proration_enabled' => :'Boolean', :'created_at' => :'Time', :'updated_at' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/mudbase/models/payment_subscription.rb', line 284 def ==(o) return true if self.equal?(o) self.class == o.class && _id == o._id && merchant == o.merchant && project == o.project && amount == o.amount && interval == o.interval && network == o.network && token == o.token && status == o.status && next_payment_at == o.next_payment_at && grace_period_days == o.grace_period_days && early_payment_allowed == o.early_payment_allowed && late_payment_allowed == o.late_payment_allowed && proration_enabled == o.proration_enabled && created_at == o.created_at && updated_at == o.updated_at end |
#eql?(o) ⇒ Boolean
306 307 308 |
# File 'lib/mudbase/models/payment_subscription.rb', line 306 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
312 313 314 |
# File 'lib/mudbase/models/payment_subscription.rb', line 312 def hash [_id, merchant, project, amount, interval, network, token, status, next_payment_at, grace_period_days, early_payment_allowed, late_payment_allowed, proration_enabled, created_at, updated_at].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
221 222 223 224 225 |
# File 'lib/mudbase/models/payment_subscription.rb', line 221 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/mudbase/models/payment_subscription.rb', line 341 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
229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/mudbase/models/payment_subscription.rb', line 229 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' interval_validator = EnumAttributeValidator.new('String', ["month", "year"]) return false unless interval_validator.valid?(@interval) network_validator = EnumAttributeValidator.new('String', ["polygon", "arbitrum", "tron", "solana", "lightning", "ton"]) return false unless network_validator.valid?(@network) token_validator = EnumAttributeValidator.new('String', ["USDC", "USDT", "BTC"]) return false unless token_validator.valid?(@token) status_validator = EnumAttributeValidator.new('String', ["active", "paused", "cancelled", "expired"]) return false unless status_validator.valid?(@status) true end |