Class: EventInventory::Base::Action
- Inherits:
-
Object
- Object
- EventInventory::Base::Action
- Includes:
- FormatHelper
- Defined in:
- lib/event_inventory/base.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #execute(*args) ⇒ Object
-
#initialize(operation, options = {}, &block) ⇒ Action
constructor
A new instance of Action.
-
#parameter(name, options = {}) ⇒ Object
Adds a parameter that the web service accepts.
Methods included from FormatHelper
#format_key, #format_query_value
Constructor Details
#initialize(operation, options = {}, &block) ⇒ Action
Returns a new instance of Action.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/event_inventory/base.rb', line 8 def initialize(operation, ={}, &block) @name = [:as] || operation @operation = format_key(operation || [:as]) @method = [:method] @service = [:service] @parser = [:parser] @parameters = {} instance_eval(&block) if block_given? end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
6 7 8 |
# File 'lib/event_inventory/base.rb', line 6 def method @method end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/event_inventory/base.rb', line 6 def name @name end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
6 7 8 |
# File 'lib/event_inventory/base.rb', line 6 def operation @operation end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
6 7 8 |
# File 'lib/event_inventory/base.rb', line 6 def parameters @parameters end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
6 7 8 |
# File 'lib/event_inventory/base.rb', line 6 def parser @parser end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
6 7 8 |
# File 'lib/event_inventory/base.rb', line 6 def service @service end |
Instance Method Details
#execute(*args) ⇒ Object
24 25 26 27 |
# File 'lib/event_inventory/base.rb', line 24 def execute(*args) parameters = args.first || {} Request.new(self, parameters).perform end |
#parameter(name, options = {}) ⇒ Object
Adds a parameter that the web service accepts.
20 21 22 |
# File 'lib/event_inventory/base.rb', line 20 def parameter(name, ={}) @parameters[name] = end |