Class: Twi::Mock::Call
Instance Method Summary collapse
-
#create ⇒ Object
Records the call rather than placing it, and answers whatever the suite arranged.
-
#id ⇒ String
Unique identifier.
-
#status ⇒ String
Call status.
Methods inherited from Call
#digits, params_for, #recipient, #sender
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Twi::Resource
Instance Method Details
#create ⇒ Object
Records the call rather than placing it, and answers whatever the suite arranged.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/twi/mock/call.rb', line 10 def create Twi.mock.calls << @params.slice(:sender, :recipient, :url, :status_callback) if error = Twi.mock.call_error Twi.mock.call_error = nil raise Error, error elsif Twi.mock.call @params[:id] = Twi.mock.call[:id] @params[:status] = Twi.mock.call[:status] else @params[:id] = "CA#{rand}" @params[:status] = 'queued' end end |
#id ⇒ String
Returns unique identifier.
4 |
# File 'lib/twi/mock/call.rb', line 4 def id = @params[:id] |
#status ⇒ String
Returns call status.
7 |
# File 'lib/twi/mock/call.rb', line 7 def status = @params[:status] |