Module: Desk::Request
- Defined in:
- lib/desk/request.rb
Overview
Defines HTTP request methods
Constant Summary collapse
- REQUEST_METHODS =
[ 'get', 'patch', 'post', 'put', 'delete' ].freeze
Instance Method Summary collapse
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to?(method_name, include_private = false) ⇒ Boolean
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/desk/request.rb', line 13 def method_missing(method_name, *args, &block) if (REQUEST_METHODS.include? method_name.to_s) && (args.length > 0) path = args[0] = args[1] ? args[1] : {} raw = args[2] ? args[2] : false request(method_name.to_sym, path, , raw) else super end end |
Instance Method Details
#respond_to?(method_name, include_private = false) ⇒ Boolean
24 25 26 27 28 29 30 |
# File 'lib/desk/request.rb', line 24 def respond_to?(method_name, include_private = false) if (REQUEST_METHODS.include? method_name.to_s) true else super end end |