Class: Polar::HTTPClient
- Inherits:
-
Object
- Object
- Polar::HTTPClient
- Defined in:
- lib/polar/http_client.rb
Instance Attribute Summary collapse
-
#auth ⇒ Object
readonly
Returns the value of attribute auth.
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
- #delete(path, headers = {}) ⇒ Object
- #get(path, params = {}, headers = {}) ⇒ Object
-
#initialize(configuration, auth = nil) ⇒ HTTPClient
constructor
A new instance of HTTPClient.
- #patch(path, body = nil, headers = {}) ⇒ Object
- #post(path, body = nil, headers = {}) ⇒ Object
- #put(path, body = nil, headers = {}) ⇒ Object
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
#auth ⇒ Object (readonly)
Returns the value of attribute auth.
5 6 7 |
# File 'lib/polar/http_client.rb', line 5 def auth @auth end |
#configuration ⇒ Object (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 |