Class: Batches::GetABatchApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/batches/apis/get_a_batch_api.rb

Overview

GetABatchApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from Batches::BaseApi

Instance Method Details

#get_single_batch(id, authorization, x_gp_version, accept: 'application/json') ⇒ ApiResponse

Get a single view of a Batch using the Global Payments Batch id. Availability of this feature in production depends on your allowed live configuration. Please contact Global Payments before coding this feature to confirm it will be available to you when you go live. value used to authorize and access the API. Must always begin with the string "Bearer". execute the request. of the message response.

Parameters:

  • id (String)

    Required parameter: TODO: type description here

  • authorization (String)

    Required parameter: Bearer access token

  • x_gp_version (String)

    Required parameter: The version of the API to

  • accept (String) (defaults to: 'application/json')

    Optional parameter: Indicates the expected format

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/batches/apis/get_a_batch_api.rb', line 23

def get_single_batch(id,
                     authorization,
                     x_gp_version,
                     accept: 'application/json')
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/batches/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(authorization, key: 'Authorization')
                              .is_required(true))
               .header_param(new_parameter(x_gp_version, key: 'X-GP-Version')
                              .is_required(true))
               .header_param(new_parameter(accept, key: 'Accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(GetResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             Batches400ErrorException)
                .local_error('401',
                             'Not Authenticated',
                             Batches401ErrorException)
                .local_error('403',
                             'Forbidden',
                             Batches403ErrorException)
                .local_error('404',
                             'Resource Not Found',
                             APIException)
                .local_error('500',
                             'Internal Server Error',
                             Batches500ErrorException)
                .local_error('501',
                             'Not implemented',
                             Batches501ErrorException)
                .local_error('502',
                             'Bad Gateway',
                             Batches502ErrorException)
                .local_error('504',
                             'Timeout',
                             Batches504ErrorException))
    .execute
end