Class: Pike13::HTTPClientV3
- Inherits:
-
Object
- Object
- Pike13::HTTPClientV3
- Includes:
- HTTParty
- Defined in:
- lib/pike13/http_client_v3.rb
Overview
HTTParty-based HTTP client for Pike13 v3 Reporting API V3 API uses JSON API 1.0 (application/vnd.api+json) and a different URL structure than v2
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
Instance Method Summary collapse
-
#initialize(base_url:, access_token:) ⇒ HTTPClientV3
constructor
A new instance of HTTPClientV3.
-
#post(path, body = {}, params = {}) ⇒ Hash
POST request for v3 reporting queries.
Constructor Details
#initialize(base_url:, access_token:) ⇒ HTTPClientV3
Returns a new instance of HTTPClientV3.
14 15 16 17 |
# File 'lib/pike13/http_client_v3.rb', line 14 def initialize(base_url:, access_token:) @base_url = base_url @access_token = access_token end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
12 13 14 |
# File 'lib/pike13/http_client_v3.rb', line 12 def access_token @access_token end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
12 13 14 |
# File 'lib/pike13/http_client_v3.rb', line 12 def base_url @base_url end |
Instance Method Details
#post(path, body = {}, params = {}) ⇒ Hash
POST request for v3 reporting queries
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pike13/http_client_v3.rb', line 25 def post(path, body = {}, params = {}) handle_response do self.class.post( full_path(path), body: body.to_json, query: params, headers: headers, timeout: 30 ) end end |