Class: CyberSource::SecureFileShareApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cybersource_rest_client/api/secure_file_share_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default, config) ⇒ SecureFileShareApi

Returns a new instance of SecureFileShareApi.



19
20
21
22
# File 'lib/cybersource_rest_client/api/secure_file_share_api.rb', line 19

def initialize(api_client = ApiClient.default, config)
  @api_client = api_client
  @api_client.set_configuration(config)
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/cybersource_rest_client/api/secure_file_share_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_file(file_id, opts = {}) ⇒ nil

Download a File with File Identifier Download a file for the given file identifier

Parameters:

  • file_id

    Unique identifier for each file

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :organization_id (String)

    Valid Cybersource Organization Id

Returns:

  • (nil)


29
30
31
32
# File 'lib/cybersource_rest_client/api/secure_file_share_api.rb', line 29

def get_file(file_id, opts = {})
  data, status_code, headers = get_file_with_http_info(file_id, opts)
  return data, status_code, headers
end

#get_file_detail(start_date, end_date, opts = {}) ⇒ V1FileDetailsGet200Response

Get List of Files Get list of files and it’s information of them available inside the report directory

Parameters:

Options Hash (opts):

  • :organization_id (String)

    Valid Cybersource Organization Id

  • :name (String)

    **Tailored to searches for specific files with in given Date range** example : MyTransactionDetailreport.xml

Returns:



114
115
116
117
# File 'lib/cybersource_rest_client/api/secure_file_share_api.rb', line 114

def get_file_detail(start_date, end_date, opts = {})
  data, status_code, headers = get_file_detail_with_http_info(start_date, end_date, opts)
  return data, status_code, headers
end

#get_file_detail_with_http_info(start_date, end_date, opts = {}) ⇒ Array<(V1FileDetailsGet200Response, Fixnum, Hash)>

Get List of Files Get list of files and it&#39;s information of them available inside the report directory

Parameters:

Options Hash (opts):

  • :organization_id (String)

    Valid Cybersource Organization Id

  • :name (String)

    **Tailored to searches for specific files with in given Date range** example : MyTransactionDetailreport.xml

Returns:



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/cybersource_rest_client/api/secure_file_share_api.rb', line 127

def get_file_detail_with_http_info(start_date, end_date, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: SecureFileShareApi.get_file_detail ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling SecureFileShareApi.get_file_detail"
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    fail ArgumentError, "Missing the required parameter 'end_date' when calling SecureFileShareApi.get_file_detail"
  end
  if @api_client.config.client_side_validation && !opts[:'organization_id'].nil? && opts[:'organization_id'].to_s.length > 32
    fail ArgumentError, 'invalid value for "opts[:"organization_id"]" when calling SecureFileShareApi.get_file_detail, the character length must be smaller than or equal to 32.'
  end

  if @api_client.config.client_side_validation && !opts[:'organization_id'].nil? && opts[:'organization_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"organization_id"]" when calling SecureFileShareApi.get_file_detail, the character length must be great than or equal to 1.'
  end

  #if @api_client.config.client_side_validation && !opts[:'organization_id'].nil? && opts[:'organization_id'] !~ Regexp.new(/[a-zA-Z0-9-_]+/)
    #fail ArgumentError, "invalid value for 'opts[:\"organization_id\"]' when calling SecureFileShareApi.get_file_detail, must conform to the pattern /[a-zA-Z0-9-_]+/."
  #end

  #if @api_client.config.client_side_validation && !opts[:'name'].nil? && opts[:'name'] !~ Regexp.new(/[a-zA-Z0-9-_\\.]+/)
    #fail ArgumentError, "invalid value for 'opts[:\"name\"]' when calling SecureFileShareApi.get_file_detail, must conform to the pattern /[a-zA-Z0-9-_\\.]+/."
  #end

  # resource path
  local_var_path = 'sfs/v1/file-details'

  # query parameters
  query_params = {}
  query_params[:'startDate'] = start_date
  query_params[:'endDate'] = end_date
  query_params[:'organizationId'] = opts[:'organization_id'] if !opts[:'organization_id'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/hal+json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['*/*;charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  if 'GET' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  end
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'V1FileDetailsGet200Response')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SecureFileShareApi#get_file_detail\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_file_with_http_info(file_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Download a File with File Identifier Download a file for the given file identifier

Parameters:

  • file_id

    Unique identifier for each file

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :organization_id (String)

    Valid Cybersource Organization Id

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/cybersource_rest_client/api/secure_file_share_api.rb', line 40

def get_file_with_http_info(file_id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: SecureFileShareApi.get_file ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'file_id' is set
  if @api_client.config.client_side_validation && file_id.nil?
    fail ArgumentError, "Missing the required parameter 'file_id' when calling SecureFileShareApi.get_file"
  end
  if @api_client.config.client_side_validation && !opts[:'organization_id'].nil? && opts[:'organization_id'].to_s.length > 32
    fail ArgumentError, 'invalid value for "opts[:"organization_id"]" when calling SecureFileShareApi.get_file, the character length must be smaller than or equal to 32.'
  end

  if @api_client.config.client_side_validation && !opts[:'organization_id'].nil? && opts[:'organization_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"organization_id"]" when calling SecureFileShareApi.get_file, the character length must be great than or equal to 1.'
  end

  #if @api_client.config.client_side_validation && !opts[:'organization_id'].nil? && opts[:'organization_id'] !~ Regexp.new(/[a-zA-Z0-9-_]+/)
    #fail ArgumentError, "invalid value for 'opts[:\"organization_id\"]' when calling SecureFileShareApi.get_file, must conform to the pattern /[a-zA-Z0-9-_]+/."
  #end

  # resource path
  local_var_path = 'sfs/v1/files/{fileId}'.sub('{' + 'fileId' + '}', file_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizationId'] = opts[:'organization_id'] if !opts[:'organization_id'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'text/csv', 'application/pdf'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['*/*;charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  if 'GET' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  end
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SecureFileShareApi#get_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end