Class: Polar::HTTPClient

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration, auth = nil) ⇒ HTTPClient

Returns a new instance of HTTPClient.



7
8
9
10
# File 'lib/polar/http_client.rb', line 7

def initialize(configuration, auth = nil)
  @configuration = configuration
  @auth = auth
end

Instance Attribute Details

#authObject (readonly)

Returns the value of attribute auth.



5
6
7
# File 'lib/polar/http_client.rb', line 5

def auth
  @auth
end

#configurationObject (readonly)

Returns the value of attribute configuration.



5
6
7
# File 'lib/polar/http_client.rb', line 5

def configuration
  @configuration
end

Instance Method Details

#delete(path, headers = {}) ⇒ Object



28
29
30
# File 'lib/polar/http_client.rb', line 28

def delete(path, headers = {})
  request(:delete, path, headers: headers)
end

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



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

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

#patch(path, body = nil, headers = {}) ⇒ Object



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

def patch(path, body = nil, headers = {})
  request(:patch, path, body: body, headers: headers)
end

#post(path, body = nil, headers = {}) ⇒ Object



16
17
18
# File 'lib/polar/http_client.rb', line 16

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

#put(path, body = nil, headers = {}) ⇒ Object



20
21
22
# File 'lib/polar/http_client.rb', line 20

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