Module: Mountapi::Handler::Behaviour::InstanceMethods
- Defined in:
- lib/mountapi/handler/behaviour.rb
Overview
extend instance
Instance Method Summary collapse
- #bad_request(*args) ⇒ Object
- #base_url ⇒ Object
- #call ⇒ Object
- #forbidden(*args) ⇒ Object
- #internal_error(*args) ⇒ Object
- #not_found(*args) ⇒ Object
- #ok(*args) ⇒ Object
- #response ⇒ Object
- #role_allowed? ⇒ Boolean
- #url_for(operation_id, options = {}) ⇒ Object
Instance Method Details
#bad_request(*args) ⇒ Object
51 52 53 |
# File 'lib/mountapi/handler/behaviour.rb', line 51 def bad_request(*args) Mountapi::Response::BadRequest.new(*args) end |
#base_url ⇒ Object
35 36 37 |
# File 'lib/mountapi/handler/behaviour.rb', line 35 def base_url [:base_url] end |
#call ⇒ Object
63 64 65 |
# File 'lib/mountapi/handler/behaviour.rb', line 63 def call raise NotImplementedError end |
#forbidden(*args) ⇒ Object
59 60 61 |
# File 'lib/mountapi/handler/behaviour.rb', line 59 def forbidden(*args) Mountapi::Response::Forbidden.new(*args) end |
#internal_error(*args) ⇒ Object
55 56 57 |
# File 'lib/mountapi/handler/behaviour.rb', line 55 def internal_error(*args) Mountapi::Response::InternalError.new(*args) end |
#not_found(*args) ⇒ Object
47 48 49 |
# File 'lib/mountapi/handler/behaviour.rb', line 47 def not_found(*args) Mountapi::Response::NotFound.new(*args) end |
#ok(*args) ⇒ Object
43 44 45 |
# File 'lib/mountapi/handler/behaviour.rb', line 43 def ok(*args) Mountapi::Response::Ok.new(*args) end |
#response ⇒ Object
67 68 69 |
# File 'lib/mountapi/handler/behaviour.rb', line 67 def response @response ||= Rack::Response.new([]) end |
#role_allowed? ⇒ Boolean
71 72 73 74 75 76 77 |
# File 'lib/mountapi/handler/behaviour.rb', line 71 def role_allowed? if Mountapi.config.user_info_adapter && self.class.roles Mountapi.config.user_info_adapter.call(params, self.class.roles) else true end end |
#url_for(operation_id, options = {}) ⇒ Object
39 40 41 |
# File 'lib/mountapi/handler/behaviour.rb', line 39 def url_for(operation_id, = {}) Mountapi.url_for(operation_id, base_url, ) end |