Class: PaypalServerSdk::SubscriptionPricingScheme
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::SubscriptionPricingScheme
- Defined in:
- lib/paypal_server_sdk/models/subscription_pricing_scheme.rb
Overview
The pricing scheme details.
Instance Attribute Summary collapse
-
#create_time ⇒ String
The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6).
-
#fixed_price ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
-
#pricing_model ⇒ SubscriptionPricingModel
The pricing model for tiered plan.
-
#tiers ⇒ Array[PricingTier]
An array of pricing tiers which are used for billing volume/tiered plans.
-
#update_time ⇒ String
The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6).
-
#version ⇒ Integer
The version of the pricing scheme.
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(version: SKIP, fixed_price: SKIP, pricing_model: SKIP, tiers: SKIP, create_time: SKIP, update_time: SKIP) ⇒ SubscriptionPricingScheme
constructor
A new instance of SubscriptionPricingScheme.
-
#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(version: SKIP, fixed_price: SKIP, pricing_model: SKIP, tiers: SKIP, create_time: SKIP, update_time: SKIP) ⇒ SubscriptionPricingScheme
Returns a new instance of SubscriptionPricingScheme.
73 74 75 76 77 78 79 80 81 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 73 def initialize(version: SKIP, fixed_price: SKIP, pricing_model: SKIP, tiers: SKIP, create_time: SKIP, update_time: SKIP) @version = version unless version == SKIP @fixed_price = fixed_price unless fixed_price == SKIP @pricing_model = pricing_model unless pricing_model == SKIP @tiers = tiers unless tiers == SKIP @create_time = create_time unless create_time == SKIP @update_time = update_time unless update_time == SKIP end |
Instance Attribute Details
#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.
35 36 37 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 35 def create_time @create_time end |
#fixed_price ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
19 20 21 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 19 def fixed_price @fixed_price end |
#pricing_model ⇒ SubscriptionPricingModel
The pricing model for tiered plan. The ‘tiers` parameter is required.
23 24 25 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 23 def pricing_model @pricing_model end |
#tiers ⇒ Array[PricingTier]
An array of pricing tiers which are used for billing volume/tiered plans. pricing_model field has to be specified.
28 29 30 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 28 def tiers @tiers 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.
42 43 44 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 42 def update_time @update_time end |
#version ⇒ Integer
The version of the pricing scheme.
14 15 16 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 14 def version @version 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 106 107 108 109 110 111 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 84 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. version = hash.key?('version') ? hash['version'] : SKIP fixed_price = Money.from_hash(hash['fixed_price']) if hash['fixed_price'] pricing_model = hash.key?('pricing_model') ? hash['pricing_model'] : SKIP # Parameter is an array, so we need to iterate through it tiers = nil unless hash['tiers'].nil? tiers = [] hash['tiers'].each do |structure| tiers << (PricingTier.from_hash(structure) if structure) end end tiers = SKIP unless hash.key?('tiers') create_time = hash.key?('create_time') ? hash['create_time'] : SKIP update_time = hash.key?('update_time') ? hash['update_time'] : SKIP # Create object from extracted values. SubscriptionPricingScheme.new(version: version, fixed_price: fixed_price, pricing_model: pricing_model, tiers: tiers, create_time: create_time, update_time: update_time) end |
.names ⇒ Object
A mapping from model property names to API property names.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 45 def self.names @_hash = {} if @_hash.nil? @_hash['version'] = 'version' @_hash['fixed_price'] = 'fixed_price' @_hash['pricing_model'] = 'pricing_model' @_hash['tiers'] = 'tiers' @_hash['create_time'] = 'create_time' @_hash['update_time'] = 'update_time' @_hash end |
.nullables ⇒ Object
An array for nullable fields
69 70 71 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 69 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 57 def self.optionals %w[ version fixed_price pricing_model tiers create_time update_time ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
122 123 124 125 126 127 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 122 def inspect class_name = self.class.name.split('::').last "<#{class_name} version: #{@version.inspect}, fixed_price: #{@fixed_price.inspect},"\ " pricing_model: #{@pricing_model.inspect}, tiers: #{@tiers.inspect}, create_time:"\ " #{@create_time.inspect}, update_time: #{@update_time.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
114 115 116 117 118 119 |
# File 'lib/paypal_server_sdk/models/subscription_pricing_scheme.rb', line 114 def to_s class_name = self.class.name.split('::').last "<#{class_name} version: #{@version}, fixed_price: #{@fixed_price}, pricing_model:"\ " #{@pricing_model}, tiers: #{@tiers}, create_time: #{@create_time}, update_time:"\ " #{@update_time}>" end |