Class: Typeform::Connection
- Inherits:
-
Object
- Object
- Typeform::Connection
- Defined in:
- lib/typeform/connection.rb
Instance Method Summary collapse
-
#delete(path, params = {}) ⇒ Object
Perform a DELETE request.
-
#get(path, params = {}) ⇒ Object
Perform a GET request.
-
#initialize ⇒ Connection
constructor
Create a Connection object.
-
#patch(path, params = {}) ⇒ Object
Perform a patch request.
-
#post(path, params = {}) ⇒ Object
Perform a POST request.
-
#put(path, params = {}) ⇒ Object
Perform a PUT request.
Constructor Details
#initialize ⇒ Connection
Create a Connection object.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/typeform/connection.rb', line 6 def initialize @typeform_token = Typeform.typeform_token @api_base_uri = Configuration::DEFAULT_API_BASE_URI @headers = { user_agent: Configuration::DEFAULT_USER_AGENT } @connection = Faraday.new(url: @api_base_uri, headers: @headers) do |faraday| # faraday.request :multipart faraday.request :url_encoded faraday.response :logger if Typeform.debug faraday.adapter :net_http end end |
Instance Method Details
#delete(path, params = {}) ⇒ Object
Perform a DELETE request.
49 50 51 |
# File 'lib/typeform/connection.rb', line 49 def delete(path, params = {}) request(:delete, path, params) end |
#get(path, params = {}) ⇒ Object
Perform a GET request.
21 22 23 |
# File 'lib/typeform/connection.rb', line 21 def get(path, params = {}) request(:get, path, params) end |
#patch(path, params = {}) ⇒ Object
Perform a patch request.
35 36 37 |
# File 'lib/typeform/connection.rb', line 35 def patch(path, params = {}) request(:patch, path, params) end |
#post(path, params = {}) ⇒ Object
Perform a POST request.
42 43 44 |
# File 'lib/typeform/connection.rb', line 42 def post(path, params = {}) request(:post, path, params) end |
#put(path, params = {}) ⇒ Object
Perform a PUT request.
28 29 30 |
# File 'lib/typeform/connection.rb', line 28 def put(path, params = {}) request(:put, path, params) end |