Module: Invoice2go::Request
- Included in:
- API
- Defined in:
- lib/invoice2go/request.rb
Overview
Defines HTTP request methods
Instance Method Summary collapse
-
#get(path, options = {}) ⇒ Object
Perform an HTTP GET request.
-
#post(path, options = {}) ⇒ Object
Perform an HTTP POST request.
-
#refresh_token! ⇒ Object
Refresh auth token and save the new auth and refresh tokens.
Instance Method Details
#get(path, options = {}) ⇒ Object
Perform an HTTP GET request
6 7 8 |
# File 'lib/invoice2go/request.rb', line 6 def get(path, = {}) request(:get, path, ) end |
#post(path, options = {}) ⇒ Object
Perform an HTTP POST request
11 12 13 |
# File 'lib/invoice2go/request.rb', line 11 def post(path, = {}) request(:post, path, ) end |
#refresh_token! ⇒ Object
Refresh auth token and save the new auth and refresh tokens
16 17 18 19 20 21 |
# File 'lib/invoice2go/request.rb', line 16 def refresh_token! return "Error - missing or invalid refresh token, secret or client id. See the readme for details on how to configure your client." unless valid_params_for_refresh? response = connection_refresh.post '/identity/connect/token', params return update_config(response) if response.status == 200 "Token could not be refreshed due to: #{response.body.error}" end |