Class: Makeleaps::Request::RequestHandler
- Inherits:
-
Object
- Object
- Makeleaps::Request::RequestHandler
- Includes:
- ErrorHandler
- Defined in:
- lib/makeleaps/request/request_handler.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #delete(*args, &block) ⇒ Object
- #get(*args, &block) ⇒ Object
-
#initialize(connection) ⇒ RequestHandler
constructor
A new instance of RequestHandler.
- #options(url, &block) ⇒ Object
- #patch(*args, &block) ⇒ Object
- #post(*args, &block) ⇒ Object
- #put(*args, &block) ⇒ Object
Methods included from ErrorHandler
Constructor Details
#initialize(connection) ⇒ RequestHandler
Returns a new instance of RequestHandler.
7 8 9 |
# File 'lib/makeleaps/request/request_handler.rb', line 7 def initialize(connection) @connection = connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
6 7 8 |
# File 'lib/makeleaps/request/request_handler.rb', line 6 def connection @connection end |
Instance Method Details
#delete(*args, &block) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/makeleaps/request/request_handler.rb', line 39 def delete(*args, &block) response = handle_api_response(success: 204) do connection.delete(*args, &block) end Makeleaps::Response::Wrapper.new response end |
#get(*args, &block) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/makeleaps/request/request_handler.rb', line 11 def get(*args, &block) response = handle_api_response(success: 200) do connection.get(*args, &block) end Makeleaps::Response::Wrapper.new response end |
#options(url, &block) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/makeleaps/request/request_handler.rb', line 46 def (url, &block) response = handle_api_response(success: 200) do connection.run_request(:options, url, nil, nil, &block) end Makeleaps::Response::Wrapper.new response end |
#patch(*args, &block) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/makeleaps/request/request_handler.rb', line 25 def patch(*args, &block) response = handle_api_response(success: 200) do connection.patch(*args, &block) end Makeleaps::Response::Wrapper.new response end |