Class: Batches::GetResponse
- Defined in:
- lib/batches/models/get_response.rb
Overview
GetResponse Model.
Instance Attribute Summary collapse
-
#account_id ⇒ String
A unique identifier that is used to identify and reference an instance of this resource.
-
#account_name ⇒ String
A meaningful label that better identifies the account.
-
#action ⇒ Action
The amount that is an aggregation of all the transactions' gratuity amounts in the batch.
-
#amount ⇒ String
The batch amount that is an aggregation of all the transactions' amounts in the batch.
-
#batch_transaction_count ⇒ Float
The number of transactions in the batch.
-
#brand_breakdown ⇒ Array[BrandBreakdownItem]
The amount that is an aggregation of all the transactions' gratuity amounts in the batch.
-
#close_action_id ⇒ String
An identifier generated by Global Payments to uniquely identify the action that closed the batch.
-
#currency ⇒ String
The currency of the amount in ISO-4217(alpha-3).
-
#device_reference ⇒ String
A reference for the device that created the batch.
-
#funding_credit ⇒ FundingCredit
The amount that is an aggregation of all the transactions' gratuity amounts in the batch.
-
#funding_debit ⇒ FundingDebit
The amount that is an aggregation of all the transactions' gratuity amounts in the batch.
-
#gratuity_amount ⇒ String
The amount that is an aggregation of all the transactions' gratuity amounts in the batch.
-
#id ⇒ String
A unique identifier for the object created by Global Payments.
-
#merchant_id ⇒ String
A unique identifier that is used to identify and reference an instance of this resource.
-
#merchant_name ⇒ String
A meaningful label that better identifies the merchant.
-
#open_action_id ⇒ String
An identifier generated by Global Payments to uniquely identify the action that opened the batch.
-
#refunds ⇒ Refunds
The amount that is an aggregation of all the transactions' gratuity amounts in the batch.
-
#sales ⇒ Sales
The amount that is an aggregation of all the transactions' gratuity amounts in the batch.
-
#site_reference ⇒ String
A reference for the location that created the batch.
-
#status ⇒ StatusBatchesStatus
Indicates where a batch is in its life cycle.
-
#time_closed ⇒ String
Time indicating when the batch was closed.
-
#time_created ⇒ String
Time indicating when the batch was created in ISO-8601 format..
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(id: SKIP, status: SKIP, time_created: SKIP, time_closed: SKIP, open_action_id: SKIP, close_action_id: SKIP, merchant_id: SKIP, merchant_name: SKIP, account_id: SKIP, account_name: SKIP, site_reference: SKIP, device_reference: SKIP, batch_transaction_count: SKIP, amount: SKIP, currency: SKIP, gratuity_amount: SKIP, sales: SKIP, refunds: SKIP, funding_debit: SKIP, funding_credit: SKIP, brand_breakdown: SKIP, action: SKIP, additional_properties: nil) ⇒ GetResponse
constructor
A new instance of GetResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(id: SKIP, status: SKIP, time_created: SKIP, time_closed: SKIP, open_action_id: SKIP, close_action_id: SKIP, merchant_id: SKIP, merchant_name: SKIP, account_id: SKIP, account_name: SKIP, site_reference: SKIP, device_reference: SKIP, batch_transaction_count: SKIP, amount: SKIP, currency: SKIP, gratuity_amount: SKIP, sales: SKIP, refunds: SKIP, funding_debit: SKIP, funding_credit: SKIP, brand_breakdown: SKIP, action: SKIP, additional_properties: nil) ⇒ GetResponse
Returns a new instance of GetResponse.
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 215 216 217 218 219 220 221 222 |
# File 'lib/batches/models/get_response.rb', line 186 def initialize(id: SKIP, status: SKIP, time_created: SKIP, time_closed: SKIP, open_action_id: SKIP, close_action_id: SKIP, merchant_id: SKIP, merchant_name: SKIP, account_id: SKIP, account_name: SKIP, site_reference: SKIP, device_reference: SKIP, batch_transaction_count: SKIP, amount: SKIP, currency: SKIP, gratuity_amount: SKIP, sales: SKIP, refunds: SKIP, funding_debit: SKIP, funding_credit: SKIP, brand_breakdown: SKIP, action: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id unless id == SKIP @status = status unless status == SKIP @time_created = time_created unless time_created == SKIP @time_closed = time_closed unless time_closed == SKIP @open_action_id = open_action_id unless open_action_id == SKIP @close_action_id = close_action_id unless close_action_id == SKIP @merchant_id = merchant_id unless merchant_id == SKIP @merchant_name = merchant_name unless merchant_name == SKIP @account_id = account_id unless account_id == SKIP @account_name = account_name unless account_name == SKIP @site_reference = site_reference unless site_reference == SKIP @device_reference = device_reference unless device_reference == SKIP @batch_transaction_count = batch_transaction_count unless batch_transaction_count == SKIP @amount = amount unless amount == SKIP @currency = currency unless currency == SKIP @gratuity_amount = gratuity_amount unless gratuity_amount == SKIP @sales = sales unless sales == SKIP @refunds = refunds unless refunds == SKIP @funding_debit = funding_debit unless funding_debit == SKIP @funding_credit = funding_credit unless funding_credit == SKIP @brand_breakdown = brand_breakdown unless brand_breakdown == SKIP @action = action unless action == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#account_id ⇒ String
A unique identifier that is used to identify and reference an instance of this resource. This id is used when actioning or referencing a specific account. Begins with the three letters, TRA.
55 56 57 |
# File 'lib/batches/models/get_response.rb', line 55 def account_id @account_id end |
#account_name ⇒ String
A meaningful label that better identifies the account.
59 60 61 |
# File 'lib/batches/models/get_response.rb', line 59 def account_name @account_name end |
#action ⇒ Action
The amount that is an aggregation of all the transactions' gratuity amounts in the batch. It is always represented in the lowest denomination of the related currency.
123 124 125 |
# File 'lib/batches/models/get_response.rb', line 123 def action @action end |
#amount ⇒ String
The batch amount that is an aggregation of all the transactions' amounts in the batch. It is always represented in the lowest denomination of the related currency.
77 78 79 |
# File 'lib/batches/models/get_response.rb', line 77 def amount @amount end |
#batch_transaction_count ⇒ Float
The number of transactions in the batch.
71 72 73 |
# File 'lib/batches/models/get_response.rb', line 71 def batch_transaction_count @batch_transaction_count end |
#brand_breakdown ⇒ Array[BrandBreakdownItem]
The amount that is an aggregation of all the transactions' gratuity amounts in the batch. It is always represented in the lowest denomination of the related currency.
117 118 119 |
# File 'lib/batches/models/get_response.rb', line 117 def brand_breakdown @brand_breakdown end |
#close_action_id ⇒ String
An identifier generated by Global Payments to uniquely identify the action that closed the batch.
39 40 41 |
# File 'lib/batches/models/get_response.rb', line 39 def close_action_id @close_action_id end |
#currency ⇒ String
The currency of the amount in ISO-4217(alpha-3)
81 82 83 |
# File 'lib/batches/models/get_response.rb', line 81 def currency @currency end |
#device_reference ⇒ String
A reference for the device that created the batch
67 68 69 |
# File 'lib/batches/models/get_response.rb', line 67 def device_reference @device_reference end |
#funding_credit ⇒ FundingCredit
The amount that is an aggregation of all the transactions' gratuity amounts in the batch. It is always represented in the lowest denomination of the related currency.
111 112 113 |
# File 'lib/batches/models/get_response.rb', line 111 def funding_credit @funding_credit end |
#funding_debit ⇒ FundingDebit
The amount that is an aggregation of all the transactions' gratuity amounts in the batch. It is always represented in the lowest denomination of the related currency.
105 106 107 |
# File 'lib/batches/models/get_response.rb', line 105 def funding_debit @funding_debit end |
#gratuity_amount ⇒ String
The amount that is an aggregation of all the transactions' gratuity amounts in the batch. It is always represented in the lowest denomination of the related currency.
87 88 89 |
# File 'lib/batches/models/get_response.rb', line 87 def gratuity_amount @gratuity_amount end |
#id ⇒ String
A unique identifier for the object created by Global Payments. The first 3 characters identifies the resource an id relates to.
15 16 17 |
# File 'lib/batches/models/get_response.rb', line 15 def id @id end |
#merchant_id ⇒ String
A unique identifier that is used to identify and reference an instance of this resource. This id is used when actioning or referencing a specific merchant. Begins with the three letters, MER.
45 46 47 |
# File 'lib/batches/models/get_response.rb', line 45 def merchant_id @merchant_id end |
#merchant_name ⇒ String
A meaningful label that better identifies the merchant.
49 50 51 |
# File 'lib/batches/models/get_response.rb', line 49 def merchant_name @merchant_name end |
#open_action_id ⇒ String
An identifier generated by Global Payments to uniquely identify the action that opened the batch.
34 35 36 |
# File 'lib/batches/models/get_response.rb', line 34 def open_action_id @open_action_id end |
#refunds ⇒ Refunds
The amount that is an aggregation of all the transactions' gratuity amounts in the batch. It is always represented in the lowest denomination of the related currency.
99 100 101 |
# File 'lib/batches/models/get_response.rb', line 99 def refunds @refunds end |
#sales ⇒ Sales
The amount that is an aggregation of all the transactions' gratuity amounts in the batch. It is always represented in the lowest denomination of the related currency.
93 94 95 |
# File 'lib/batches/models/get_response.rb', line 93 def sales @sales end |
#site_reference ⇒ String
A reference for the location that created the batch.
63 64 65 |
# File 'lib/batches/models/get_response.rb', line 63 def site_reference @site_reference end |
#status ⇒ StatusBatchesStatus
Indicates where a batch is in its life cycle. *OPEN - Batch is open and
can accept more transactions.
*CLOSED - Batch is closed and cannot accept more transactions.
21 22 23 |
# File 'lib/batches/models/get_response.rb', line 21 def status @status end |
#time_closed ⇒ String
Time indicating when the batch was closed
29 30 31 |
# File 'lib/batches/models/get_response.rb', line 29 def time_closed @time_closed end |
#time_created ⇒ String
Time indicating when the batch was created in ISO-8601 format..
25 26 27 |
# File 'lib/batches/models/get_response.rb', line 25 def time_created @time_created end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/batches/models/get_response.rb', line 225 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP time_created = hash.key?('time_created') ? hash['time_created'] : SKIP time_closed = hash.key?('time_closed') ? hash['time_closed'] : SKIP open_action_id = hash.key?('open_action_id') ? hash['open_action_id'] : SKIP close_action_id = hash.key?('close_action_id') ? hash['close_action_id'] : SKIP merchant_id = hash.key?('merchant_id') ? hash['merchant_id'] : SKIP merchant_name = hash.key?('merchant_name') ? hash['merchant_name'] : SKIP account_id = hash.key?('account_id') ? hash['account_id'] : SKIP account_name = hash.key?('account_name') ? hash['account_name'] : SKIP site_reference = hash.key?('site_reference') ? hash['site_reference'] : SKIP device_reference = hash.key?('device_reference') ? hash['device_reference'] : SKIP batch_transaction_count = hash.key?('batch_transaction_count') ? hash['batch_transaction_count'] : SKIP amount = hash.key?('amount') ? hash['amount'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP gratuity_amount = hash.key?('gratuity_amount') ? hash['gratuity_amount'] : SKIP sales = Sales.from_hash(hash['sales']) if hash['sales'] refunds = Refunds.from_hash(hash['refunds']) if hash['refunds'] funding_debit = FundingDebit.from_hash(hash['funding_debit']) if hash['funding_debit'] funding_credit = FundingCredit.from_hash(hash['funding_credit']) if hash['funding_credit'] # Parameter is an array, so we need to iterate through it brand_breakdown = nil unless hash['brand_breakdown'].nil? brand_breakdown = [] hash['brand_breakdown'].each do |structure| brand_breakdown << (BrandBreakdownItem.from_hash(structure) if structure) end end brand_breakdown = SKIP unless hash.key?('brand_breakdown') action = Action.from_hash(hash['action']) if hash['action'] # 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. GetResponse.new(id: id, status: status, time_created: time_created, time_closed: time_closed, open_action_id: open_action_id, close_action_id: close_action_id, merchant_id: merchant_id, merchant_name: merchant_name, account_id: account_id, account_name: account_name, site_reference: site_reference, device_reference: device_reference, batch_transaction_count: batch_transaction_count, amount: amount, currency: currency, gratuity_amount: gratuity_amount, sales: sales, refunds: refunds, funding_debit: funding_debit, funding_credit: funding_credit, brand_breakdown: brand_breakdown, action: action, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
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 |
# File 'lib/batches/models/get_response.rb', line 126 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['status'] = 'status' @_hash['time_created'] = 'time_created' @_hash['time_closed'] = 'time_closed' @_hash['open_action_id'] = 'open_action_id' @_hash['close_action_id'] = 'close_action_id' @_hash['merchant_id'] = 'merchant_id' @_hash['merchant_name'] = 'merchant_name' @_hash['account_id'] = 'account_id' @_hash['account_name'] = 'account_name' @_hash['site_reference'] = 'site_reference' @_hash['device_reference'] = 'device_reference' @_hash['batch_transaction_count'] = 'batch_transaction_count' @_hash['amount'] = 'amount' @_hash['currency'] = 'currency' @_hash['gratuity_amount'] = 'gratuity_amount' @_hash['sales'] = 'sales' @_hash['refunds'] = 'refunds' @_hash['funding_debit'] = 'funding_debit' @_hash['funding_credit'] = 'funding_credit' @_hash['brand_breakdown'] = 'brand_breakdown' @_hash['action'] = 'action' @_hash end |
.nullables ⇒ Object
An array for nullable fields
182 183 184 |
# File 'lib/batches/models/get_response.rb', line 182 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
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 |
# File 'lib/batches/models/get_response.rb', line 154 def self.optionals %w[ id status time_created time_closed open_action_id close_action_id merchant_id merchant_name account_id account_name site_reference device_reference batch_transaction_count amount currency gratuity_amount sales refunds funding_debit funding_credit brand_breakdown action ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/batches/models/get_response.rb', line 316 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, status: #{@status.inspect}, time_created:"\ " #{@time_created.inspect}, time_closed: #{@time_closed.inspect}, open_action_id:"\ " #{@open_action_id.inspect}, close_action_id: #{@close_action_id.inspect}, merchant_id:"\ " #{@merchant_id.inspect}, merchant_name: #{@merchant_name.inspect}, account_id:"\ " #{@account_id.inspect}, account_name: #{@account_name.inspect}, site_reference:"\ " #{@site_reference.inspect}, device_reference: #{@device_reference.inspect},"\ " batch_transaction_count: #{@batch_transaction_count.inspect}, amount: #{@amount.inspect},"\ " currency: #{@currency.inspect}, gratuity_amount: #{@gratuity_amount.inspect}, sales:"\ " #{@sales.inspect}, refunds: #{@refunds.inspect}, funding_debit: #{@funding_debit.inspect},"\ " funding_credit: #{@funding_credit.inspect}, brand_breakdown: #{@brand_breakdown.inspect},"\ " action: #{@action.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/batches/models/get_response.rb', line 301 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, status: #{@status}, time_created: #{@time_created},"\ " time_closed: #{@time_closed}, open_action_id: #{@open_action_id}, close_action_id:"\ " #{@close_action_id}, merchant_id: #{@merchant_id}, merchant_name: #{@merchant_name},"\ " account_id: #{@account_id}, account_name: #{@account_name}, site_reference:"\ " #{@site_reference}, device_reference: #{@device_reference}, batch_transaction_count:"\ " #{@batch_transaction_count}, amount: #{@amount}, currency: #{@currency}, gratuity_amount:"\ " #{@gratuity_amount}, sales: #{@sales}, refunds: #{@refunds}, funding_debit:"\ " #{@funding_debit}, funding_credit: #{@funding_credit}, brand_breakdown:"\ " #{@brand_breakdown}, action: #{@action}, additional_properties:"\ " #{@additional_properties}>" end |