Class: CyberSourceMergedSpec::SecureFileShareController

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

Overview

SecureFileShareController

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

#get_file(file_id, organization_id: nil) ⇒ ApiResponse

Download a file for the given file identifier file Organization Id

Parameters:

  • file_id (String)

    Required parameter: Unique identifier for each

  • organization_id (String) (defaults to: nil)

    Optional parameter: Valid Cybersource

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/cyber_source_merged_spec/controllers/secure_file_share_controller.rb', line 68

def get_file(file_id,
             organization_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/sfs/v1/files/{fileId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(file_id, key: 'fileId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('*/*;charset=utf-8', key: 'Content-Type'))
               .query_param(new_parameter(organization_id, key: 'organizationId'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Invalid Request',
                             GetFileException)
                .local_error('404',
                             'No Reports Found',
                             APIException))
    .execute
end

#get_file_detail(start_date, end_date, organization_id: nil, name: nil) ⇒ ApiResponse

Get list of files and it's information of them available inside the report directory 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor 14) Example date format: - yyyy-MM-dd format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor 14) Example date format: - yyyy-MM-dd Organization Id specific files with in given Date range** example : MyTransactionDetailreport.xml

Parameters:

  • start_date (Date)

    Required parameter: Valid start date in **ISO

  • end_date (Date)

    Required parameter: Valid end date in **ISO 8601

  • organization_id (String) (defaults to: nil)

    Optional parameter: Valid Cybersource

  • name (String) (defaults to: nil)

    Optional parameter: **Tailored to searches for

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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

def get_file_detail(start_date,
                    end_date,
                    organization_id: nil,
                    name: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/sfs/v1/file-details',
                                 Server::DEFAULT)
               .query_param(new_parameter(start_date, key: 'startDate')
                             .is_required(true))
               .query_param(new_parameter(end_date, key: 'endDate')
                             .is_required(true))
               .header_param(new_parameter('*/*;charset=utf-8', key: 'Content-Type'))
               .query_param(new_parameter(organization_id, key: 'organizationId'))
               .query_param(new_parameter(name, key: 'name'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(V1FileDetailsGet200Response.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request',
                             V1FilesGet400ResponseException)
                .local_error('401',
                             'Ok',
                             V1FileDetailsGet401ResponseException)
                .local_error('404',
                             'Files Info not found',
                             V1FileDetailsGet404ResponseException)
                .local_error('500',
                             'Internal Server Error',
                             V1FileDetailsGet500ResponseException))
    .execute
end