Class: PaypalServerSdk::ModifySubscriptionRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::ModifySubscriptionRequest
- Defined in:
- lib/paypal_server_sdk/models/modify_subscription_request.rb
Overview
The 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
-
#application_context ⇒ SubscriptionPatchApplicationContext
The application context, which customizes the payer experience during the subscription approval process with PayPal.
-
#plan ⇒ PlanOverride
An inline plan object to customise the subscription.
-
#plan_id ⇒ String
The unique PayPal-generated ID for the plan.
-
#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, application_context: SKIP, plan: SKIP) ⇒ ModifySubscriptionRequest
constructor
A new instance of ModifySubscriptionRequest.
-
#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, application_context: SKIP, plan: SKIP) ⇒ ModifySubscriptionRequest
Returns a new instance of ModifySubscriptionRequest.
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/paypal_server_sdk/models/modify_subscription_request.rb', line 72 def initialize(plan_id: SKIP, quantity: SKIP, shipping_amount: SKIP, shipping_address: SKIP, application_context: SKIP, plan: 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 @application_context = application_context unless application_context == SKIP @plan = plan unless plan == SKIP end |
Instance Attribute Details
#application_context ⇒ SubscriptionPatchApplicationContext
The application context, which customizes the payer experience during the subscription approval process with PayPal.
35 36 37 |
# File 'lib/paypal_server_sdk/models/modify_subscription_request.rb', line 35 def application_context @application_context 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.
41 42 43 |
# File 'lib/paypal_server_sdk/models/modify_subscription_request.rb', line 41 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_request.rb', line 17 def plan_id @plan_id end |
#quantity ⇒ String
The quantity of the product or service in the subscription.
21 22 23 |
# File 'lib/paypal_server_sdk/models/modify_subscription_request.rb', line 21 def quantity @quantity end |
#shipping_address ⇒ ShippingDetails
The shipping details.
30 31 32 |
# File 'lib/paypal_server_sdk/models/modify_subscription_request.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_request.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.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/paypal_server_sdk/models/modify_subscription_request.rb', line 84 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'] if hash['application_context'] application_context = SubscriptionPatchApplicationContext.from_hash(hash['application_context']) end plan = PlanOverride.from_hash(hash['plan']) if hash['plan'] # Create object from extracted values. ModifySubscriptionRequest.new(plan_id: plan_id, quantity: quantity, shipping_amount: shipping_amount, shipping_address: shipping_address, application_context: application_context, plan: plan) end |
.names ⇒ Object
A mapping from model property names to API property names.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/paypal_server_sdk/models/modify_subscription_request.rb', line 44 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['application_context'] = 'application_context' @_hash['plan'] = 'plan' @_hash end |
.nullables ⇒ Object
An array for nullable fields
68 69 70 |
# File 'lib/paypal_server_sdk/models/modify_subscription_request.rb', line 68 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/paypal_server_sdk/models/modify_subscription_request.rb', line 56 def self.optionals %w[ plan_id quantity shipping_amount shipping_address application_context plan ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
116 117 118 119 120 121 122 |
# File 'lib/paypal_server_sdk/models/modify_subscription_request.rb', line 116 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}, application_context: #{@application_context.inspect}, plan:"\ " #{@plan.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
108 109 110 111 112 113 |
# File 'lib/paypal_server_sdk/models/modify_subscription_request.rb', line 108 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}, application_context:"\ " #{@application_context}, plan: #{@plan}>" end |