Class: NewStoreApi::TppeController

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

Overview

TppeController

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_configuration(section_id) ⇒ IntegrationConfig

Retrieves configuration. here

Parameters:

  • section_id (String)

    Required parameter: TODO: type description

Returns:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/new_store_api/controllers/tppe_controller.rb', line 13

def show_configuration(section_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/promotions/configurations/{section-id}',
                                 Server::API)
               .template_param(new_parameter(section_id, key: 'section-id')
                                .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(IntegrationConfig.method(:from_hash)))
    .execute
end

#update_configuration(section_id, body: nil) ⇒ void

This method returns an undefined value.

Updates configuration. here Request

Parameters:

  • section_id (String)

    Required parameter: TODO: type description

  • body (IntegrationConfig) (defaults to: nil)

    Optional parameter: Integration Config



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/new_store_api/controllers/tppe_controller.rb', line 34

def update_configuration(section_id,
                         body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/promotions/configurations/{section-id}',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .template_param(new_parameter(section_id, key: 'section-id')
                                .should_encode(true))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end