Class: PaypalServerSdk::PricingTier
- Defined in:
- lib/paypal_server_sdk/models/pricing_tier.rb
Overview
The pricing tier details.
Instance Attribute Summary collapse
-
#amount ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
-
#ending_quantity ⇒ String
The ending quantity for the tier.
-
#starting_quantity ⇒ String
The starting quantity for the tier.
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(starting_quantity:, amount:, ending_quantity: SKIP) ⇒ PricingTier
constructor
A new instance of PricingTier.
-
#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(starting_quantity:, amount:, ending_quantity: SKIP) ⇒ PricingTier
Returns a new instance of PricingTier.
46 47 48 49 50 |
# File 'lib/paypal_server_sdk/models/pricing_tier.rb', line 46 def initialize(starting_quantity:, amount:, ending_quantity: SKIP) @starting_quantity = starting_quantity @ending_quantity = ending_quantity unless ending_quantity == SKIP @amount = amount end |
Instance Attribute Details
#amount ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
23 24 25 |
# File 'lib/paypal_server_sdk/models/pricing_tier.rb', line 23 def amount @amount end |
#ending_quantity ⇒ String
The ending quantity for the tier. Optional for the last tier.
18 19 20 |
# File 'lib/paypal_server_sdk/models/pricing_tier.rb', line 18 def ending_quantity @ending_quantity end |
#starting_quantity ⇒ String
The starting quantity for the tier.
14 15 16 |
# File 'lib/paypal_server_sdk/models/pricing_tier.rb', line 14 def starting_quantity @starting_quantity end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/paypal_server_sdk/models/pricing_tier.rb', line 53 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. starting_quantity = hash.key?('starting_quantity') ? hash['starting_quantity'] : nil amount = Money.from_hash(hash['amount']) if hash['amount'] ending_quantity = hash.key?('ending_quantity') ? hash['ending_quantity'] : SKIP # Create object from extracted values. PricingTier.new(starting_quantity: starting_quantity, amount: amount, ending_quantity: ending_quantity) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 |
# File 'lib/paypal_server_sdk/models/pricing_tier.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['starting_quantity'] = 'starting_quantity' @_hash['ending_quantity'] = 'ending_quantity' @_hash['amount'] = 'amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/paypal_server_sdk/models/pricing_tier.rb', line 42 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 38 39 |
# File 'lib/paypal_server_sdk/models/pricing_tier.rb', line 35 def self.optionals %w[ ending_quantity ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
77 78 79 80 81 |
# File 'lib/paypal_server_sdk/models/pricing_tier.rb', line 77 def inspect class_name = self.class.name.split('::').last "<#{class_name} starting_quantity: #{@starting_quantity.inspect}, ending_quantity:"\ " #{@ending_quantity.inspect}, amount: #{@amount.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
70 71 72 73 74 |
# File 'lib/paypal_server_sdk/models/pricing_tier.rb', line 70 def to_s class_name = self.class.name.split('::').last "<#{class_name} starting_quantity: #{@starting_quantity}, ending_quantity:"\ " #{@ending_quantity}, amount: #{@amount}>" end |