Class: PaypalServerSdk::BillingPlan
- Defined in:
- lib/paypal_server_sdk/models/billing_plan.rb
Overview
The plan details.
Instance Attribute Summary collapse
-
#billing_cycles ⇒ Array[SubscriptionBillingCycle]
An array of billing cycles for trial billing and regular billing.
-
#create_time ⇒ String
The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6).
-
#description ⇒ String
The detailed description of the plan.
-
#id ⇒ String
The unique PayPal-generated ID for the plan.
-
#links ⇒ Array[LinkDescription]
An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).
-
#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.
-
#status ⇒ SubscriptionPlanStatus
The plan status.
-
#taxes ⇒ Taxes
The tax details.
-
#update_time ⇒ String
The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6).
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, product_id: SKIP, name: SKIP, status: SKIP, description: SKIP, billing_cycles: SKIP, payment_preferences: SKIP, merchant_preferences: SKIP, taxes: SKIP, quantity_supported: false, create_time: SKIP, update_time: SKIP, links: SKIP) ⇒ BillingPlan
constructor
A new instance of BillingPlan.
-
#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, product_id: SKIP, name: SKIP, status: SKIP, description: SKIP, billing_cycles: SKIP, payment_preferences: SKIP, merchant_preferences: SKIP, taxes: SKIP, quantity_supported: false, create_time: SKIP, update_time: SKIP, links: SKIP) ⇒ BillingPlan
Returns a new instance of BillingPlan.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 116 def initialize(id: SKIP, product_id: SKIP, name: SKIP, status: SKIP, description: SKIP, billing_cycles: SKIP, payment_preferences: SKIP, merchant_preferences: SKIP, taxes: SKIP, quantity_supported: false, create_time: SKIP, update_time: SKIP, links: SKIP) @id = id unless id == SKIP @product_id = product_id unless product_id == SKIP @name = name unless name == SKIP @status = status unless status == 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 @create_time = create_time unless create_time == SKIP @update_time = update_time unless update_time == SKIP @links = links unless links == 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.
35 36 37 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 35 def billing_cycles @billing_cycles end |
#create_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.
59 60 61 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 59 def create_time @create_time end |
#description ⇒ String
The detailed description of the plan.
30 31 32 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 30 def description @description end |
#id ⇒ String
The unique PayPal-generated ID for the plan.
14 15 16 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 14 def id @id end |
#links ⇒ Array[LinkDescription]
An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).
71 72 73 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 71 def links @links end |
#merchant_preferences ⇒ MerchantPreferences
The merchant preferences for a subscription.
43 44 45 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 43 def merchant_preferences @merchant_preferences end |
#name ⇒ String
The plan name.
22 23 24 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 22 def name @name end |
#payment_preferences ⇒ PaymentPreferences
The payment preferences for a subscription.
39 40 41 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 39 def payment_preferences @payment_preferences end |
#product_id ⇒ String
The ID for the product.
18 19 20 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 18 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.
52 53 54 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 52 def quantity_supported @quantity_supported end |
#status ⇒ SubscriptionPlanStatus
The plan status.
26 27 28 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 26 def status @status end |
#taxes ⇒ Taxes
The tax details.
47 48 49 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 47 def taxes @taxes end |
#update_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.
66 67 68 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 66 def update_time @update_time end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 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 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 137 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP product_id = hash.key?('product_id') ? hash['product_id'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP status = hash.key?('status') ? hash['status'] : 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_time = hash.key?('create_time') ? hash['create_time'] : SKIP update_time = hash.key?('update_time') ? hash['update_time'] : 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. BillingPlan.new(id: id, product_id: product_id, name: name, status: status, description: description, billing_cycles: billing_cycles, payment_preferences: payment_preferences, merchant_preferences: merchant_preferences, taxes: taxes, quantity_supported: quantity_supported, create_time: create_time, update_time: update_time, links: links) end |
.names ⇒ Object
A mapping from model property names to API property names.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 74 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['product_id'] = 'product_id' @_hash['name'] = 'name' @_hash['status'] = 'status' @_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['create_time'] = 'create_time' @_hash['update_time'] = 'update_time' @_hash['links'] = 'links' @_hash end |
.nullables ⇒ Object
An array for nullable fields
112 113 114 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 112 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 93 def self.optionals %w[ id product_id name status description billing_cycles payment_preferences merchant_preferences taxes quantity_supported create_time update_time links ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
202 203 204 205 206 207 208 209 210 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 202 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, product_id: #{@product_id.inspect}, name:"\ " #{@name.inspect}, status: #{@status.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}, create_time:"\ " #{@create_time.inspect}, update_time: #{@update_time.inspect}, links: #{@links.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
192 193 194 195 196 197 198 199 |
# File 'lib/paypal_server_sdk/models/billing_plan.rb', line 192 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, product_id: #{@product_id}, name: #{@name}, status: #{@status},"\ " description: #{@description}, billing_cycles: #{@billing_cycles}, payment_preferences:"\ " #{@payment_preferences}, merchant_preferences: #{@merchant_preferences}, taxes: #{@taxes},"\ " quantity_supported: #{@quantity_supported}, create_time: #{@create_time}, update_time:"\ " #{@update_time}, links: #{@links}>" end |