Class: UspsApi::CancelIntelligentMailBarcodeResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/usps_api/models/cancel_intelligent_mail_barcode_response.rb

Overview

Cancel Intelligent Mail Barcode (IMB) Response

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(imb: SKIP, status: SKIP, dispute_id: SKIP, additional_properties: nil) ⇒ CancelIntelligentMailBarcodeResponse

Returns a new instance of CancelIntelligentMailBarcodeResponse.



60
61
62
63
64
65
66
67
68
69
# File 'lib/usps_api/models/cancel_intelligent_mail_barcode_response.rb', line 60

def initialize(imb: SKIP, status: SKIP, dispute_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @imb = imb unless imb == SKIP
  @status = status unless status == SKIP
  @dispute_id = dispute_id unless dispute_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#dispute_idString

The Id of the submitted refund request. Note:

  • The disputeId field may not be returned for IMBs created prior to

8/27/2025.

  • If a refund request is successfully submitted, a disputeId will be

returned that can be used to then track the status of the refund request. The system will only give one unique disputeId per customer reference ID (CRID) per day. Duplicate submissions of the same label, for the same CRID, on the same day, will be rejected.

  • In some cases, a disputeId may be generated before the IMB is processed

for payment. If this occurs, please resubmit the IMB for cancellation the following day for a new disputeId.

Returns:

  • (String)


35
36
37
# File 'lib/usps_api/models/cancel_intelligent_mail_barcode_response.rb', line 35

def dispute_id
  @dispute_id
end

#imbString

The Human-readable form of the Intelligent Mail Barcode (IMB) that has been canceled or for which a refund request has been submitted.

Returns:

  • (String)


15
16
17
# File 'lib/usps_api/models/cancel_intelligent_mail_barcode_response.rb', line 15

def imb
  @imb
end

#statusStatus2

  • CANCELED indicates that the IMB has been successfully canceled.

  • DISPUTED indicates that a refund request has been submitted.

Returns:



20
21
22
# File 'lib/usps_api/models/cancel_intelligent_mail_barcode_response.rb', line 20

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/usps_api/models/cancel_intelligent_mail_barcode_response.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  imb = hash.key?('imb') ? hash['imb'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  dispute_id = hash.key?('disputeId') ? hash['disputeId'] : 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.
  CancelIntelligentMailBarcodeResponse.new(imb: imb,
                                           status: status,
                                           dispute_id: dispute_id,
                                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
# File 'lib/usps_api/models/cancel_intelligent_mail_barcode_response.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['imb'] = 'imb'
  @_hash['status'] = 'status'
  @_hash['dispute_id'] = 'disputeId'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/usps_api/models/cancel_intelligent_mail_barcode_response.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



47
48
49
50
51
52
53
# File 'lib/usps_api/models/cancel_intelligent_mail_barcode_response.rb', line 47

def self.optionals
  %w[
    imb
    status
    dispute_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



102
103
104
105
106
# File 'lib/usps_api/models/cancel_intelligent_mail_barcode_response.rb', line 102

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} imb: #{@imb.inspect}, status: #{@status.inspect}, dispute_id:"\
  " #{@dispute_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



95
96
97
98
99
# File 'lib/usps_api/models/cancel_intelligent_mail_barcode_response.rb', line 95

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} imb: #{@imb}, status: #{@status}, dispute_id: #{@dispute_id},"\
  " additional_properties: #{@additional_properties}>"
end