Class: UspsApi::Dispute
- Defined in:
- lib/usps_api/models/dispute.rb
Overview
Dispute Model.
Instance Attribute Summary collapse
-
#acct_mgmt_response ⇒ MgmtResponse
Account management response details, if available.
-
#amount ⇒ Float
Disputed amount.
-
#crid ⇒ String
Customer Registration ID (CRID) of the mail owner.
-
#description ⇒ String
Additional description or details about the dispute.
-
#dispute_id ⇒ String
Unique identifier for the dispute.
-
#dispute_valid ⇒ Business
Indicates if the dispute can be created.
-
#eps_transaction_id ⇒ String
EPS Transaction ID for the Census charge associated with the dispute.
-
#name ⇒ String
Name of the individual or entity that submitted the dispute.
-
#payment_response ⇒ PaymentResponse1
Payment validation response details, if available.
-
#reason ⇒ String
Reason for submitted dispute.
-
#status ⇒ Status3
Status of the dispute.
-
#submission_date ⇒ DateTime
Date and time when the dispute was submitted in ISO 8601 format with UTC timezone.
-
#tracking_id ⇒ String
IMpb barcode for the package related to the dispute.
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(dispute_id: SKIP, eps_transaction_id: SKIP, tracking_id: SKIP, crid: SKIP, amount: SKIP, reason: SKIP, description: SKIP, name: SKIP, status: SKIP, submission_date: SKIP, dispute_valid: Business::N, payment_response: SKIP, acct_mgmt_response: SKIP, additional_properties: nil) ⇒ Dispute
constructor
A new instance of Dispute.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_submission_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(dispute_id: SKIP, eps_transaction_id: SKIP, tracking_id: SKIP, crid: SKIP, amount: SKIP, reason: SKIP, description: SKIP, name: SKIP, status: SKIP, submission_date: SKIP, dispute_valid: Business::N, payment_response: SKIP, acct_mgmt_response: SKIP, additional_properties: nil) ⇒ Dispute
Returns a new instance of Dispute.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/usps_api/models/dispute.rb', line 109 def initialize(dispute_id: SKIP, eps_transaction_id: SKIP, tracking_id: SKIP, crid: SKIP, amount: SKIP, reason: SKIP, description: SKIP, name: SKIP, status: SKIP, submission_date: SKIP, dispute_valid: Business::N, payment_response: SKIP, acct_mgmt_response: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @dispute_id = dispute_id unless dispute_id == SKIP @eps_transaction_id = eps_transaction_id unless eps_transaction_id == SKIP @tracking_id = tracking_id unless tracking_id == SKIP @crid = crid unless crid == SKIP @amount = amount unless amount == SKIP @reason = reason unless reason == SKIP @description = description unless description == SKIP @name = name unless name == SKIP @status = status unless status == SKIP @submission_date = submission_date unless submission_date == SKIP @dispute_valid = dispute_valid unless dispute_valid == SKIP @payment_response = payment_response unless payment_response == SKIP @acct_mgmt_response = acct_mgmt_response unless acct_mgmt_response == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#acct_mgmt_response ⇒ MgmtResponse
Account management response details, if available.
64 65 66 |
# File 'lib/usps_api/models/dispute.rb', line 64 def acct_mgmt_response @acct_mgmt_response end |
#amount ⇒ Float
Disputed amount.
31 32 33 |
# File 'lib/usps_api/models/dispute.rb', line 31 def amount @amount end |
#crid ⇒ String
Customer Registration ID (CRID) of the mail owner.
27 28 29 |
# File 'lib/usps_api/models/dispute.rb', line 27 def crid @crid end |
#description ⇒ String
Additional description or details about the dispute.
39 40 41 |
# File 'lib/usps_api/models/dispute.rb', line 39 def description @description end |
#dispute_id ⇒ String
Unique identifier for the dispute.
15 16 17 |
# File 'lib/usps_api/models/dispute.rb', line 15 def dispute_id @dispute_id end |
#dispute_valid ⇒ Business
Indicates if the dispute can be created. āYā for yes, āNā for no.
56 57 58 |
# File 'lib/usps_api/models/dispute.rb', line 56 def dispute_valid @dispute_valid end |
#eps_transaction_id ⇒ String
EPS Transaction ID for the Census charge associated with the dispute.
19 20 21 |
# File 'lib/usps_api/models/dispute.rb', line 19 def eps_transaction_id @eps_transaction_id end |
#name ⇒ String
Name of the individual or entity that submitted the dispute.
43 44 45 |
# File 'lib/usps_api/models/dispute.rb', line 43 def name @name end |
#payment_response ⇒ PaymentResponse1
Payment validation response details, if available.
60 61 62 |
# File 'lib/usps_api/models/dispute.rb', line 60 def payment_response @payment_response end |
#reason ⇒ String
Reason for submitted dispute.
35 36 37 |
# File 'lib/usps_api/models/dispute.rb', line 35 def reason @reason end |
#status ⇒ Status3
Status of the dispute.
47 48 49 |
# File 'lib/usps_api/models/dispute.rb', line 47 def status @status end |
#submission_date ⇒ DateTime
Date and time when the dispute was submitted in ISO 8601 format with UTC timezone.
52 53 54 |
# File 'lib/usps_api/models/dispute.rb', line 52 def submission_date @submission_date end |
#tracking_id ⇒ String
IMpb barcode for the package related to the dispute.
23 24 25 |
# File 'lib/usps_api/models/dispute.rb', line 23 def tracking_id @tracking_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/usps_api/models/dispute.rb', line 135 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. dispute_id = hash.key?('disputeID') ? hash['disputeID'] : SKIP eps_transaction_id = hash.key?('EPSTransactionID') ? hash['EPSTransactionID'] : SKIP tracking_id = hash.key?('trackingID') ? hash['trackingID'] : SKIP crid = hash.key?('CRID') ? hash['CRID'] : SKIP amount = hash.key?('amount') ? hash['amount'] : SKIP reason = hash.key?('reason') ? hash['reason'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP submission_date = if hash.key?('submissionDate') (DateTimeHelper.from_rfc3339(hash['submissionDate']) if hash['submissionDate']) else SKIP end dispute_valid = hash['disputeValid'] ||= Business::N payment_response = PaymentResponse1.from_hash(hash['paymentResponse']) if hash['paymentResponse'] acct_mgmt_response = MgmtResponse.from_hash(hash['AcctMgmtResponse']) if hash['AcctMgmtResponse'] # 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. Dispute.new(dispute_id: dispute_id, eps_transaction_id: eps_transaction_id, tracking_id: tracking_id, crid: crid, amount: amount, reason: reason, description: description, name: name, status: status, submission_date: submission_date, dispute_valid: dispute_valid, payment_response: payment_response, acct_mgmt_response: acct_mgmt_response, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/usps_api/models/dispute.rb', line 67 def self.names @_hash = {} if @_hash.nil? @_hash['dispute_id'] = 'disputeID' @_hash['eps_transaction_id'] = 'EPSTransactionID' @_hash['tracking_id'] = 'trackingID' @_hash['crid'] = 'CRID' @_hash['amount'] = 'amount' @_hash['reason'] = 'reason' @_hash['description'] = 'description' @_hash['name'] = 'name' @_hash['status'] = 'status' @_hash['submission_date'] = 'submissionDate' @_hash['dispute_valid'] = 'disputeValid' @_hash['payment_response'] = 'paymentResponse' @_hash['acct_mgmt_response'] = 'AcctMgmtResponse' @_hash end |
.nullables ⇒ Object
An array for nullable fields
105 106 107 |
# File 'lib/usps_api/models/dispute.rb', line 105 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/usps_api/models/dispute.rb', line 86 def self.optionals %w[ dispute_id eps_transaction_id tracking_id crid amount reason description name status submission_date dispute_valid payment_response acct_mgmt_response ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
200 201 202 203 204 205 206 207 208 209 |
# File 'lib/usps_api/models/dispute.rb', line 200 def inspect class_name = self.class.name.split('::').last "<#{class_name} dispute_id: #{@dispute_id.inspect}, eps_transaction_id:"\ " #{@eps_transaction_id.inspect}, tracking_id: #{@tracking_id.inspect}, crid:"\ " #{@crid.inspect}, amount: #{@amount.inspect}, reason: #{@reason.inspect}, description:"\ " #{@description.inspect}, name: #{@name.inspect}, status: #{@status.inspect},"\ " submission_date: #{@submission_date.inspect}, dispute_valid: #{@dispute_valid.inspect},"\ " payment_response: #{@payment_response.inspect}, acct_mgmt_response:"\ " #{@acct_mgmt_response.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_submission_date ⇒ Object
184 185 186 |
# File 'lib/usps_api/models/dispute.rb', line 184 def to_custom_submission_date DateTimeHelper.to_rfc3339(submission_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
189 190 191 192 193 194 195 196 197 |
# File 'lib/usps_api/models/dispute.rb', line 189 def to_s class_name = self.class.name.split('::').last "<#{class_name} dispute_id: #{@dispute_id}, eps_transaction_id: #{@eps_transaction_id},"\ " tracking_id: #{@tracking_id}, crid: #{@crid}, amount: #{@amount}, reason: #{@reason},"\ " description: #{@description}, name: #{@name}, status: #{@status}, submission_date:"\ " #{@submission_date}, dispute_valid: #{@dispute_valid}, payment_response:"\ " #{@payment_response}, acct_mgmt_response: #{@acct_mgmt_response}, additional_properties:"\ " #{@additional_properties}>" end |