Class: SplititWebApiV4::RefundItem
- Defined in:
- lib/splitit_web_api_v4/models/refund_item.rb
Overview
RefundItem Model.
Instance Attribute Summary collapse
-
#credit_refund_amount ⇒ Float
TODO: Write general description for this method.
-
#non_credit_refund_amount ⇒ Float
TODO: Write general description for this method.
-
#reference_id ⇒ String
TODO: Write general description for this method.
-
#refund_id ⇒ String
TODO: Write general description for this method.
-
#requested_amount ⇒ Float
TODO: Write general description for this method.
-
#status ⇒ String
TODO: Write general description for this method.
-
#submit_date ⇒ DateTime
TODO: Write general description for this method.
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(requested_amount:, submit_date: SKIP, status: SKIP, non_credit_refund_amount: SKIP, credit_refund_amount: SKIP, refund_id: SKIP, reference_id: SKIP, additional_properties: nil) ⇒ RefundItem
constructor
A new instance of RefundItem.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_submit_date ⇒ Object
-
#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(requested_amount:, submit_date: SKIP, status: SKIP, non_credit_refund_amount: SKIP, credit_refund_amount: SKIP, refund_id: SKIP, reference_id: SKIP, additional_properties: nil) ⇒ RefundItem
Returns a new instance of RefundItem.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 71 def initialize(requested_amount:, submit_date: SKIP, status: SKIP, non_credit_refund_amount: SKIP, credit_refund_amount: SKIP, refund_id: SKIP, reference_id: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @submit_date = submit_date unless submit_date == SKIP @requested_amount = requested_amount @status = status unless status == SKIP @non_credit_refund_amount = non_credit_refund_amount unless non_credit_refund_amount == SKIP @credit_refund_amount = credit_refund_amount unless credit_refund_amount == SKIP @refund_id = refund_id unless refund_id == SKIP @reference_id = reference_id unless reference_id == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#credit_refund_amount ⇒ Float
TODO: Write general description for this method
31 32 33 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 31 def credit_refund_amount @credit_refund_amount end |
#non_credit_refund_amount ⇒ Float
TODO: Write general description for this method
27 28 29 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 27 def non_credit_refund_amount @non_credit_refund_amount end |
#reference_id ⇒ String
TODO: Write general description for this method
39 40 41 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 39 def reference_id @reference_id end |
#refund_id ⇒ String
TODO: Write general description for this method
35 36 37 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 35 def refund_id @refund_id end |
#requested_amount ⇒ Float
TODO: Write general description for this method
19 20 21 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 19 def requested_amount @requested_amount end |
#status ⇒ String
TODO: Write general description for this method
23 24 25 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 23 def status @status end |
#submit_date ⇒ DateTime
TODO: Write general description for this method
15 16 17 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 15 def submit_date @submit_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 89 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. requested_amount = hash.key?('RequestedAmount') ? hash['RequestedAmount'] : nil submit_date = if hash.key?('SubmitDate') (DateTimeHelper.from_rfc3339(hash['SubmitDate']) if hash['SubmitDate']) else SKIP end status = hash.key?('Status') ? hash['Status'] : SKIP non_credit_refund_amount = hash.key?('NonCreditRefundAmount') ? hash['NonCreditRefundAmount'] : SKIP credit_refund_amount = hash.key?('CreditRefundAmount') ? hash['CreditRefundAmount'] : SKIP refund_id = hash.key?('RefundId') ? hash['RefundId'] : 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. RefundItem.new(requested_amount: requested_amount, submit_date: submit_date, status: status, non_credit_refund_amount: non_credit_refund_amount, credit_refund_amount: credit_refund_amount, refund_id: refund_id, reference_id: reference_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['submit_date'] = 'SubmitDate' @_hash['requested_amount'] = 'RequestedAmount' @_hash['status'] = 'Status' @_hash['non_credit_refund_amount'] = 'NonCreditRefundAmount' @_hash['credit_refund_amount'] = 'CreditRefundAmount' @_hash['refund_id'] = 'RefundId' @_hash['reference_id'] = 'ReferenceId' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 55 def self.optionals %w[ submit_date status non_credit_refund_amount credit_refund_amount refund_id reference_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
140 141 142 143 144 145 146 147 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 140 def inspect class_name = self.class.name.split('::').last "<#{class_name} submit_date: #{@submit_date.inspect}, requested_amount:"\ " #{@requested_amount.inspect}, status: #{@status.inspect}, non_credit_refund_amount:"\ " #{@non_credit_refund_amount.inspect}, credit_refund_amount:"\ " #{@credit_refund_amount.inspect}, refund_id: #{@refund_id.inspect}, reference_id:"\ " #{@reference_id.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_submit_date ⇒ Object
126 127 128 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 126 def to_custom_submit_date DateTimeHelper.to_rfc3339(submit_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
131 132 133 134 135 136 137 |
# File 'lib/splitit_web_api_v4/models/refund_item.rb', line 131 def to_s class_name = self.class.name.split('::').last "<#{class_name} submit_date: #{@submit_date}, requested_amount: #{@requested_amount},"\ " status: #{@status}, non_credit_refund_amount: #{@non_credit_refund_amount},"\ " credit_refund_amount: #{@credit_refund_amount}, refund_id: #{@refund_id}, reference_id:"\ " #{@reference_id}, additional_properties: #{@additional_properties}>" end |