Class: AdvancedBilling::SubscriptionIncludedCoupon
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::SubscriptionIncludedCoupon
- Defined in:
- lib/advanced_billing/models/subscription_included_coupon.rb
Overview
SubscriptionIncludedCoupon Model.
Instance Attribute Summary collapse
-
#amount_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#code ⇒ String
TODO: Write general description for this method.
-
#expires_at ⇒ String
TODO: Write general description for this method.
-
#percentage ⇒ String
TODO: Write general description for this method.
-
#recurring ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#use_count ⇒ Integer
TODO: Write general description for this method.
-
#uses_allowed ⇒ Integer
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(code: SKIP, use_count: SKIP, uses_allowed: SKIP, expires_at: SKIP, recurring: SKIP, amount_in_cents: SKIP, percentage: SKIP, additional_properties: {}) ⇒ SubscriptionIncludedCoupon
constructor
A new instance of SubscriptionIncludedCoupon.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(code: SKIP, use_count: SKIP, uses_allowed: SKIP, expires_at: SKIP, recurring: SKIP, amount_in_cents: SKIP, percentage: SKIP, additional_properties: {}) ⇒ SubscriptionIncludedCoupon
Returns a new instance of SubscriptionIncludedCoupon.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/advanced_billing/models/subscription_included_coupon.rb', line 75 def initialize(code: SKIP, use_count: SKIP, uses_allowed: SKIP, expires_at: SKIP, recurring: SKIP, amount_in_cents: SKIP, percentage: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @code = code unless code == SKIP @use_count = use_count unless use_count == SKIP @uses_allowed = uses_allowed unless uses_allowed == SKIP @expires_at = expires_at unless expires_at == SKIP @recurring = recurring unless recurring == SKIP @amount_in_cents = amount_in_cents unless amount_in_cents == SKIP @percentage = percentage unless percentage == SKIP end |
Instance Attribute Details
#amount_in_cents ⇒ Integer
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/subscription_included_coupon.rb', line 34 def amount_in_cents @amount_in_cents end |
#code ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/subscription_included_coupon.rb', line 14 def code @code end |
#expires_at ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/subscription_included_coupon.rb', line 26 def expires_at @expires_at end |
#percentage ⇒ String
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/subscription_included_coupon.rb', line 38 def percentage @percentage end |
#recurring ⇒ TrueClass | FalseClass
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/subscription_included_coupon.rb', line 30 def recurring @recurring end |
#use_count ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/subscription_included_coupon.rb', line 18 def use_count @use_count end |
#uses_allowed ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/subscription_included_coupon.rb', line 22 def uses_allowed @uses_allowed end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/advanced_billing/models/subscription_included_coupon.rb', line 93 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. code = hash.key?('code') ? hash['code'] : SKIP use_count = hash.key?('use_count') ? hash['use_count'] : SKIP uses_allowed = hash.key?('uses_allowed') ? hash['uses_allowed'] : SKIP expires_at = hash.key?('expires_at') ? hash['expires_at'] : SKIP recurring = hash.key?('recurring') ? hash['recurring'] : SKIP amount_in_cents = hash.key?('amount_in_cents') ? hash['amount_in_cents'] : SKIP percentage = hash.key?('percentage') ? hash['percentage'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. SubscriptionIncludedCoupon.new(code: code, use_count: use_count, uses_allowed: uses_allowed, expires_at: expires_at, recurring: recurring, amount_in_cents: amount_in_cents, percentage: percentage, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/advanced_billing/models/subscription_included_coupon.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['code'] = 'code' @_hash['use_count'] = 'use_count' @_hash['uses_allowed'] = 'uses_allowed' @_hash['expires_at'] = 'expires_at' @_hash['recurring'] = 'recurring' @_hash['amount_in_cents'] = 'amount_in_cents' @_hash['percentage'] = 'percentage' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 70 71 72 73 |
# File 'lib/advanced_billing/models/subscription_included_coupon.rb', line 67 def self.nullables %w[ expires_at amount_in_cents percentage ] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/advanced_billing/models/subscription_included_coupon.rb', line 54 def self.optionals %w[ code use_count uses_allowed expires_at recurring amount_in_cents percentage ] end |