Module: Fleck::Core::Consumer::Decorators::ClassMethods
- Defined in:
- lib/fleck/core/consumer/decorators.rb
Overview
Defines class methods to import when ‘Decorators` module is imported.
Instance Method Summary collapse
- #action(name, description = nil) ⇒ Object
- #default_method_options ⇒ Object
- #desc(description) ⇒ Object
- #header(name, modifier = nil, **options) ⇒ Object
- #method_added(name) ⇒ Object
- #method_options ⇒ Object
- #param(name, modifier = nil, **options) ⇒ Object
- #reset_method_options! ⇒ Object
Instance Method Details
#action(name, description = nil) ⇒ Object
43 44 45 46 |
# File 'lib/fleck/core/consumer/decorators.rb', line 43 def action(name, description = nil) action_name(name) desc(description) end |
#default_method_options ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/fleck/core/consumer/decorators.rb', line 30 def { action_name: nil, description: nil, params: {}.to_hash_with_indifferent_access, headers: {}.to_hash_with_indifferent_access } end |
#desc(description) ⇒ Object
48 49 50 |
# File 'lib/fleck/core/consumer/decorators.rb', line 48 def desc(description) [:description] = description if description end |
#header(name, modifier = nil, **options) ⇒ Object
56 57 58 59 |
# File 'lib/fleck/core/consumer/decorators.rb', line 56 def header(name, modifier = nil, **) raise 'Not Implemented' # method_options[:headers][name] = ActionParam.new(name, options[:type], options) end |
#method_added(name) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/fleck/core/consumer/decorators.rb', line 16 def method_added(name) super(name) # Register method as action `action` or `action_name` decorator has been used [:action_name] && register_action([:action_name], name, ) # Reset method options after method has been added end |
#method_options ⇒ Object
26 27 28 |
# File 'lib/fleck/core/consumer/decorators.rb', line 26 def @method_options ||= end |
#param(name, modifier = nil, **options) ⇒ Object
52 53 54 |
# File 'lib/fleck/core/consumer/decorators.rb', line 52 def param(name, modifier = nil, **) [:params][name] = ActionParam.new(name, modifier, **) end |
#reset_method_options! ⇒ Object
39 40 41 |
# File 'lib/fleck/core/consumer/decorators.rb', line 39 def @method_options = nil end |