Class: NewStoreApi::SettingsController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/settings_controller.rb

Overview

SettingsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

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

Constructor Details

This class inherits a constructor from NewStoreApi::BaseController

Instance Method Details

#show_global_platform_settingsSettingsResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Returns the current global-scoped settings for the tenant, aggregated across all active config declarations.

Returns:



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/new_store_api/controllers/settings_controller.rb', line 49

def show_global_platform_settings
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/retail-org/settings',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SettingsResponse.method(:from_hash)))
    .execute
end

#show_platform_operation(operation_id) ⇒ OperationResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Returns the current status of an asynchronous write operation. identifier returned by a write request.

Parameters:

  • operation_id (UUID | String)

    Required parameter: The operation

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/new_store_api/controllers/settings_controller.rb', line 22

def show_platform_operation(operation_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/retail-org/operations/{operationId}',
                                 Server::API)
               .template_param(new_parameter(operation_id, key: 'operationId')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(OperationResponse.method(:from_hash)))
    .execute
end

#show_store_platform_settings(store_id) ⇒ SettingsResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Returns the current store-scoped settings for a specific store, aggregated across all active config declarations.

Parameters:

  • store_id (String)

    Required parameter: The store identifier.

Returns:



110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/new_store_api/controllers/settings_controller.rb', line 110

def show_store_platform_settings(store_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/retail-org/settings/stores/{storeId}',
                                 Server::API)
               .template_param(new_parameter(store_id, key: 'storeId')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SettingsResponse.method(:from_hash)))
    .execute
end

#update_global_platform_settings(body, if_match: nil) ⇒ WriteAccepted

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Submits a partial update to global-scoped settings. The write is validated and executed asynchronously. Returns 202 with an operation ID on success. declaration key. previous read (e.g. "v42"). If provided, the write is rejected with 409 if the current version does not match.

Parameters:

  • body (Object)

    Required parameter: Partial settings update keyed by

  • if_match (String) (defaults to: nil)

    Optional parameter: Version string from a

Returns:



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/new_store_api/controllers/settings_controller.rb', line 79

def update_global_platform_settings(body,
                                    if_match: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/retail-org/settings',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter(if_match, key: 'If-Match'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(APIHelper.method(:json_serialize))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(WriteAccepted.method(:from_hash)))
    .execute
end

#update_store_platform_settings(store_id, body, if_match: nil) ⇒ WriteAccepted

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Submits a partial update to store-scoped settings for a specific store. The write is validated and executed asynchronously. Returns 202 with an operation ID on success. declaration key. previous read (e.g. "v42"). If provided, the write is rejected with 409 if the current version does not match.

Parameters:

  • store_id (String)

    Required parameter: The store identifier.

  • body (Object)

    Required parameter: Partial settings update keyed by

  • if_match (String) (defaults to: nil)

    Optional parameter: Version string from a

Returns:



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/new_store_api/controllers/settings_controller.rb', line 144

def update_store_platform_settings(store_id,
                                   body,
                                   if_match: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/retail-org/settings/stores/{storeId}',
                                 Server::API)
               .template_param(new_parameter(store_id, key: 'storeId')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter(if_match, key: 'If-Match'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(APIHelper.method(:json_serialize))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(WriteAccepted.method(:from_hash)))
    .execute
end