Class: PaypalServerSdk::IncentiveDetails

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

Overview

The incentive 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(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_amountMoney

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

Returns:



23
24
25
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 23

def incentive_amount
  @incentive_amount
end

#incentive_codeString

The code that identifies an incentive, such as a coupon.

Returns:

  • (String)


18
19
20
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 18

def incentive_code
  @incentive_code
end

#incentive_program_codeString

The incentive program code that identifies a merchant loyalty or incentive program.

Returns:

  • (String)


28
29
30
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 28

def incentive_program_code
  @incentive_program_code
end

#incentive_typeString

The type of incentive, such as a special offer or coupon.

Returns:

  • (String)


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

.namesObject

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

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/paypal_server_sdk/models/incentive_details.rb', line 51

def self.nullables
  []
end

.optionalsObject

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

#inspectObject

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_sObject

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