Class: Dox::DSL::Action
- Inherits:
-
Object
- Object
- Dox::DSL::Action
- Includes:
- AttrProxy
- Defined in:
- lib/dox/dsl/action.rb
Instance Attribute Summary collapse
-
#desc ⇒ Object
writeonly
Sets the attribute desc.
-
#name ⇒ Object
writeonly
Sets the attribute name.
-
#params ⇒ Object
writeonly
Sets the attribute params.
-
#path ⇒ Object
writeonly
Sets the attribute path.
-
#query_params ⇒ Object
writeonly
Sets the attribute query_params.
-
#request_schema ⇒ Object
writeonly
Sets the attribute request_schema.
-
#response_schema_fail ⇒ Object
writeonly
Sets the attribute response_schema_fail.
-
#response_schema_success ⇒ Object
writeonly
Sets the attribute response_schema_success.
-
#verb ⇒ Object
writeonly
Sets the attribute verb.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(name, &block) ⇒ Action
constructor
A new instance of Action.
Methods included from AttrProxy
Constructor Details
#initialize(name, &block) ⇒ Action
Returns a new instance of Action.
16 17 18 19 20 21 |
# File 'lib/dox/dsl/action.rb', line 16 def initialize(name, &block) self.name = name instance_eval(&block) if block_given? raise(Dox::Errors::InvalidActionError, 'Action name is required!') if @name.blank? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Dox::DSL::AttrProxy
Instance Attribute Details
#desc=(value) ⇒ Object (writeonly)
Sets the attribute desc
9 10 11 |
# File 'lib/dox/dsl/action.rb', line 9 def desc=(value) @desc = value end |
#name=(value) ⇒ Object (writeonly)
Sets the attribute name
6 7 8 |
# File 'lib/dox/dsl/action.rb', line 6 def name=(value) @name = value end |
#params=(value) ⇒ Object (writeonly)
Sets the attribute params
10 11 12 |
# File 'lib/dox/dsl/action.rb', line 10 def params=(value) @params = value end |
#path=(value) ⇒ Object (writeonly)
Sets the attribute path
8 9 10 |
# File 'lib/dox/dsl/action.rb', line 8 def path=(value) @path = value end |
#query_params=(value) ⇒ Object (writeonly)
Sets the attribute query_params
11 12 13 |
# File 'lib/dox/dsl/action.rb', line 11 def query_params=(value) @query_params = value end |
#request_schema=(value) ⇒ Object (writeonly)
Sets the attribute request_schema
12 13 14 |
# File 'lib/dox/dsl/action.rb', line 12 def request_schema=(value) @request_schema = value end |
#response_schema_fail=(value) ⇒ Object (writeonly)
Sets the attribute response_schema_fail
14 15 16 |
# File 'lib/dox/dsl/action.rb', line 14 def response_schema_fail=(value) @response_schema_fail = value end |
#response_schema_success=(value) ⇒ Object (writeonly)
Sets the attribute response_schema_success
13 14 15 |
# File 'lib/dox/dsl/action.rb', line 13 def response_schema_success=(value) @response_schema_success = value end |
#verb=(value) ⇒ Object (writeonly)
Sets the attribute verb
7 8 9 |
# File 'lib/dox/dsl/action.rb', line 7 def verb=(value) @verb = value end |
Instance Method Details
#config ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dox/dsl/action.rb', line 23 def config { action_request_schema: @request_schema.presence, action_response_schema_success: @response_schema_success.presence, action_response_schema_fail: @response_schema_fail.presence, action_name: @name.presence, action_verb: @verb.presence, action_path: @path.presence, action_desc: @desc.presence || '', action_params: @params, action_query_params: @query_params.presence || [] } end |