Class: UnivapayClientSdk::StoresApi

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

Overview

StoresApi

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_store(id) ⇒ ApiResponse

Returns a single store plus its resolved configuration snapshot for the current merchant context. resource.

Parameters:

  • id (UUID | String)

    Required parameter: The unique identifier of the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/univapay_client_sdk/apis/stores_api.rb', line 79

def get_store(id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/stores/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .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(Store.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('404',
                                      'HTTP 404 Not Found: {$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('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

#list_stores(limit: 10, cursor: nil, cursor_direction: CursorDirectionQuery::DESC, short_id: nil, search: nil) ⇒ ApiResponse

Returns stores visible to the current merchant credential. Supports cursor pagination plus short_id and free-text search filters. return in one page. resource after which pagination should continue. Pagination direction relative to the supplied cursor. search.

Parameters:

  • limit (Integer) (defaults to: 10)

    Optional parameter: Maximum number of resources to

  • cursor (UUID | String) (defaults to: nil)

    Optional parameter: Cursor pointing to the

  • cursor_direction (CursorDirectionQuery) (defaults to: CursorDirectionQuery::DESC)

    Optional parameter:

  • short_id (String) (defaults to: nil)

    Optional parameter: Filter by short identifier.

  • search (String) (defaults to: nil)

    Optional parameter: Case-insensitive free-text

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/univapay_client_sdk/apis/stores_api.rb', line 21

def list_stores(limit: 10,
                cursor: nil,
                cursor_direction: CursorDirectionQuery::DESC,
                short_id: nil,
                search: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/stores',
                                 Server::DEFAULT)
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .query_param(new_parameter(cursor_direction, key: 'cursor_direction'))
               .query_param(new_parameter(short_id, key: 'short_id'))
               .query_param(new_parameter(search, key: 'search'))
               .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(StoreList.method(:from_hash))
                .is_api_response(true)
                .local_error_template('400',
                                      'HTTP 400 Bad Request: {$response.body#/code}',
                                      ApiErrorException)
                .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('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