Class: Cryptopay::SubscriptionParams
- Inherits:
-
Object
- Object
- Cryptopay::SubscriptionParams
- Defined in:
- lib/cryptopay/models/subscription_params.rb
Class Method Summary collapse
-
.build_from_hash(data) ⇒ Cryptopay::SubscriptionParams
Builds the object from hash.
Instance Method Summary collapse
-
#amount ⇒ Object
Subscription amount.
-
#currency ⇒ Object
Subscription amount currency.
-
#custom_id ⇒ Object
Subscription reference ID in your system.
-
#initialize(attributes = {}) ⇒ SubscriptionParams
constructor
Initializes the object.
- #inspect ⇒ Object
-
#invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#name ⇒ Object
Subscription name.
-
#payer_email ⇒ Object
Email of the payer.
-
#payer_name ⇒ Object
Name of the payer.
- #period ⇒ Object
- #period_quantity ⇒ Object
- #product_description ⇒ Object
- #product_name ⇒ Object
- #starts_at ⇒ Object
-
#success_redirect_url ⇒ Object
The URL that the customer will be redirected to upon transaction confirmation.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
- #unsuccess_redirect_url ⇒ Object
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ SubscriptionParams
Initializes the object
54 55 56 |
# File 'lib/cryptopay/models/subscription_params.rb', line 54 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::SubscriptionParams
Builds the object from hash
47 48 49 50 |
# File 'lib/cryptopay/models/subscription_params.rb', line 47 def self.build_from_hash(data) attributes = ENCODER.build_from_hash(data) new(attributes) end |
Instance Method Details
#amount ⇒ Object
Subscription amount
64 65 66 |
# File 'lib/cryptopay/models/subscription_params.rb', line 64 def amount @attributes[:amount] end |
#currency ⇒ Object
Subscription amount currency
69 70 71 |
# File 'lib/cryptopay/models/subscription_params.rb', line 69 def currency @attributes[:currency] end |
#custom_id ⇒ Object
Subscription reference ID in your system
96 97 98 |
# File 'lib/cryptopay/models/subscription_params.rb', line 96 def custom_id @attributes[:custom_id] end |
#inspect ⇒ Object
155 156 157 |
# File 'lib/cryptopay/models/subscription_params.rb', line 155 def inspect "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash) end |
#invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/cryptopay/models/subscription_params.rb', line 119 def invalid_properties properties = [] properties.push('invalid value for "name", name cannot be nil.') if name.nil? properties.push('invalid value for "amount", amount cannot be nil.') if amount.nil? properties.push('invalid value for "currency", currency cannot be nil.') if currency.nil? properties.push('invalid value for "period", period cannot be nil.') if period.nil? if !period.nil? && !%w[day week month year].include?(period) properties.push('invalid value for period, must be one of "day", "week", "month", "year"') end properties.push('invalid value for "period_quantity", period_quantity cannot be nil.') if period_quantity.nil? properties.push('invalid value for "starts_at", starts_at cannot be nil.') if starts_at.nil? properties.push('invalid value for "payer_email", payer_email cannot be nil.') if payer_email.nil? properties end |
#name ⇒ Object
Subscription name
59 60 61 |
# File 'lib/cryptopay/models/subscription_params.rb', line 59 def name @attributes[:name] end |
#payer_email ⇒ Object
Email of the payer
86 87 88 |
# File 'lib/cryptopay/models/subscription_params.rb', line 86 def payer_email @attributes[:payer_email] end |
#payer_name ⇒ Object
Name of the payer
91 92 93 |
# File 'lib/cryptopay/models/subscription_params.rb', line 91 def payer_name @attributes[:payer_name] end |
#period ⇒ Object
73 74 75 |
# File 'lib/cryptopay/models/subscription_params.rb', line 73 def period @attributes[:period] end |
#period_quantity ⇒ Object
77 78 79 |
# File 'lib/cryptopay/models/subscription_params.rb', line 77 def period_quantity @attributes[:period_quantity] end |
#product_description ⇒ Object
104 105 106 |
# File 'lib/cryptopay/models/subscription_params.rb', line 104 def product_description @attributes[:product_description] end |
#product_name ⇒ Object
100 101 102 |
# File 'lib/cryptopay/models/subscription_params.rb', line 100 def product_name @attributes[:product_name] end |
#starts_at ⇒ Object
81 82 83 |
# File 'lib/cryptopay/models/subscription_params.rb', line 81 def starts_at @attributes[:starts_at] end |
#success_redirect_url ⇒ Object
The URL that the customer will be redirected to upon transaction confirmation
109 110 111 |
# File 'lib/cryptopay/models/subscription_params.rb', line 109 def success_redirect_url @attributes[:success_redirect_url] end |
#to_hash ⇒ Hash
Returns the object in the form of hash
151 152 153 |
# File 'lib/cryptopay/models/subscription_params.rb', line 151 def to_hash ENCODER.to_hash(@attributes) end |
#unsuccess_redirect_url ⇒ Object
113 114 115 |
# File 'lib/cryptopay/models/subscription_params.rb', line 113 def unsuccess_redirect_url @attributes[:unsuccess_redirect_url] end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
145 146 147 |
# File 'lib/cryptopay/models/subscription_params.rb', line 145 def valid? invalid_properties.empty? end |