Module: Grist::HTTP
- Included in:
- Client
- Defined in:
- lib/grist/http.rb
Instance Method Summary collapse
- #conn ⇒ Object
- #destroy(path, **_params) ⇒ Object
- #get(path, **_params) ⇒ Object
- #patch(path, **params) ⇒ Object
- #post(path, **params) ⇒ Object
- #put(path, **params) ⇒ Object
Instance Method Details
#conn ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/grist/http.rb', line 25 def conn ::Faraday.new(url: @url) do |c| c.request :json c.request :authorization, "Bearer", @token c.response :json c.response :raise_error c.response :logger end end |
#destroy(path, **_params) ⇒ Object
21 22 23 |
# File 'lib/grist/http.rb', line 21 def destroy(path, **_params) request(method: :delete, path: "/api#{path}") end |
#get(path, **_params) ⇒ Object
5 6 7 |
# File 'lib/grist/http.rb', line 5 def get(path, **_params) request(method: :get, path: "/api#{path}") end |
#patch(path, **params) ⇒ Object
17 18 19 |
# File 'lib/grist/http.rb', line 17 def patch(path, **params) request(method: :patch, path: "/api#{path}", payload: params) end |
#post(path, **params) ⇒ Object
9 10 11 |
# File 'lib/grist/http.rb', line 9 def post(path, **params) request(method: :post, path: "/api#{path}", payload: params) end |
#put(path, **params) ⇒ Object
13 14 15 |
# File 'lib/grist/http.rb', line 13 def put(path, **params) request(method: :put, path: "/api#{path}", payload: params) end |