Class: TicketNetwork::Base::Action
- Inherits:
-
Object
- Object
- TicketNetwork::Base::Action
- Defined in:
- lib/ticket_network/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.
Constructor Details
#initialize(operation, options = {}, &block) ⇒ Action
Returns a new instance of Action.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/ticket_network/base.rb', line 6 def initialize(operation, ={}, &block) @name = [:as] || operation @operation = (operation || [:as]).to_s.camelcase.sub(/Id/, 'ID') @method = [:method] @service = [:service] @parser = [:parser] @parameters = {} [:defaults].each { |defaults| instance_eval(&defaults) } instance_eval(&block) if block_given? end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
4 5 6 |
# File 'lib/ticket_network/base.rb', line 4 def method @method end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/ticket_network/base.rb', line 4 def name @name end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
4 5 6 |
# File 'lib/ticket_network/base.rb', line 4 def operation @operation end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
4 5 6 |
# File 'lib/ticket_network/base.rb', line 4 def parameters @parameters end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
4 5 6 |
# File 'lib/ticket_network/base.rb', line 4 def parser @parser end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
4 5 6 |
# File 'lib/ticket_network/base.rb', line 4 def service @service end |
Instance Method Details
#execute(*args) ⇒ Object
23 24 25 26 |
# File 'lib/ticket_network/base.rb', line 23 def execute(*args) parameters = args.first || {} Request.new(self, parameters).perform end |
#parameter(name, options = {}) ⇒ Object
Adds a parameter that the web service accepts.
19 20 21 |
# File 'lib/ticket_network/base.rb', line 19 def parameter(name, ={}) @parameters[name] = end |