Class: NewStoreApi::DataController

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

Overview

DataController

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

#create_data(body) ⇒ CreateDataResponse

Stores a new PII data entry in a residency compliant way. store

Parameters:

Returns:



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

def create_data(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/customer/data',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CreateDataResponse.method(:from_hash)))
    .execute
end

#destroy_data(data_id) ⇒ void

This method returns an undefined value.

Deletes data entry for the given data_id.

Parameters:

  • data_id (String)

    Required parameter: Data ID



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/new_store_api/controllers/data_controller.rb', line 32

def destroy_data(data_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/customer/data/{data_id}',
                                 Server::API)
               .template_param(new_parameter(data_id, key: 'data_id')
                                .should_encode(true))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#show_data(data_id) ⇒ Binary

Returns data for the given data_id, depending on the defined content-type.

Parameters:

  • data_id (String)

    Required parameter: Data ID

Returns:

  • (Binary)

    Response from the API call.



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

def show_data(data_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/customer/data/{data_id}',
                                 Server::API)
               .template_param(new_parameter(data_id, key: 'data_id')
                                .should_encode(true))
               .auth(Single.new('oauth')))
    .response(new_response_handler)
    .execute
end