Class: Worldline::Connect::SDK::V1::Merchant::Files::FilesClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/worldline/connect/sdk/v1/merchant/files/files_client.rb

Overview

Files client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ FilesClient

Returns a new instance of FilesClient.

Parameters:



21
22
23
# File 'lib/worldline/connect/sdk/v1/merchant/files/files_client.rb', line 21

def initialize(parent, path_context)
  super(parent: parent, path_context: path_context)
end

Instance Method Details

#get_file(file_id, context = nil) {|Array<Worldline::Connect::SDK::Communication::ResponseHeader>, IO| ... } ⇒ Object

Resource /{merchantId}/files/{fileId} - Retrieve File

Parameters:

Yields:

Raises:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/worldline/connect/sdk/v1/merchant/files/files_client.rb', line 39

def get_file(file_id, context = nil)
  path_context = {
    'fileId'.freeze => file_id,
  }
  uri = instantiate_uri('/files/v1/{merchantId}/files/{fileId}', path_context)
  @communicator.get_with_binary_response(
    uri,
    client_headers,
    nil,
    context) do |headers, response_body|
    yield headers, response_body
  end
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end