Class: UnivapayClientSdk::MerchantsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/univapay_client_sdk/apis/merchants_api.rb

Overview

MerchantsApi

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 UnivapayClientSdk::BaseApi

Instance Method Details

#get_current_merchantApiResponse

Returns merchant identity and the effective configuration resolved from bearer credentials. Treat this as the canonical introspection endpoint for merchant integrations.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



13
14
15
16
17
18
19
20
21
22
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
# File 'lib/univapay_client_sdk/apis/merchants_api.rb', line 13

def get_current_merchant
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/me',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('JWT_TOKEN')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Merchant.method(:from_hash))
                .is_api_response(true)
                .local_error_template('401',
                                      'HTTP 401 Unauthorized: {$response.body#/code}',
                                      ApiErrorException)
                .local_error_template('403',
                                      'HTTP 403 Forbidden: {$response.body#/code}',
                                      ApiErrorException)
                .local_error_template('429',
                                      'HTTP 429 Rate Limited: {$response.body#/code}',
                                      APIException)
                .local_error_template('400',
                                      'HTTP 400 Bad Request: {$response.body#/code}',
                                      APIException)
                .local_error_template('404',
                                      'HTTP 404 Not Found: {$response.body#/code}',
                                      APIException)
                .local_error_template('409',
                                      'HTTP 409 Conflict: {$response.body#/code}',
                                      APIException)
                .local_error_template('500',
                                      'HTTP 500 Server Error: {$response.body#/code}',
                                      APIException)
                .local_error_template('503',
                                      'HTTP 503 Unavailable: {$response.body#/code}',
                                      APIException)
                .local_error_template('504',
                                      'HTTP 504 Timeout: {$response.body#/code}',
                                      APIException)
                .local_error_template('default',
                                      'HTTP {$statusCode}: {$response.body#/code}',
                                      APIException))
    .execute
end