Class: Twilio::REST::Proxy::V1::ServiceContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Proxy::V1::ServiceContext
- Defined in:
- lib/twilio-ruby/rest/proxy/v1/service.rb,
lib/twilio-ruby/rest/proxy/v1/service/session.rb,
lib/twilio-ruby/rest/proxy/v1/service/short_code.rb,
lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb,
lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb,
lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb,
lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb
Overview
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Defined Under Namespace
Classes: PhoneNumberContext, PhoneNumberInstance, PhoneNumberList, PhoneNumberPage, SessionContext, SessionInstance, SessionList, SessionPage, ShortCodeContext, ShortCodeInstance, ShortCodeList, ShortCodePage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Deletes the ServiceInstance.
-
#fetch ⇒ ServiceInstance
Fetch a ServiceInstance.
-
#initialize(version, sid) ⇒ ServiceContext
constructor
Initialize the ServiceContext.
-
#phone_numbers(sid = :unset) ⇒ PhoneNumberList, PhoneNumberContext
Access the phone_numbers.
-
#sessions(sid = :unset) ⇒ SessionList, SessionContext
Access the sessions.
-
#short_codes(sid = :unset) ⇒ ShortCodeList, ShortCodeContext
Access the short_codes.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(unique_name: :unset, default_ttl: :unset, callback_url: :unset, geo_match_level: :unset, number_selection_behavior: :unset, intercept_callback_url: :unset, out_of_session_callback_url: :unset) ⇒ ServiceInstance
Update the ServiceInstance.
Constructor Details
#initialize(version, sid) ⇒ ServiceContext
Initialize the ServiceContext
198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 198 def initialize(version, sid) super(version) # Path Solution @solution = {sid: sid, } @uri = "/Services/#{@solution[:sid]}" # Dependents @sessions = nil @phone_numbers = nil @short_codes = nil end |
Instance Method Details
#delete ⇒ Boolean
Deletes the ServiceInstance
229 230 231 |
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 229 def delete @version.delete('delete', @uri) end |
#fetch ⇒ ServiceInstance
Fetch a ServiceInstance
214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 214 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) ServiceInstance.new(@version, payload, sid: @solution[:sid], ) end |
#phone_numbers(sid = :unset) ⇒ PhoneNumberList, PhoneNumberContext
Access the phone_numbers
296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 296 def phone_numbers(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return PhoneNumberContext.new(@version, @solution[:sid], sid, ) end unless @phone_numbers @phone_numbers = PhoneNumberList.new(@version, service_sid: @solution[:sid], ) end @phone_numbers end |
#sessions(sid = :unset) ⇒ SessionList, SessionContext
Access the sessions
278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 278 def sessions(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return SessionContext.new(@version, @solution[:sid], sid, ) end unless @sessions @sessions = SessionList.new(@version, service_sid: @solution[:sid], ) end @sessions end |
#short_codes(sid = :unset) ⇒ ShortCodeList, ShortCodeContext
Access the short_codes
314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 314 def short_codes(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return ShortCodeContext.new(@version, @solution[:sid], sid, ) end unless @short_codes @short_codes = ShortCodeList.new(@version, service_sid: @solution[:sid], ) end @short_codes end |
#to_s ⇒ Object
Provide a user friendly representation
330 331 332 333 |
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 330 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Proxy.V1.ServiceContext #{context}>" end |
#update(unique_name: :unset, default_ttl: :unset, callback_url: :unset, geo_match_level: :unset, number_selection_behavior: :unset, intercept_callback_url: :unset, out_of_session_callback_url: :unset) ⇒ ServiceInstance
Update the ServiceInstance
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/twilio-ruby/rest/proxy/v1/service.rb', line 254 def update(unique_name: :unset, default_ttl: :unset, callback_url: :unset, geo_match_level: :unset, number_selection_behavior: :unset, intercept_callback_url: :unset, out_of_session_callback_url: :unset) data = Twilio::Values.of({ 'UniqueName' => unique_name, 'DefaultTtl' => default_ttl, 'CallbackUrl' => callback_url, 'GeoMatchLevel' => geo_match_level, 'NumberSelectionBehavior' => number_selection_behavior, 'InterceptCallbackUrl' => intercept_callback_url, 'OutOfSessionCallbackUrl' => out_of_session_callback_url, }) payload = @version.update( 'POST', @uri, data: data, ) ServiceInstance.new(@version, payload, sid: @solution[:sid], ) end |