Class: PaypalServerSdk::IncentiveDetails
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::IncentiveDetails
- Defined in:
- lib/paypal_server_sdk/models/incentive_details.rb
Overview
The incentive details.
Instance Attribute Summary collapse
-
#incentive_amount ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
-
#incentive_code ⇒ String
The code that identifies an incentive, such as a coupon.
-
#incentive_program_code ⇒ String
The incentive program code that identifies a merchant loyalty or incentive program.
-
#incentive_type ⇒ String
The type of incentive, such as a special offer or coupon.
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(incentive_type: SKIP, incentive_code: SKIP, incentive_amount: SKIP, incentive_program_code: SKIP) ⇒ IncentiveDetails
constructor
A new instance of IncentiveDetails.
-
#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(incentive_type: SKIP, incentive_code: SKIP, incentive_amount: SKIP, incentive_program_code: SKIP) ⇒ IncentiveDetails
Returns a new instance of IncentiveDetails.
55 56 57 58 59 60 61 |
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 55 def initialize(incentive_type: SKIP, incentive_code: SKIP, incentive_amount: SKIP, incentive_program_code: SKIP) @incentive_type = incentive_type unless incentive_type == SKIP @incentive_code = incentive_code unless incentive_code == SKIP @incentive_amount = incentive_amount unless incentive_amount == SKIP @incentive_program_code = incentive_program_code unless incentive_program_code == SKIP end |
Instance Attribute Details
#incentive_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/incentive_details.rb', line 23 def incentive_amount @incentive_amount end |
#incentive_code ⇒ String
The code that identifies an incentive, such as a coupon.
18 19 20 |
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 18 def incentive_code @incentive_code end |
#incentive_program_code ⇒ String
The incentive program code that identifies a merchant loyalty or incentive program.
28 29 30 |
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 28 def incentive_program_code @incentive_program_code end |
#incentive_type ⇒ String
The type of incentive, such as a special offer or coupon.
14 15 16 |
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 14 def incentive_type @incentive_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 64 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. incentive_type = hash.key?('incentive_type') ? hash['incentive_type'] : SKIP incentive_code = hash.key?('incentive_code') ? hash['incentive_code'] : SKIP incentive_amount = Money.from_hash(hash['incentive_amount']) if hash['incentive_amount'] incentive_program_code = hash.key?('incentive_program_code') ? hash['incentive_program_code'] : SKIP # Create object from extracted values. IncentiveDetails.new(incentive_type: incentive_type, incentive_code: incentive_code, incentive_amount: incentive_amount, incentive_program_code: incentive_program_code) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['incentive_type'] = 'incentive_type' @_hash['incentive_code'] = 'incentive_code' @_hash['incentive_amount'] = 'incentive_amount' @_hash['incentive_program_code'] = 'incentive_program_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 |
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 51 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 46 47 48 |
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 41 def self.optionals %w[ incentive_type incentive_code incentive_amount incentive_program_code ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
92 93 94 95 96 97 |
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 92 def inspect class_name = self.class.name.split('::').last "<#{class_name} incentive_type: #{@incentive_type.inspect}, incentive_code:"\ " #{@incentive_code.inspect}, incentive_amount: #{@incentive_amount.inspect},"\ " incentive_program_code: #{@incentive_program_code.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
84 85 86 87 88 89 |
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 84 def to_s class_name = self.class.name.split('::').last "<#{class_name} incentive_type: #{@incentive_type}, incentive_code: #{@incentive_code},"\ " incentive_amount: #{@incentive_amount}, incentive_program_code:"\ " #{@incentive_program_code}>" end |