Class: PaypalServerSdk::PlanDetails
- Defined in:
- lib/paypal_server_sdk/models/plan_details.rb
Overview
The plan details.
Instance Attribute Summary collapse
-
#billing_cycles ⇒ Array[SubscriptionBillingCycle]
An array of billing cycles for trial billing and regular billing.
-
#description ⇒ String
The detailed description of the plan.
-
#merchant_preferences ⇒ MerchantPreferences
The merchant preferences for a subscription.
-
#name ⇒ String
The plan name.
-
#payment_preferences ⇒ PaymentPreferences
The payment preferences for a subscription.
-
#product_id ⇒ String
The ID for the product.
-
#quantity_supported ⇒ TrueClass | FalseClass
Indicates whether you can subscribe to this plan by providing a quantity for the goods or service.
-
#taxes ⇒ Taxes
The tax details.
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(product_id: SKIP, name: SKIP, description: SKIP, billing_cycles: SKIP, payment_preferences: SKIP, merchant_preferences: SKIP, taxes: SKIP, quantity_supported: false) ⇒ PlanDetails
constructor
A new instance of PlanDetails.
-
#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(product_id: SKIP, name: SKIP, description: SKIP, billing_cycles: SKIP, payment_preferences: SKIP, merchant_preferences: SKIP, taxes: SKIP, quantity_supported: false) ⇒ PlanDetails
Returns a new instance of PlanDetails.
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 79 def initialize(product_id: SKIP, name: SKIP, description: SKIP, billing_cycles: SKIP, payment_preferences: SKIP, merchant_preferences: SKIP, taxes: SKIP, quantity_supported: false) @product_id = product_id unless product_id == SKIP @name = name unless name == SKIP @description = description unless description == SKIP @billing_cycles = billing_cycles unless billing_cycles == SKIP @payment_preferences = payment_preferences unless payment_preferences == SKIP @merchant_preferences = merchant_preferences unless merchant_preferences == SKIP @taxes = taxes unless taxes == SKIP @quantity_supported = quantity_supported unless quantity_supported == SKIP end |
Instance Attribute Details
#billing_cycles ⇒ Array[SubscriptionBillingCycle]
An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle.
27 28 29 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 27 def billing_cycles @billing_cycles end |
#description ⇒ String
The detailed description of the plan.
22 23 24 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 22 def description @description end |
#merchant_preferences ⇒ MerchantPreferences
The merchant preferences for a subscription.
35 36 37 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 35 def merchant_preferences @merchant_preferences end |
#name ⇒ String
The plan name.
18 19 20 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 18 def name @name end |
#payment_preferences ⇒ PaymentPreferences
The payment preferences for a subscription.
31 32 33 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 31 def payment_preferences @payment_preferences end |
#product_id ⇒ String
The ID for the product.
14 15 16 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 14 def product_id @product_id end |
#quantity_supported ⇒ TrueClass | FalseClass
Indicates whether you can subscribe to this plan by providing a quantity for the goods or service.
44 45 46 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 44 def quantity_supported @quantity_supported end |
#taxes ⇒ Taxes
The tax details.
39 40 41 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 39 def taxes @taxes end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 123 124 125 126 127 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 94 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. product_id = hash.key?('product_id') ? hash['product_id'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP # Parameter is an array, so we need to iterate through it billing_cycles = nil unless hash['billing_cycles'].nil? billing_cycles = [] hash['billing_cycles'].each do |structure| billing_cycles << (SubscriptionBillingCycle.from_hash(structure) if structure) end end billing_cycles = SKIP unless hash.key?('billing_cycles') payment_preferences = PaymentPreferences.from_hash(hash['payment_preferences']) if hash['payment_preferences'] merchant_preferences = MerchantPreferences.from_hash(hash['merchant_preferences']) if hash['merchant_preferences'] taxes = Taxes.from_hash(hash['taxes']) if hash['taxes'] quantity_supported = hash['quantity_supported'] ||= false # Create object from extracted values. PlanDetails.new(product_id: product_id, name: name, description: description, billing_cycles: billing_cycles, payment_preferences: payment_preferences, merchant_preferences: merchant_preferences, taxes: taxes, quantity_supported: quantity_supported) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['product_id'] = 'product_id' @_hash['name'] = 'name' @_hash['description'] = 'description' @_hash['billing_cycles'] = 'billing_cycles' @_hash['payment_preferences'] = 'payment_preferences' @_hash['merchant_preferences'] = 'merchant_preferences' @_hash['taxes'] = 'taxes' @_hash['quantity_supported'] = 'quantity_supported' @_hash end |
.nullables ⇒ Object
An array for nullable fields
75 76 77 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 75 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 61 def self.optionals %w[ product_id name description billing_cycles payment_preferences merchant_preferences taxes quantity_supported ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
139 140 141 142 143 144 145 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 139 def inspect class_name = self.class.name.split('::').last "<#{class_name} product_id: #{@product_id.inspect}, name: #{@name.inspect}, description:"\ " #{@description.inspect}, billing_cycles: #{@billing_cycles.inspect}, payment_preferences:"\ " #{@payment_preferences.inspect}, merchant_preferences: #{@merchant_preferences.inspect},"\ " taxes: #{@taxes.inspect}, quantity_supported: #{@quantity_supported.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
130 131 132 133 134 135 136 |
# File 'lib/paypal_server_sdk/models/plan_details.rb', line 130 def to_s class_name = self.class.name.split('::').last "<#{class_name} product_id: #{@product_id}, name: #{@name}, description: #{@description},"\ " billing_cycles: #{@billing_cycles}, payment_preferences: #{@payment_preferences},"\ " merchant_preferences: #{@merchant_preferences}, taxes: #{@taxes}, quantity_supported:"\ " #{@quantity_supported}>" end |