Class: Certynix::HttpClient

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

Constant Summary collapse

SDK_VERSION =
Certynix::VERSION

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ HttpClient

Returns a new instance of HttpClient.



12
13
14
15
# File 'lib/certynix/http_client.rb', line 12

def initialize(config)
  @config = config
  @conn   = build_connection
end

Instance Method Details

#delete(path) ⇒ Object



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

def delete(path)
  request(:delete, path)
  nil
end

#get(path, params = {}) ⇒ Object



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

def get(path, params = {})
  request(:get, path, params: compact_params(params))
end

#get_public(path, params = {}) ⇒ Object

GET sem autenticação — para endpoints públicos (verify)



35
36
37
# File 'lib/certynix/http_client.rb', line 35

def get_public(path, params = {})
  request(:get, path, params: compact_params(params), public: true)
end

#post(path, body = nil) ⇒ Object



21
22
23
# File 'lib/certynix/http_client.rb', line 21

def post(path, body = nil)
  request(:post, path, body: body)
end

#post_public(path, body = nil) ⇒ Object



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

def post_public(path, body = nil)
  request(:post, path, body: body, public: true)
end

#put(path, body = nil) ⇒ Object



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

def put(path, body = nil)
  request(:put, path, body: body)
end