Class: CredHubble::Http::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/cred_hubble/http/client.rb

Constant Summary collapse

DEFAULT_HEADERS =
{ 'Content-Type' => 'application/json' }.freeze

Instance Method Summary collapse

Constructor Details

#initialize(url, auth_header_token: nil, ca_path: nil, client_cert: nil, client_key: nil) ⇒ Client

Returns a new instance of Client.



9
10
11
12
13
14
15
# File 'lib/cred_hubble/http/client.rb', line 9

def initialize(url, auth_header_token: nil, ca_path: nil, client_cert: nil, client_key: nil)
  @url = url
  @auth_header_token = auth_header_token
  @ca_path = ca_path
  @client_cert = client_cert
  @client_key = client_key
end

Instance Method Details

#delete(path) ⇒ Object



35
36
37
38
39
# File 'lib/cred_hubble/http/client.rb', line 35

def delete(path)
  with_error_handling do
    connection.delete(path)
  end
end

#get(path) ⇒ Object



17
18
19
20
21
# File 'lib/cred_hubble/http/client.rb', line 17

def get(path)
  with_error_handling do
    connection.get(path)
  end
end

#post(path, body) ⇒ Object



23
24
25
26
27
# File 'lib/cred_hubble/http/client.rb', line 23

def post(path, body)
  with_error_handling do
    connection.post(path, body)
  end
end

#put(path, body) ⇒ Object



29
30
31
32
33
# File 'lib/cred_hubble/http/client.rb', line 29

def put(path, body)
  with_error_handling do
    connection.put(path, body)
  end
end