Class: PaypalServerSdk::CreateSubscriptionRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::CreateSubscriptionRequest
- Defined in:
- lib/paypal_server_sdk/models/create_subscription_request.rb
Overview
The create subscription request details.
Instance Attribute Summary collapse
-
#application_context ⇒ SubscriptionApplicationContext
DEPRECATED.
-
#auto_renewal ⇒ TrueClass | FalseClass
DEPRECATED.
-
#custom_id ⇒ String
The custom id for the subscription.
-
#plan ⇒ PlanOverride
An inline plan object to customise the subscription.
-
#plan_id ⇒ String
The ID of the plan.
-
#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](tools.ietf.org/html/rfc3339#section-5.6).
-
#subscriber ⇒ SubscriberRequest
The subscriber request information .
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:, start_time: SKIP, quantity: SKIP, shipping_amount: SKIP, subscriber: SKIP, auto_renewal: false, application_context: SKIP, custom_id: SKIP, plan: SKIP) ⇒ CreateSubscriptionRequest
constructor
A new instance of CreateSubscriptionRequest.
-
#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:, start_time: SKIP, quantity: SKIP, shipping_amount: SKIP, subscriber: SKIP, auto_renewal: false, application_context: SKIP, custom_id: SKIP, plan: SKIP) ⇒ CreateSubscriptionRequest
Returns a new instance of CreateSubscriptionRequest.
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 90 def initialize(plan_id:, start_time: SKIP, quantity: SKIP, shipping_amount: SKIP, subscriber: SKIP, auto_renewal: false, application_context: SKIP, custom_id: SKIP, plan: SKIP) @plan_id = plan_id @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 @auto_renewal = auto_renewal unless auto_renewal == SKIP @application_context = application_context unless application_context == SKIP @custom_id = custom_id unless custom_id == SKIP @plan = plan unless plan == SKIP end |
Instance Attribute Details
#application_context ⇒ SubscriptionApplicationContext
DEPRECATED. The application context, which customizes the payer experience during the subscription approval process with PayPal.
44 45 46 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 44 def application_context @application_context end |
#auto_renewal ⇒ TrueClass | FalseClass
DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete.
39 40 41 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 39 def auto_renewal @auto_renewal end |
#custom_id ⇒ String
The custom id for the subscription. Can be invoice id.
48 49 50 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 48 def custom_id @custom_id 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.
54 55 56 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 54 def plan @plan end |
#plan_id ⇒ String
The ID of the plan.
14 15 16 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 14 def plan_id @plan_id end |
#quantity ⇒ String
The quantity of the product in the subscription.
25 26 27 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 25 def quantity @quantity end |
#shipping_amount ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
30 31 32 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 30 def shipping_amount @shipping_amount end |
#start_time ⇒ String
The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.
21 22 23 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 21 def start_time @start_time end |
#subscriber ⇒ SubscriberRequest
The subscriber request information .
34 35 36 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 34 def subscriber @subscriber end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 105 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. plan_id = hash.key?('plan_id') ? hash['plan_id'] : nil 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 = SubscriberRequest.from_hash(hash['subscriber']) if hash['subscriber'] auto_renewal = hash['auto_renewal'] ||= false application_context = SubscriptionApplicationContext.from_hash(hash['application_context']) if hash['application_context'] custom_id = hash.key?('custom_id') ? hash['custom_id'] : SKIP plan = PlanOverride.from_hash(hash['plan']) if hash['plan'] # Create object from extracted values. CreateSubscriptionRequest.new(plan_id: plan_id, start_time: start_time, quantity: quantity, shipping_amount: shipping_amount, subscriber: subscriber, auto_renewal: auto_renewal, application_context: application_context, custom_id: custom_id, plan: plan) end |
.names ⇒ Object
A mapping from model property names to API property names.
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 57 def self.names @_hash = {} if @_hash.nil? @_hash['plan_id'] = 'plan_id' @_hash['start_time'] = 'start_time' @_hash['quantity'] = 'quantity' @_hash['shipping_amount'] = 'shipping_amount' @_hash['subscriber'] = 'subscriber' @_hash['auto_renewal'] = 'auto_renewal' @_hash['application_context'] = 'application_context' @_hash['custom_id'] = 'custom_id' @_hash['plan'] = 'plan' @_hash end |
.nullables ⇒ Object
An array for nullable fields
86 87 88 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 86 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 72 def self.optionals %w[ start_time quantity shipping_amount subscriber auto_renewal application_context custom_id plan ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
142 143 144 145 146 147 148 149 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 142 def inspect class_name = self.class.name.split('::').last "<#{class_name} plan_id: #{@plan_id.inspect}, start_time: #{@start_time.inspect}, quantity:"\ " #{@quantity.inspect}, shipping_amount: #{@shipping_amount.inspect}, subscriber:"\ " #{@subscriber.inspect}, auto_renewal: #{@auto_renewal.inspect}, application_context:"\ " #{@application_context.inspect}, custom_id: #{@custom_id.inspect}, plan:"\ " #{@plan.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
133 134 135 136 137 138 139 |
# File 'lib/paypal_server_sdk/models/create_subscription_request.rb', line 133 def to_s class_name = self.class.name.split('::').last "<#{class_name} plan_id: #{@plan_id}, start_time: #{@start_time}, quantity: #{@quantity},"\ " shipping_amount: #{@shipping_amount}, subscriber: #{@subscriber}, auto_renewal:"\ " #{@auto_renewal}, application_context: #{@application_context}, custom_id: #{@custom_id},"\ " plan: #{@plan}>" end |