Class: SplititWebApiV4::RefundResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/splitit_web_api_v4/models/refund_response.rb

Overview

RefundResponse Model.

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(requested_amount:, refund_id: SKIP, installment_plan_number: SKIP, currency: SKIP, reference_id: SKIP, additional_properties: nil) ⇒ RefundResponse

Returns a new instance of RefundResponse.



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/splitit_web_api_v4/models/refund_response.rb', line 58

def initialize(requested_amount:, refund_id: SKIP,
               installment_plan_number: SKIP, currency: SKIP,
               reference_id: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @refund_id = refund_id unless refund_id == SKIP
  @installment_plan_number = installment_plan_number unless installment_plan_number == SKIP
  @currency = currency unless currency == SKIP
  @requested_amount = requested_amount
  @reference_id = reference_id unless reference_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#currencyString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/splitit_web_api_v4/models/refund_response.rb', line 22

def currency
  @currency
end

#installment_plan_numberString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/splitit_web_api_v4/models/refund_response.rb', line 18

def installment_plan_number
  @installment_plan_number
end

#reference_idString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/splitit_web_api_v4/models/refund_response.rb', line 30

def reference_id
  @reference_id
end

#refund_idString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/splitit_web_api_v4/models/refund_response.rb', line 14

def refund_id
  @refund_id
end

#requested_amountFloat

TODO: Write general description for this method

Returns:

  • (Float)


26
27
28
# File 'lib/splitit_web_api_v4/models/refund_response.rb', line 26

def requested_amount
  @requested_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/splitit_web_api_v4/models/refund_response.rb', line 73

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  requested_amount =
    hash.key?('RequestedAmount') ? hash['RequestedAmount'] : nil
  refund_id = hash.key?('RefundId') ? hash['RefundId'] : SKIP
  installment_plan_number =
    hash.key?('InstallmentPlanNumber') ? hash['InstallmentPlanNumber'] : SKIP
  currency = hash.key?('Currency') ? hash['Currency'] : SKIP
  reference_id = hash.key?('ReferenceId') ? hash['ReferenceId'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  RefundResponse.new(requested_amount: requested_amount,
                     refund_id: refund_id,
                     installment_plan_number: installment_plan_number,
                     currency: currency,
                     reference_id: reference_id,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/splitit_web_api_v4/models/refund_response.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['refund_id'] = 'RefundId'
  @_hash['installment_plan_number'] = 'InstallmentPlanNumber'
  @_hash['currency'] = 'Currency'
  @_hash['requested_amount'] = 'RequestedAmount'
  @_hash['reference_id'] = 'ReferenceId'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/splitit_web_api_v4/models/refund_response.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
# File 'lib/splitit_web_api_v4/models/refund_response.rb', line 44

def self.optionals
  %w[
    refund_id
    installment_plan_number
    currency
    reference_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



111
112
113
114
115
116
117
# File 'lib/splitit_web_api_v4/models/refund_response.rb', line 111

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} refund_id: #{@refund_id.inspect}, installment_plan_number:"\
  " #{@installment_plan_number.inspect}, currency: #{@currency.inspect}, requested_amount:"\
  " #{@requested_amount.inspect}, reference_id: #{@reference_id.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



102
103
104
105
106
107
108
# File 'lib/splitit_web_api_v4/models/refund_response.rb', line 102

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} refund_id: #{@refund_id}, installment_plan_number:"\
  " #{@installment_plan_number}, currency: #{@currency}, requested_amount:"\
  " #{@requested_amount}, reference_id: #{@reference_id}, additional_properties:"\
  " #{@additional_properties}>"
end