Module: Deimos::Utils::SchemaControllerMixin::ClassMethods
- Defined in:
- lib/deimos/utils/schema_controller_mixin.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#namespace(name) ⇒ void
Set the namespace for both requests and responses.
- #namespaces ⇒ Hash<Symbol, String>
-
#request_namespace(name) ⇒ void
Set the namespace for requests.
-
#response_namespace(name) ⇒ void
Set the namespace for repsonses.
- #schema_mapping ⇒ Hash<String, Hash<Symbol, String>>
-
#schemas(*actions, request: nil, response: nil, **kwactions) ⇒ void
Indicate which schemas should be assigned to actions.
Instance Method Details
#namespace(name) ⇒ void
This method returns an undefined value.
Set the namespace for both requests and responses.
54 55 56 57 |
# File 'lib/deimos/utils/schema_controller_mixin.rb', line 54 def namespace(name) request_namespace(name) response_namespace(name) end |
#namespaces ⇒ Hash<Symbol, String>
47 48 49 |
# File 'lib/deimos/utils/schema_controller_mixin.rb', line 47 def namespaces @namespaces ||= {} end |
#request_namespace(name) ⇒ void
This method returns an undefined value.
Set the namespace for requests.
62 63 64 |
# File 'lib/deimos/utils/schema_controller_mixin.rb', line 62 def request_namespace(name) namespaces[:request] = name end |
#response_namespace(name) ⇒ void
This method returns an undefined value.
Set the namespace for repsonses.
69 70 71 |
# File 'lib/deimos/utils/schema_controller_mixin.rb', line 69 def response_namespace(name) namespaces[:response] = name end |
#schema_mapping ⇒ Hash<String, Hash<Symbol, String>>
25 26 27 |
# File 'lib/deimos/utils/schema_controller_mixin.rb', line 25 def schema_mapping @schema_mapping ||= {} end |
#schemas(*actions, request: nil, response: nil, **kwactions) ⇒ void
This method returns an undefined value.
Indicate which schemas should be assigned to actions.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/deimos/utils/schema_controller_mixin.rb', line 35 def schemas(*actions, request: nil, response: nil, **kwactions) actions.each do |action| request ||= action.to_s.titleize response ||= action.to_s.titleize schema_mapping[action.to_s] = { request: request, response: response } end kwactions.each do |key, val| schema_mapping[key.to_s] = { request: val, response: val } end end |