Class: Harvest::HTTP::ApiCall
- Inherits:
-
Object
- Object
- Harvest::HTTP::ApiCall
- Defined in:
- lib/harvest/httpclient.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#http_method ⇒ Object
Returns the value of attribute http_method.
-
#path ⇒ Object
Returns the value of attribute path.
-
#payload ⇒ Object
Returns the value of attribute payload.
Instance Method Summary collapse
-
#initialize(path:, payload: {}, http_method: 'get', headers: {}, params: {}) ⇒ ApiCall
constructor
A new instance of ApiCall.
- #param(params = NoOptionProvided) ⇒ Object
- #param=(params) ⇒ Object
Constructor Details
#initialize(path:, payload: {}, http_method: 'get', headers: {}, params: {}) ⇒ ApiCall
Returns a new instance of ApiCall.
148 149 150 151 152 153 154 |
# File 'lib/harvest/httpclient.rb', line 148 def initialize(path:, payload: {}, http_method: 'get', headers: {}, params: {}) @path = path @http_method = http_method @payload = payload @headers = headers param(params) end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
146 147 148 |
# File 'lib/harvest/httpclient.rb', line 146 def headers @headers end |
#http_method ⇒ Object
Returns the value of attribute http_method.
146 147 148 |
# File 'lib/harvest/httpclient.rb', line 146 def http_method @http_method end |
#path ⇒ Object
Returns the value of attribute path.
146 147 148 |
# File 'lib/harvest/httpclient.rb', line 146 def path @path end |
#payload ⇒ Object
Returns the value of attribute payload.
146 147 148 |
# File 'lib/harvest/httpclient.rb', line 146 def payload @payload end |
Instance Method Details
#param(params = NoOptionProvided) ⇒ Object
156 157 158 159 160 161 162 |
# File 'lib/harvest/httpclient.rb', line 156 def param(params = NoOptionProvided) if params == NoOptionProvided @headers['params'] else @headers['params'] = params end end |
#param=(params) ⇒ Object
164 165 166 167 |
# File 'lib/harvest/httpclient.rb', line 164 def param=(params) param(params) self end |