Module: RubyLokaliseApi::Request
- Includes:
- Connection, JsonHandler
- Included in:
- Endpoints::BaseEndpoint
- Defined in:
- lib/ruby_lokalise_api/request.rb
Overview
Contains methods to perform the actual HTTP requests
Instance Method Summary collapse
-
#delete(endpoint) ⇒ Object
Sends a DELETE request.
-
#get(endpoint) ⇒ Object
Sends a GET request.
-
#patch(endpoint) ⇒ Object
Sends a PATCH request.
-
#post(endpoint) ⇒ Object
Sends a POST request.
-
#put(endpoint) ⇒ Object
Sends a PUT request.
Methods included from Connection
Methods included from JsonHandler
Instance Method Details
#delete(endpoint) ⇒ Object
Sends a DELETE request
43 44 45 46 47 48 49 50 |
# File 'lib/ruby_lokalise_api/request.rb', line 43 def delete(endpoint) respond_with( connection(endpoint).delete(prepare(endpoint.uri)) do |req| req.body = custom_dump endpoint.req_params end, endpoint ) end |
#get(endpoint) ⇒ Object
Sends a GET request
10 11 12 13 14 15 |
# File 'lib/ruby_lokalise_api/request.rb', line 10 def get(endpoint) respond_with( connection(endpoint, get_request: true).get(prepare(endpoint.uri), endpoint.req_params), endpoint ) end |
#patch(endpoint) ⇒ Object
Sends a PATCH request
34 35 36 37 38 39 40 |
# File 'lib/ruby_lokalise_api/request.rb', line 34 def patch(endpoint) respond_with( connection(endpoint).patch(prepare(endpoint.uri), endpoint.req_params.nil? ? nil : custom_dump(endpoint.req_params)), endpoint ) end |
#post(endpoint) ⇒ Object
Sends a POST request
18 19 20 21 22 23 |
# File 'lib/ruby_lokalise_api/request.rb', line 18 def post(endpoint) respond_with( connection(endpoint).post(prepare(endpoint.uri), custom_dump(endpoint.req_params)), endpoint ) end |
#put(endpoint) ⇒ Object
Sends a PUT request
26 27 28 29 30 31 |
# File 'lib/ruby_lokalise_api/request.rb', line 26 def put(endpoint) respond_with( connection(endpoint).put(prepare(endpoint.uri), custom_dump(endpoint.req_params)), endpoint ) end |