Class: Bandwidth::CallState
- Defined in:
- lib/bandwidth/voice_lib/voice/models/call_state.rb
Overview
CallState Model.
Instance Attribute Summary collapse
-
#account_id ⇒ String
TODO: Write general description for this method.
-
#answer_time ⇒ DateTime
The current state of the call.
-
#application_id ⇒ String
TODO: Write general description for this method.
-
#call_id ⇒ String
TODO: Write general description for this method.
-
#direction ⇒ String
TODO: Write general description for this method.
-
#disconnect_cause ⇒ String
The reason the call was disconnected, or null if the call is still active.
-
#end_time ⇒ DateTime
The current state of the call.
-
#error_id ⇒ String
The reason the call was disconnected, or null if the call is still active.
-
#error_message ⇒ String
The reason the call was disconnected, or null if the call is still active.
-
#from ⇒ String
TODO: Write general description for this method.
-
#identity ⇒ String
The current state of the call.
-
#last_update ⇒ DateTime
The reason the call was disconnected, or null if the call is still active.
-
#pai ⇒ Hash
The current state of the call.
-
#parent_call_id ⇒ String
TODO: Write general description for this method.
-
#start_time ⇒ DateTime
The current state of the call.
-
#state ⇒ String
The current state of the call.
-
#to ⇒ String
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(call_id = nil, parent_call_id = nil, application_id = nil, account_id = nil, to = nil, from = nil, direction = nil, state = nil, identity = nil, pai = nil, start_time = nil, answer_time = nil, end_time = nil, disconnect_cause = nil, error_message = nil, error_id = nil, last_update = nil) ⇒ CallState
constructor
A new instance of CallState.
- #to_answer_time ⇒ Object
- #to_end_time ⇒ Object
- #to_last_update ⇒ Object
- #to_start_time ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(call_id = nil, parent_call_id = nil, application_id = nil, account_id = nil, to = nil, from = nil, direction = nil, state = nil, identity = nil, pai = nil, start_time = nil, answer_time = nil, end_time = nil, disconnect_cause = nil, error_message = nil, error_id = nil, last_update = nil) ⇒ CallState
Returns a new instance of CallState.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 133 def initialize(call_id = nil, parent_call_id = nil, application_id = nil, account_id = nil, to = nil, from = nil, direction = nil, state = nil, identity = nil, pai = nil, start_time = nil, answer_time = nil, end_time = nil, disconnect_cause = nil, = nil, error_id = nil, last_update = nil) @call_id = call_id @parent_call_id = parent_call_id @application_id = application_id @account_id = account_id @to = to @from = from @direction = direction @state = state @identity = identity @pai = pai @start_time = start_time @answer_time = answer_time @end_time = end_time @disconnect_cause = disconnect_cause @error_message = @error_id = error_id @last_update = last_update end |
Instance Attribute Details
#account_id ⇒ String
TODO: Write general description for this method
24 25 26 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 24 def account_id @account_id end |
#answer_time ⇒ DateTime
The current state of the call. Current possible values are ‘initiated’, ‘answered’ and ‘disconnected’. Additional states may be added in the future, so your application must be tolerant of unknown values.
66 67 68 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 66 def answer_time @answer_time end |
#application_id ⇒ String
TODO: Write general description for this method
20 21 22 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 20 def application_id @application_id end |
#call_id ⇒ String
TODO: Write general description for this method
12 13 14 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 12 def call_id @call_id end |
#direction ⇒ String
TODO: Write general description for this method
36 37 38 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 36 def direction @direction end |
#disconnect_cause ⇒ String
The reason the call was disconnected, or null if the call is still active. Current values are ‘cancel’, ‘timeout’, ‘busy’, ‘rejected’, ‘hangup’, ‘invalid-bxml’, ‘callback-error’, ‘application-error’, ‘error’, ‘account-limit’, ‘node-capacity-exceeded’ and ‘unknown’. Additional causes may be added in the future, so your application must be tolerant of unknown values.
81 82 83 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 81 def disconnect_cause @disconnect_cause end |
#end_time ⇒ DateTime
The current state of the call. Current possible values are ‘initiated’, ‘answered’ and ‘disconnected’. Additional states may be added in the future, so your application must be tolerant of unknown values.
72 73 74 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 72 def end_time @end_time end |
#error_id ⇒ String
The reason the call was disconnected, or null if the call is still active. Current values are ‘cancel’, ‘timeout’, ‘busy’, ‘rejected’, ‘hangup’, ‘invalid-bxml’, ‘callback-error’, ‘application-error’, ‘error’, ‘account-limit’, ‘node-capacity-exceeded’ and ‘unknown’. Additional causes may be added in the future, so your application must be tolerant of unknown values.
99 100 101 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 99 def error_id @error_id end |
#error_message ⇒ String
The reason the call was disconnected, or null if the call is still active. Current values are ‘cancel’, ‘timeout’, ‘busy’, ‘rejected’, ‘hangup’, ‘invalid-bxml’, ‘callback-error’, ‘application-error’, ‘error’, ‘account-limit’, ‘node-capacity-exceeded’ and ‘unknown’. Additional causes may be added in the future, so your application must be tolerant of unknown values.
90 91 92 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 90 def @error_message end |
#from ⇒ String
TODO: Write general description for this method
32 33 34 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 32 def from @from end |
#identity ⇒ String
The current state of the call. Current possible values are ‘initiated’, ‘answered’ and ‘disconnected’. Additional states may be added in the future, so your application must be tolerant of unknown values.
48 49 50 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 48 def identity @identity end |
#last_update ⇒ DateTime
The reason the call was disconnected, or null if the call is still active. Current values are ‘cancel’, ‘timeout’, ‘busy’, ‘rejected’, ‘hangup’, ‘invalid-bxml’, ‘callback-error’, ‘application-error’, ‘error’, ‘account-limit’, ‘node-capacity-exceeded’ and ‘unknown’. Additional causes may be added in the future, so your application must be tolerant of unknown values.
108 109 110 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 108 def last_update @last_update end |
#pai ⇒ Hash
The current state of the call. Current possible values are ‘initiated’, ‘answered’ and ‘disconnected’. Additional states may be added in the future, so your application must be tolerant of unknown values.
54 55 56 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 54 def pai @pai end |
#parent_call_id ⇒ String
TODO: Write general description for this method
16 17 18 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 16 def parent_call_id @parent_call_id end |
#start_time ⇒ DateTime
The current state of the call. Current possible values are ‘initiated’, ‘answered’ and ‘disconnected’. Additional states may be added in the future, so your application must be tolerant of unknown values.
60 61 62 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 60 def start_time @start_time end |
#state ⇒ String
The current state of the call. Current possible values are ‘initiated’, ‘answered’ and ‘disconnected’. Additional states may be added in the future, so your application must be tolerant of unknown values.
42 43 44 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 42 def state @state end |
#to ⇒ String
TODO: Write general description for this method
28 29 30 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 28 def to @to end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 170 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. call_id = hash['callId'] parent_call_id = hash['parentCallId'] application_id = hash['applicationId'] account_id = hash['accountId'] to = hash['to'] from = hash['from'] direction = hash['direction'] state = hash['state'] identity = hash['identity'] pai = hash['pai'] start_time = DateTimeHelper.from_rfc3339(hash['startTime']) if hash['startTime'] answer_time = DateTimeHelper.from_rfc3339(hash['answerTime']) if hash['answerTime'] end_time = DateTimeHelper.from_rfc3339(hash['endTime']) if hash['endTime'] disconnect_cause = hash['disconnectCause'] = hash['errorMessage'] error_id = hash['errorId'] last_update = DateTimeHelper.from_rfc3339(hash['lastUpdate']) if hash['lastUpdate'] # Create object from extracted values. CallState.new(call_id, parent_call_id, application_id, account_id, to, from, direction, state, identity, pai, start_time, answer_time, end_time, disconnect_cause, , error_id, last_update) end |
.names ⇒ Object
A mapping from model property names to API property names.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 111 def self.names @_hash = {} if @_hash.nil? @_hash['call_id'] = 'callId' @_hash['parent_call_id'] = 'parentCallId' @_hash['application_id'] = 'applicationId' @_hash['account_id'] = 'accountId' @_hash['to'] = 'to' @_hash['from'] = 'from' @_hash['direction'] = 'direction' @_hash['state'] = 'state' @_hash['identity'] = 'identity' @_hash['pai'] = 'pai' @_hash['start_time'] = 'startTime' @_hash['answer_time'] = 'answerTime' @_hash['end_time'] = 'endTime' @_hash['disconnect_cause'] = 'disconnectCause' @_hash['error_message'] = 'errorMessage' @_hash['error_id'] = 'errorId' @_hash['last_update'] = 'lastUpdate' @_hash end |
Instance Method Details
#to_answer_time ⇒ Object
220 221 222 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 220 def to_answer_time DateTimeHelper.to_rfc3339(answer_time) end |
#to_end_time ⇒ Object
224 225 226 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 224 def to_end_time DateTimeHelper.to_rfc3339(end_time) end |
#to_last_update ⇒ Object
228 229 230 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 228 def to_last_update DateTimeHelper.to_rfc3339(last_update) end |
#to_start_time ⇒ Object
216 217 218 |
# File 'lib/bandwidth/voice_lib/voice/models/call_state.rb', line 216 def to_start_time DateTimeHelper.to_rfc3339(start_time) end |