Class: UspsApi::Detail1

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

Overview

Details about the payment transaction.

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(customer_reference_number1: SKIP, customer_reference_number2: SKIP, crid: SKIP, mailer_id: SKIP, mail_class_code: SKIP, pic: SKIP, impb: SKIP, package_scan_grouping_id: SKIP, manifest_package_id: SKIP, census_piece_postage: SKIP, eps_account_number: SKIP, eps_transaction_id: SKIP, eps_transaction_time: SKIP, eps_total_postage: SKIP, trans_type: SKIP, additional_properties: nil) ⇒ Detail1

Returns a new instance of Detail1.



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/usps_api/models/detail1.rb', line 121

def initialize(customer_reference_number1: SKIP,
               customer_reference_number2: SKIP, crid: SKIP,
               mailer_id: SKIP, mail_class_code: SKIP, pic: SKIP,
               impb: SKIP, package_scan_grouping_id: SKIP,
               manifest_package_id: SKIP, census_piece_postage: SKIP,
               eps_account_number: SKIP, eps_transaction_id: SKIP,
               eps_transaction_time: SKIP, eps_total_postage: SKIP,
               trans_type: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  unless customer_reference_number1 == SKIP
    @customer_reference_number1 =
      customer_reference_number1
  end
  unless customer_reference_number2 == SKIP
    @customer_reference_number2 =
      customer_reference_number2
  end
  @crid = crid unless crid == SKIP
  @mailer_id = mailer_id unless mailer_id == SKIP
  @mail_class_code = mail_class_code unless mail_class_code == SKIP
  @pic = pic unless pic == SKIP
  @impb = impb unless impb == SKIP
  @package_scan_grouping_id = package_scan_grouping_id unless package_scan_grouping_id == SKIP
  @manifest_package_id = manifest_package_id unless manifest_package_id == SKIP
  @census_piece_postage = census_piece_postage unless census_piece_postage == SKIP
  @eps_account_number =  unless  == SKIP
  @eps_transaction_id = eps_transaction_id unless eps_transaction_id == SKIP
  @eps_transaction_time = eps_transaction_time unless eps_transaction_time == SKIP
  @eps_total_postage = eps_total_postage unless eps_total_postage == SKIP
  @trans_type = trans_type unless trans_type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#census_piece_postageFloat

Postage amount for the census piece.

Returns:

  • (Float)


51
52
53
# File 'lib/usps_api/models/detail1.rb', line 51

def census_piece_postage
  @census_piece_postage
end

#cridString

Customer Registration ID (CRID) of the mail owner.

Returns:

  • (String)


23
24
25
# File 'lib/usps_api/models/detail1.rb', line 23

def crid
  @crid
end

#customer_reference_number1String

Customer Reference Number 1.

Returns:

  • (String)


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

def customer_reference_number1
  @customer_reference_number1
end

#customer_reference_number2String

Customer Reference Number 2.

Returns:

  • (String)


19
20
21
# File 'lib/usps_api/models/detail1.rb', line 19

def customer_reference_number2
  @customer_reference_number2
end

#eps_account_numberString

EPS account number associated with the transaction.

Returns:

  • (String)


55
56
57
# File 'lib/usps_api/models/detail1.rb', line 55

def 
  @eps_account_number
end

#eps_total_postageFloat

Total postage amount for the EPS transaction.

Returns:

  • (Float)


68
69
70
# File 'lib/usps_api/models/detail1.rb', line 68

def eps_total_postage
  @eps_total_postage
end

#eps_transaction_idString

EPS Transaction ID for the payment transaction.

Returns:

  • (String)


59
60
61
# File 'lib/usps_api/models/detail1.rb', line 59

def eps_transaction_id
  @eps_transaction_id
end

#eps_transaction_timeDateTime

Date and time of the EPS transaction in ISO 8601 format with milliseconds, but without a timezone designator.

Returns:

  • (DateTime)


64
65
66
# File 'lib/usps_api/models/detail1.rb', line 64

def eps_transaction_time
  @eps_transaction_time
end

#impbString

IMpb barcode for the package.

Returns:

  • (String)


39
40
41
# File 'lib/usps_api/models/detail1.rb', line 39

def impb
  @impb
end

#mail_class_codeString

Mail Class Code indicating the type of mail service used.

Returns:

  • (String)


31
32
33
# File 'lib/usps_api/models/detail1.rb', line 31

def mail_class_code
  @mail_class_code
end

#mailer_idString

Mailer ID associated with the package.

Returns:

  • (String)


27
28
29
# File 'lib/usps_api/models/detail1.rb', line 27

def mailer_id
  @mailer_id
end

#manifest_package_idString

Manifest Package ID for the package.

Returns:

  • (String)


47
48
49
# File 'lib/usps_api/models/detail1.rb', line 47

def manifest_package_id
  @manifest_package_id
end

#package_scan_grouping_idString

Package Scan Grouping ID.

Returns:

  • (String)


43
44
45
# File 'lib/usps_api/models/detail1.rb', line 43

def package_scan_grouping_id
  @package_scan_grouping_id
end

#picString

Package Identification Code.

Returns:

  • (String)


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

def pic
  @pic
end

#trans_typeString

Type of the transaction.

Returns:

  • (String)


72
73
74
# File 'lib/usps_api/models/detail1.rb', line 72

def trans_type
  @trans_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/usps_api/models/detail1.rb', line 157

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  customer_reference_number1 =
    hash.key?('customerReferenceNumber1') ? hash['customerReferenceNumber1'] : SKIP
  customer_reference_number2 =
    hash.key?('customerReferenceNumber2') ? hash['customerReferenceNumber2'] : SKIP
  crid = hash.key?('CRID') ? hash['CRID'] : SKIP
  mailer_id = hash.key?('mailerID') ? hash['mailerID'] : SKIP
  mail_class_code =
    hash.key?('mailClassCode') ? hash['mailClassCode'] : SKIP
  pic = hash.key?('PIC') ? hash['PIC'] : SKIP
  impb = hash.key?('IMPB') ? hash['IMPB'] : SKIP
  package_scan_grouping_id =
    hash.key?('packageScanGroupingID') ? hash['packageScanGroupingID'] : SKIP
  manifest_package_id =
    hash.key?('manifestPackageID') ? hash['manifestPackageID'] : SKIP
  census_piece_postage =
    hash.key?('censusPiecePostage') ? hash['censusPiecePostage'] : SKIP
   =
    hash.key?('EPSAccountNumber') ? hash['EPSAccountNumber'] : SKIP
  eps_transaction_id =
    hash.key?('EPSTransactionID') ? hash['EPSTransactionID'] : SKIP
  eps_transaction_time = if hash.key?('EPSTransactionTime')
                           (DateTimeHelper.from_rfc3339(hash['EPSTransactionTime']) if hash['EPSTransactionTime'])
                         else
                           SKIP
                         end
  eps_total_postage =
    hash.key?('EPSTotalPostage') ? hash['EPSTotalPostage'] : SKIP
  trans_type = hash.key?('transType') ? hash['transType'] : 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.
  Detail1.new(customer_reference_number1: customer_reference_number1,
              customer_reference_number2: customer_reference_number2,
              crid: crid,
              mailer_id: mailer_id,
              mail_class_code: mail_class_code,
              pic: pic,
              impb: impb,
              package_scan_grouping_id: package_scan_grouping_id,
              manifest_package_id: manifest_package_id,
              census_piece_postage: census_piece_postage,
              eps_account_number: ,
              eps_transaction_id: eps_transaction_id,
              eps_transaction_time: eps_transaction_time,
              eps_total_postage: eps_total_postage,
              trans_type: trans_type,
              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['customer_reference_number1'] = 'customerReferenceNumber1'
  @_hash['customer_reference_number2'] = 'customerReferenceNumber2'
  @_hash['crid'] = 'CRID'
  @_hash['mailer_id'] = 'mailerID'
  @_hash['mail_class_code'] = 'mailClassCode'
  @_hash['pic'] = 'PIC'
  @_hash['impb'] = 'IMPB'
  @_hash['package_scan_grouping_id'] = 'packageScanGroupingID'
  @_hash['manifest_package_id'] = 'manifestPackageID'
  @_hash['census_piece_postage'] = 'censusPiecePostage'
  @_hash['eps_account_number'] = 'EPSAccountNumber'
  @_hash['eps_transaction_id'] = 'EPSTransactionID'
  @_hash['eps_transaction_time'] = 'EPSTransactionTime'
  @_hash['eps_total_postage'] = 'EPSTotalPostage'
  @_hash['trans_type'] = 'transType'
  @_hash
end

.nullablesObject

An array for nullable fields



117
118
119
# File 'lib/usps_api/models/detail1.rb', line 117

def self.nullables
  []
end

.optionalsObject

An array for optional fields



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/usps_api/models/detail1.rb', line 96

def self.optionals
  %w[
    customer_reference_number1
    customer_reference_number2
    crid
    mailer_id
    mail_class_code
    pic
    impb
    package_scan_grouping_id
    manifest_package_id
    census_piece_postage
    eps_account_number
    eps_transaction_id
    eps_transaction_time
    eps_total_postage
    trans_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/usps_api/models/detail1.rb', line 234

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} customer_reference_number1: #{@customer_reference_number1.inspect},"\
  " customer_reference_number2: #{@customer_reference_number2.inspect}, crid:"\
  " #{@crid.inspect}, mailer_id: #{@mailer_id.inspect}, mail_class_code:"\
  " #{@mail_class_code.inspect}, pic: #{@pic.inspect}, impb: #{@impb.inspect},"\
  " package_scan_grouping_id: #{@package_scan_grouping_id.inspect}, manifest_package_id:"\
  " #{@manifest_package_id.inspect}, census_piece_postage: #{@census_piece_postage.inspect},"\
  " eps_account_number: #{@eps_account_number.inspect}, eps_transaction_id:"\
  " #{@eps_transaction_id.inspect}, eps_transaction_time: #{@eps_transaction_time.inspect},"\
  " eps_total_postage: #{@eps_total_postage.inspect}, trans_type: #{@trans_type.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_eps_transaction_timeObject



216
217
218
# File 'lib/usps_api/models/detail1.rb', line 216

def to_custom_eps_transaction_time
  DateTimeHelper.to_rfc3339(eps_transaction_time)
end

#to_sObject

Provides a human-readable string representation of the object.



221
222
223
224
225
226
227
228
229
230
231
# File 'lib/usps_api/models/detail1.rb', line 221

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} customer_reference_number1: #{@customer_reference_number1},"\
  " customer_reference_number2: #{@customer_reference_number2}, crid: #{@crid}, mailer_id:"\
  " #{@mailer_id}, mail_class_code: #{@mail_class_code}, pic: #{@pic}, impb: #{@impb},"\
  " package_scan_grouping_id: #{@package_scan_grouping_id}, manifest_package_id:"\
  " #{@manifest_package_id}, census_piece_postage: #{@census_piece_postage},"\
  " eps_account_number: #{@eps_account_number}, eps_transaction_id: #{@eps_transaction_id},"\
  " eps_transaction_time: #{@eps_transaction_time}, eps_total_postage: #{@eps_total_postage},"\
  " trans_type: #{@trans_type}, additional_properties: #{@additional_properties}>"
end