Class: CyberSourceMergedSpec::SearchTransactionsController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/controllers/search_transactions_controller.rb

Overview

SearchTransactionsController

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, user_agent_parameters

Constructor Details

This class inherits a constructor from CyberSourceMergedSpec::BaseController

Instance Method Details

#create_search(create_search_request) ⇒ ApiResponse

Create a search request. TODO: type description here

Parameters:

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
# File 'lib/cyber_source_merged_spec/controllers/search_transactions_controller.rb', line 13

def create_search(create_search_request)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/tss/v2/searches',
                                 Server::DEFAULT)
               .body_param(new_parameter(create_search_request)
                            .is_required(true))
               .header_param(new_parameter('application/json; charset=utf-8', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TssV2TransactionsPost201Response.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request.',
                             TssV2TransactionsPost400ResponseException)
                .local_error('502',
                             'Unexpected system error or system timeout.',
                             TssV2TransactionsPost502ResponseException))
    .execute
end

#get_search(search_id) ⇒ ApiResponse

Include the Search ID in the GET request to retrieve the search results.

Parameters:

  • search_id (String)

    Required parameter: Search ID.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cyber_source_merged_spec/controllers/search_transactions_controller.rb', line 39

def get_search(search_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/tss/v2/searches/{searchId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(search_id, key: 'searchId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TssV2TransactionsPost201Response.method(:from_hash))
                .is_api_response(true)
                .local_error('404',
                             'The specified resource not found in the system.',
                             APIException)
                .local_error('500',
                             'Unexpected server error.',
                             APIException))
    .execute
end