Class: ArkEcosystem::Client::HTTP::Client

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

Overview

The HTTP client used for sending requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ ArkEcosystem::Client::API::Two::Wallets

Create a new resource instance.

Parameters:

  • config (Hash)


16
17
18
19
# File 'lib/arkecosystem/client/http/client.rb', line 16

def initialize(config)
  @host = config[:host]
  @http_client = nil
end

Instance Attribute Details

#http_clientObject

Returns the value of attribute http_client.



9
10
11
# File 'lib/arkecosystem/client/http/client.rb', line 9

def http_client
  @http_client
end

Instance Method Details

#delete(url, query = {}) ⇒ Faraday::Response

Create and send a HTTP “DELETE” request.

Parameters:

  • url (String)
  • query (Hash) (defaults to: {})

Returns:

  • (Faraday::Response)


57
58
59
# File 'lib/arkecosystem/client/http/client.rb', line 57

def delete(url, query = {})
  send_request(:delete, url, query)
end

#get(url, query = {}) ⇒ Faraday::Response

Create and send a HTTP “GET” request.

Parameters:

  • url (String)
  • query (Hash) (defaults to: {})

Returns:

  • (Faraday::Response)


27
28
29
# File 'lib/arkecosystem/client/http/client.rb', line 27

def get(url, query = {})
  send_request(:get, url, query)
end

#post(url, payload = {}) ⇒ Faraday::Response

Create and send a HTTP “POST” request.

Parameters:

  • url (String)
  • payload (Hash) (defaults to: {})

Returns:

  • (Faraday::Response)


37
38
39
# File 'lib/arkecosystem/client/http/client.rb', line 37

def post(url, payload = {})
  send_request(:post, url, payload)
end

#put(url, payload = {}) ⇒ Faraday::Response

Create and send a HTTP “PUT” request.

Parameters:

  • url (String)
  • payload (Hash) (defaults to: {})

Returns:

  • (Faraday::Response)


47
48
49
# File 'lib/arkecosystem/client/http/client.rb', line 47

def put(url, payload = {})
  send_request(:put, url, payload)
end