Class: PaypalServerSdk::Subscription
- Defined in:
- lib/paypal_server_sdk/models/subscription.rb
Overview
The subscription details.
Instance Attribute Summary collapse
-
#billing_info ⇒ SubscriptionBillingInformation
The billing details for the subscription.
-
#create_time ⇒ String
The date and time, in Internet date and time format.
-
#custom_id ⇒ String
The custom id for the subscription.
-
#id ⇒ String
The PayPal-generated ID for the subscription.
-
#links ⇒ Array[LinkDescription]
An array of request-related HATEOAS links.
-
#plan ⇒ PlanDetails
The plan details.
-
#plan_id ⇒ String
The ID of the plan.
-
#plan_overridden ⇒ TrueClass | FalseClass
Indicates whether the subscription has overridden any plan attributes.
-
#quantity ⇒ String
The quantity of the product in the subscription.
-
#shipping_amount ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
-
#start_time ⇒ String
The date and time, in Internet date and time format.
-
#status ⇒ SubscriptionStatus
The status of the subscription.
-
#status_change_note ⇒ String
The reason or notes for the status of the subscription.
-
#status_update_time ⇒ String
The date and time, in Internet date and time format.
-
#subscriber ⇒ Subscriber
The subscriber response information.
-
#update_time ⇒ String
The date and time, in Internet date and time format.
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(id: SKIP, plan_id: SKIP, start_time: SKIP, quantity: SKIP, shipping_amount: SKIP, subscriber: SKIP, billing_info: SKIP, create_time: SKIP, update_time: SKIP, custom_id: SKIP, plan_overridden: SKIP, plan: SKIP, links: SKIP, status: SKIP, status_change_note: SKIP, status_update_time: SKIP) ⇒ Subscription
constructor
A new instance of Subscription.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(id: SKIP, plan_id: SKIP, start_time: SKIP, quantity: SKIP, shipping_amount: SKIP, subscriber: SKIP, billing_info: SKIP, create_time: SKIP, update_time: SKIP, custom_id: SKIP, plan_overridden: SKIP, plan: SKIP, links: SKIP, status: SKIP, status_change_note: SKIP, status_update_time: SKIP) ⇒ Subscription
Returns a new instance of Subscription.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 140 def initialize(id: SKIP, plan_id: SKIP, start_time: SKIP, quantity: SKIP, shipping_amount: SKIP, subscriber: SKIP, billing_info: SKIP, create_time: SKIP, update_time: SKIP, custom_id: SKIP, plan_overridden: SKIP, plan: SKIP, links: SKIP, status: SKIP, status_change_note: SKIP, status_update_time: SKIP) @id = id unless id == SKIP @plan_id = plan_id unless plan_id == SKIP @start_time = start_time unless start_time == SKIP @quantity = quantity unless quantity == SKIP @shipping_amount = shipping_amount unless shipping_amount == SKIP @subscriber = subscriber unless subscriber == SKIP @billing_info = billing_info unless billing_info == SKIP @create_time = create_time unless create_time == SKIP @update_time = update_time unless update_time == SKIP @custom_id = custom_id unless custom_id == SKIP @plan_overridden = plan_overridden unless plan_overridden == SKIP @plan = plan unless plan == SKIP @links = links unless links == SKIP @status = status unless status == SKIP @status_change_note = status_change_note unless status_change_note == SKIP @status_update_time = status_update_time unless status_update_time == SKIP end |
Instance Attribute Details
#billing_info ⇒ SubscriptionBillingInformation
The billing details for the subscription. If the subscription was or is active, these fields are populated.
43 44 45 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 43 def billing_info @billing_info end |
#create_time ⇒ String
The date and time, in Internet date and time format. Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.
50 51 52 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 50 def create_time @create_time end |
#custom_id ⇒ String
The custom id for the subscription. Can be invoice id.
61 62 63 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 61 def custom_id @custom_id end |
#id ⇒ String
The PayPal-generated ID for the subscription.
14 15 16 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 14 def id @id end |
#links ⇒ Array[LinkDescription]
An array of request-related HATEOAS links.
74 75 76 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 74 def links @links end |
#plan ⇒ PlanDetails
The plan details.
69 70 71 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 69 def plan @plan end |
#plan_id ⇒ String
The ID of the plan.
18 19 20 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 18 def plan_id @plan_id end |
#plan_overridden ⇒ TrueClass | FalseClass
Indicates whether the subscription has overridden any plan attributes.
65 66 67 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 65 def plan_overridden @plan_overridden end |
#quantity ⇒ String
The quantity of the product in the subscription.
29 30 31 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 29 def quantity @quantity end |
#shipping_amount ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
34 35 36 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 34 def shipping_amount @shipping_amount end |
#start_time ⇒ String
The date and time, in Internet date and time format. Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.
25 26 27 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 25 def start_time @start_time end |
#status ⇒ SubscriptionStatus
The status of the subscription.
78 79 80 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 78 def status @status end |
#status_change_note ⇒ String
The reason or notes for the status of the subscription.
82 83 84 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 82 def status_change_note @status_change_note end |
#status_update_time ⇒ String
The date and time, in Internet date and time format. Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.
89 90 91 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 89 def status_update_time @status_update_time end |
#subscriber ⇒ Subscriber
The subscriber response information.
38 39 40 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 38 def subscriber @subscriber end |
#update_time ⇒ String
The date and time, in Internet date and time format. Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.
57 58 59 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 57 def update_time @update_time end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 164 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP plan_id = hash.key?('plan_id') ? hash['plan_id'] : SKIP start_time = hash.key?('start_time') ? hash['start_time'] : SKIP quantity = hash.key?('quantity') ? hash['quantity'] : SKIP shipping_amount = Money.from_hash(hash['shipping_amount']) if hash['shipping_amount'] subscriber = Subscriber.from_hash(hash['subscriber']) if hash['subscriber'] billing_info = SubscriptionBillingInformation.from_hash(hash['billing_info']) if hash['billing_info'] create_time = hash.key?('create_time') ? hash['create_time'] : SKIP update_time = hash.key?('update_time') ? hash['update_time'] : SKIP custom_id = hash.key?('custom_id') ? hash['custom_id'] : SKIP plan_overridden = hash.key?('plan_overridden') ? hash['plan_overridden'] : SKIP plan = PlanDetails.from_hash(hash['plan']) if hash['plan'] # Parameter is an array, so we need to iterate through it links = nil unless hash['links'].nil? links = [] hash['links'].each do |structure| links << (LinkDescription.from_hash(structure) if structure) end end links = SKIP unless hash.key?('links') status = hash.key?('status') ? hash['status'] : SKIP status_change_note = hash.key?('status_change_note') ? hash['status_change_note'] : SKIP status_update_time = hash.key?('status_update_time') ? hash['status_update_time'] : SKIP # Create object from extracted values. Subscription.new(id: id, plan_id: plan_id, start_time: start_time, quantity: quantity, shipping_amount: shipping_amount, subscriber: subscriber, billing_info: billing_info, create_time: create_time, update_time: update_time, custom_id: custom_id, plan_overridden: plan_overridden, plan: plan, links: links, status: status, status_change_note: status_change_note, status_update_time: status_update_time) end |
.names ⇒ Object
A mapping from model property names to API property names.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 92 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['plan_id'] = 'plan_id' @_hash['start_time'] = 'start_time' @_hash['quantity'] = 'quantity' @_hash['shipping_amount'] = 'shipping_amount' @_hash['subscriber'] = 'subscriber' @_hash['billing_info'] = 'billing_info' @_hash['create_time'] = 'create_time' @_hash['update_time'] = 'update_time' @_hash['custom_id'] = 'custom_id' @_hash['plan_overridden'] = 'plan_overridden' @_hash['plan'] = 'plan' @_hash['links'] = 'links' @_hash['status'] = 'status' @_hash['status_change_note'] = 'status_change_note' @_hash['status_update_time'] = 'status_update_time' @_hash end |
.nullables ⇒ Object
An array for nullable fields
136 137 138 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 136 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 114 def self.optionals %w[ id plan_id start_time quantity shipping_amount subscriber billing_info create_time update_time custom_id plan_overridden plan links status status_change_note status_update_time ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 229 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, plan_id: #{@plan_id.inspect}, start_time:"\ " #{@start_time.inspect}, quantity: #{@quantity.inspect}, shipping_amount:"\ " #{@shipping_amount.inspect}, subscriber: #{@subscriber.inspect}, billing_info:"\ " #{@billing_info.inspect}, create_time: #{@create_time.inspect}, update_time:"\ " #{@update_time.inspect}, custom_id: #{@custom_id.inspect}, plan_overridden:"\ " #{@plan_overridden.inspect}, plan: #{@plan.inspect}, links: #{@links.inspect}, status:"\ " #{@status.inspect}, status_change_note: #{@status_change_note.inspect},"\ " status_update_time: #{@status_update_time.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
218 219 220 221 222 223 224 225 226 |
# File 'lib/paypal_server_sdk/models/subscription.rb', line 218 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, plan_id: #{@plan_id}, start_time: #{@start_time}, quantity:"\ " #{@quantity}, shipping_amount: #{@shipping_amount}, subscriber: #{@subscriber},"\ " billing_info: #{@billing_info}, create_time: #{@create_time}, update_time:"\ " #{@update_time}, custom_id: #{@custom_id}, plan_overridden: #{@plan_overridden}, plan:"\ " #{@plan}, links: #{@links}, status: #{@status}, status_change_note:"\ " #{@status_change_note}, status_update_time: #{@status_update_time}>" end |