Class: Pabx::Request
- Inherits:
-
Object
- Object
- Pabx::Request
- Defined in:
- lib/pabx/request.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#action_id ⇒ Object
Returns the value of attribute action_id.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#response_data ⇒ Object
Returns the value of attribute response_data.
Instance Method Summary collapse
- #commands ⇒ Object
-
#initialize(action, parameters = {}) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(action, parameters = {}) ⇒ Request
Returns a new instance of Request.
5 6 7 8 9 10 |
# File 'lib/pabx/request.rb', line 5 def initialize(action,parameters={}) self.action = action self.action_id = self.generate_action_id self.parameters = parameters self.response_data = "" end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
3 4 5 |
# File 'lib/pabx/request.rb', line 3 def action @action end |
#action_id ⇒ Object
Returns the value of attribute action_id.
3 4 5 |
# File 'lib/pabx/request.rb', line 3 def action_id @action_id end |
#parameters ⇒ Object
Returns the value of attribute parameters.
3 4 5 |
# File 'lib/pabx/request.rb', line 3 def parameters @parameters end |
#response_data ⇒ Object
Returns the value of attribute response_data.
3 4 5 |
# File 'lib/pabx/request.rb', line 3 def response_data @response_data end |
Instance Method Details
#commands ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/pabx/request.rb', line 12 def commands _commands=["Action: "+self.action+"\r\n","ActionID: "+self.action_id+"\r\n"] self.parameters.each do |key,value| _commands<<key+": "+value+"\r\n" unless value.nil? end _commands[_commands.length-1]<<"\r\n" _commands end |