Class: ApiClient::Connection::Basic
- Defined in:
- lib/api_client/connection/basic.rb
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
- #create_handler ⇒ Object
-
#delete(path, data = {}, headers = {}) ⇒ Object
FS::Connection#delete Performs a DELETE request Accepts three parameters:.
- #finalize_handler ⇒ Object
-
#get(path, data = {}, headers = {}) ⇒ Object
ApiClient::Connection::Abstract#get Performs a GET request Accepts three parameters:.
-
#patch(path, data = {}, headers = {}) ⇒ Object
ApiClient::Connection::Abstract#patch Performs a PATCH request Accepts three parameters:.
-
#post(path, data = {}, headers = {}) ⇒ Object
ApiClient::Connection::Abstract#post Performs a POST request Accepts three parameters:.
-
#put(path, data = {}, headers = {}) ⇒ Object
ApiClient::Connection::Abstract#put Performs a PUT request Accepts three parameters:.
Methods inherited from Abstract
Constructor Details
This class inherits a constructor from ApiClient::Connection::Abstract
Instance Method Details
#create_handler ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/api_client/connection/basic.rb', line 7 def create_handler # Create and memoize the connection object # The empty block is necessary as we don't want Faraday to # initialize itself, we build our own stack in finalize_handler @handler = Faraday.new(@endpoint, @options[:faraday] || {}) do end finalize_handler end |
#delete(path, data = {}, headers = {}) ⇒ Object
FS::Connection#delete Performs a DELETE request Accepts three parameters:
-
path - the path request should go to
-
data - (optional) the query, passed as a hash and converted into query params
-
headers - (optional) headers sent along in the request
This method automatically adds the application token header
81 82 83 |
# File 'lib/api_client/connection/basic.rb', line 81 def delete(path, data = {}, headers = {}) exec_request(:delete, path, data, headers) end |
#finalize_handler ⇒ Object
15 16 17 18 19 |
# File 'lib/api_client/connection/basic.rb', line 15 def finalize_handler @handler.use Middlewares::Request::Logger, ApiClient.logger if ApiClient.logger @handler.use Faraday::Request::UrlEncoded @handler.adapter Faraday.default_adapter end |
#get(path, data = {}, headers = {}) ⇒ Object
ApiClient::Connection::Abstract#get Performs a GET request Accepts three parameters:
-
path - the path the request should go to
-
data - (optional) the query, passed as a hash and converted into query params
-
headers - (optional) headers sent along with the request
29 30 31 |
# File 'lib/api_client/connection/basic.rb', line 29 def get(path, data = {}, headers = {}) exec_request(:get, path, data, headers) end |
#patch(path, data = {}, headers = {}) ⇒ Object
ApiClient::Connection::Abstract#patch Performs a PATCH request Accepts three parameters:
-
path - the path request should go to
-
data - (optional) data sent in the request
-
headers - (optional) headers sent along in the request
This method automatically adds the application token header
55 56 57 |
# File 'lib/api_client/connection/basic.rb', line 55 def patch(path, data = {}, headers = {}) exec_request(:patch, path, data, headers) end |
#post(path, data = {}, headers = {}) ⇒ Object
ApiClient::Connection::Abstract#post Performs a POST request Accepts three parameters:
-
path - the path request should go to
-
data - (optional) data sent in the request
-
headers - (optional) headers sent along in the request
This method automatically adds the application token header
42 43 44 |
# File 'lib/api_client/connection/basic.rb', line 42 def post(path, data = {}, headers = {}) exec_request(:post, path, data, headers) end |
#put(path, data = {}, headers = {}) ⇒ Object
ApiClient::Connection::Abstract#put Performs a PUT request Accepts three parameters:
-
path - the path request should go to
-
data - (optional) data sent in the request
-
headers - (optional) headers sent along in the request
This method automatically adds the application token header
68 69 70 |
# File 'lib/api_client/connection/basic.rb', line 68 def put(path, data = {}, headers = {}) exec_request(:put, path, data, headers) end |