Class: PaypalServerSdk::ModifySubscriptionResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::ModifySubscriptionResponse
- Defined in:
- lib/paypal_server_sdk/models/modify_subscription_response.rb
Overview
The response to a request to update the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the ‘shipping_amount` and `shipping_address` values for the subscription. This type of update requires the buyer’s consent.
Instance Attribute Summary collapse
-
#links ⇒ Array[LinkDescription]
An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).
-
#plan ⇒ PlanOverride
An inline plan object to customise the subscription.
-
#plan_id ⇒ String
The unique PayPal-generated ID for the plan.
-
#plan_overridden ⇒ TrueClass | FalseClass
Indicates whether the subscription has overridden any plan attributes.
-
#quantity ⇒ String
The quantity of the product or service in the subscription.
-
#shipping_address ⇒ ShippingDetails
The shipping details.
-
#shipping_amount ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
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(plan_id: SKIP, quantity: SKIP, shipping_amount: SKIP, shipping_address: SKIP, plan: SKIP, plan_overridden: SKIP, links: SKIP) ⇒ ModifySubscriptionResponse
constructor
A new instance of ModifySubscriptionResponse.
-
#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(plan_id: SKIP, quantity: SKIP, shipping_amount: SKIP, shipping_address: SKIP, plan: SKIP, plan_overridden: SKIP, links: SKIP) ⇒ ModifySubscriptionResponse
Returns a new instance of ModifySubscriptionResponse.
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 78 def initialize(plan_id: SKIP, quantity: SKIP, shipping_amount: SKIP, shipping_address: SKIP, plan: SKIP, plan_overridden: SKIP, links: SKIP) @plan_id = plan_id unless plan_id == SKIP @quantity = quantity unless quantity == SKIP @shipping_amount = shipping_amount unless shipping_amount == SKIP @shipping_address = shipping_address unless shipping_address == SKIP @plan = plan unless plan == SKIP @plan_overridden = plan_overridden unless plan_overridden == SKIP @links = links unless links == SKIP end |
Instance Attribute Details
#links ⇒ Array[LinkDescription]
An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).
45 46 47 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 45 def links @links end |
#plan ⇒ PlanOverride
An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object.
36 37 38 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 36 def plan @plan end |
#plan_id ⇒ String
The unique PayPal-generated ID for the plan.
17 18 19 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 17 def plan_id @plan_id end |
#plan_overridden ⇒ TrueClass | FalseClass
Indicates whether the subscription has overridden any plan attributes.
40 41 42 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 40 def plan_overridden @plan_overridden end |
#quantity ⇒ String
The quantity of the product or service in the subscription.
21 22 23 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 21 def quantity @quantity end |
#shipping_address ⇒ ShippingDetails
The shipping details.
30 31 32 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 30 def shipping_address @shipping_address end |
#shipping_amount ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
26 27 28 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 26 def shipping_amount @shipping_amount end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
91 92 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 119 120 121 122 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 91 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. plan_id = hash.key?('plan_id') ? hash['plan_id'] : SKIP quantity = hash.key?('quantity') ? hash['quantity'] : SKIP shipping_amount = Money.from_hash(hash['shipping_amount']) if hash['shipping_amount'] shipping_address = ShippingDetails.from_hash(hash['shipping_address']) if hash['shipping_address'] plan = PlanOverride.from_hash(hash['plan']) if hash['plan'] plan_overridden = hash.key?('plan_overridden') ? hash['plan_overridden'] : SKIP # 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') # Create object from extracted values. ModifySubscriptionResponse.new(plan_id: plan_id, quantity: quantity, shipping_amount: shipping_amount, shipping_address: shipping_address, plan: plan, plan_overridden: plan_overridden, links: links) end |
.names ⇒ Object
A mapping from model property names to API property names.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 48 def self.names @_hash = {} if @_hash.nil? @_hash['plan_id'] = 'plan_id' @_hash['quantity'] = 'quantity' @_hash['shipping_amount'] = 'shipping_amount' @_hash['shipping_address'] = 'shipping_address' @_hash['plan'] = 'plan' @_hash['plan_overridden'] = 'plan_overridden' @_hash['links'] = 'links' @_hash end |
.nullables ⇒ Object
An array for nullable fields
74 75 76 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 74 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 61 def self.optionals %w[ plan_id quantity shipping_amount shipping_address plan plan_overridden links ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
133 134 135 136 137 138 139 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 133 def inspect class_name = self.class.name.split('::').last "<#{class_name} plan_id: #{@plan_id.inspect}, quantity: #{@quantity.inspect},"\ " shipping_amount: #{@shipping_amount.inspect}, shipping_address:"\ " #{@shipping_address.inspect}, plan: #{@plan.inspect}, plan_overridden:"\ " #{@plan_overridden.inspect}, links: #{@links.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
125 126 127 128 129 130 |
# File 'lib/paypal_server_sdk/models/modify_subscription_response.rb', line 125 def to_s class_name = self.class.name.split('::').last "<#{class_name} plan_id: #{@plan_id}, quantity: #{@quantity}, shipping_amount:"\ " #{@shipping_amount}, shipping_address: #{@shipping_address}, plan: #{@plan},"\ " plan_overridden: #{@plan_overridden}, links: #{@links}>" end |