Class: PaypalServerSdk::PricingScheme

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/pricing_scheme.rb

Overview

The pricing scheme details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(pricing_model:, price: SKIP, reload_threshold_amount: SKIP) ⇒ PricingScheme

Returns a new instance of PricingScheme.



48
49
50
51
52
# File 'lib/paypal_server_sdk/models/pricing_scheme.rb', line 48

def initialize(pricing_model:, price: SKIP, reload_threshold_amount: SKIP)
  @price = price unless price == SKIP
  @pricing_model = pricing_model
  @reload_threshold_amount = reload_threshold_amount unless reload_threshold_amount == SKIP
end

Instance Attribute Details

#priceMoney

The currency and amount for a financial transaction, such as a balance or payment due.

Returns:



15
16
17
# File 'lib/paypal_server_sdk/models/pricing_scheme.rb', line 15

def price
  @price
end

#pricing_modelPricingModel

The pricing model for the billing cycle.

Returns:



19
20
21
# File 'lib/paypal_server_sdk/models/pricing_scheme.rb', line 19

def pricing_model
  @pricing_model
end

#reload_threshold_amountMoney

The currency and amount for a financial transaction, such as a balance or payment due.

Returns:



24
25
26
# File 'lib/paypal_server_sdk/models/pricing_scheme.rb', line 24

def reload_threshold_amount
  @reload_threshold_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/paypal_server_sdk/models/pricing_scheme.rb', line 55

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  pricing_model = hash.key?('pricing_model') ? hash['pricing_model'] : nil
  price = Money.from_hash(hash['price']) if hash['price']
  reload_threshold_amount = Money.from_hash(hash['reload_threshold_amount']) if
    hash['reload_threshold_amount']

  # Create object from extracted values.
  PricingScheme.new(pricing_model: pricing_model,
                    price: price,
                    reload_threshold_amount: reload_threshold_amount)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
33
# File 'lib/paypal_server_sdk/models/pricing_scheme.rb', line 27

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['price'] = 'price'
  @_hash['pricing_model'] = 'pricing_model'
  @_hash['reload_threshold_amount'] = 'reload_threshold_amount'
  @_hash
end

.nullablesObject

An array for nullable fields



44
45
46
# File 'lib/paypal_server_sdk/models/pricing_scheme.rb', line 44

def self.nullables
  []
end

.optionalsObject

An array for optional fields



36
37
38
39
40
41
# File 'lib/paypal_server_sdk/models/pricing_scheme.rb', line 36

def self.optionals
  %w[
    price
    reload_threshold_amount
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



78
79
80
81
82
# File 'lib/paypal_server_sdk/models/pricing_scheme.rb', line 78

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} price: #{@price.inspect}, pricing_model: #{@pricing_model.inspect},"\
  " reload_threshold_amount: #{@reload_threshold_amount.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



71
72
73
74
75
# File 'lib/paypal_server_sdk/models/pricing_scheme.rb', line 71

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} price: #{@price}, pricing_model: #{@pricing_model},"\
  " reload_threshold_amount: #{@reload_threshold_amount}>"
end