Class: MojFileUploaderApiClient::HttpClient

Inherits:
Object
  • Object
show all
Defined in:
lib/mojfile_uploader_api_client/http_client.rb

Direct Known Subclasses

AddFile, DeleteFile, ListFiles, Status

Constant Summary collapse

DEFAULT_OPTIONS =
{
  headers: {
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'x-amz-server-side-encryption' => 'AES256'
  },
  verify_ssl: false,
  open_timeout: 5,
  read_timeout: 15
}.freeze

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.base_urlObject

Returns the value of attribute base_url.



17
18
19
# File 'lib/mojfile_uploader_api_client/http_client.rb', line 17

def base_url
  @base_url
end

.optionsObject

Returns the value of attribute options.



17
18
19
# File 'lib/mojfile_uploader_api_client/http_client.rb', line 17

def options
  @options
end

Instance Attribute Details

#responseObject

Returns the value of attribute response.



3
4
5
# File 'lib/mojfile_uploader_api_client/http_client.rb', line 3

def response
  @response
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



19
20
21
# File 'lib/mojfile_uploader_api_client/http_client.rb', line 19

def configure
  yield(self)
end

Instance Method Details

#callObject



24
25
26
27
# File 'lib/mojfile_uploader_api_client/http_client.rb', line 24

def call
  execute_request
  response
end

#endpointObject



29
30
31
# File 'lib/mojfile_uploader_api_client/http_client.rb', line 29

def endpoint
  raise 'not implemented'
end

#optionsObject



43
44
45
46
47
# File 'lib/mojfile_uploader_api_client/http_client.rb', line 43

def options
  # Using `self.class.options` allows overriding defaults in individual API
  # calls and ensure that overrides do not persist across calls.
  DEFAULT_OPTIONS.merge(self.class.options || {})
end

#payloadObject



37
# File 'lib/mojfile_uploader_api_client/http_client.rb', line 37

def payload; end

#payload?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/mojfile_uploader_api_client/http_client.rb', line 39

def payload?
  !payload.nil?
end

#verbObject



33
34
35
# File 'lib/mojfile_uploader_api_client/http_client.rb', line 33

def verb
  raise 'not implemented'
end