Class: Twilio::REST::Conversations::V1::RoleContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Conversations::V1::RoleContext
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/role.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the RoleInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the RoleInstanceMetadata.
-
#fetch ⇒ RoleInstance
Fetch the RoleInstance.
-
#fetch_with_metadata ⇒ RoleInstance
Fetch the RoleInstanceMetadata.
-
#initialize(version, sid) ⇒ RoleContext
constructor
Initialize the RoleContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(permission: nil) ⇒ RoleInstance
Update the RoleInstance.
-
#update_with_metadata(permission: nil) ⇒ RoleInstance
Update the RoleInstanceMetadata.
Constructor Details
#initialize(version, sid) ⇒ RoleContext
Initialize the RoleContext
227 228 229 230 231 232 233 234 235 236 |
# File 'lib/twilio-ruby/rest/conversations/v1/role.rb', line 227 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Roles/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the RoleInstance
240 241 242 243 244 245 246 247 248 |
# File 'lib/twilio-ruby/rest/conversations/v1/role.rb', line 240 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the RoleInstanceMetadata
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/twilio-ruby/rest/conversations/v1/role.rb', line 253 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) role_instance = RoleInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) RoleInstanceMetadata.new(@version, role_instance, response.headers, response.status_code) end |
#fetch ⇒ RoleInstance
Fetch the RoleInstance
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/twilio-ruby/rest/conversations/v1/role.rb', line 272 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) RoleInstance.new( @version, payload, sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ RoleInstance
Fetch the RoleInstanceMetadata
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/twilio-ruby/rest/conversations/v1/role.rb', line 291 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) role_instance = RoleInstance.new( @version, response.body, sid: @solution[:sid], ) RoleInstanceMetadata.new( @version, role_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
381 382 383 384 |
# File 'lib/twilio-ruby/rest/conversations/v1/role.rb', line 381 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.RoleContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
374 375 376 377 |
# File 'lib/twilio-ruby/rest/conversations/v1/role.rb', line 374 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.RoleContext #{context}>" end |
#update(permission: nil) ⇒ RoleInstance
Update the RoleInstance
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/twilio-ruby/rest/conversations/v1/role.rb', line 317 def update( permission: nil ) data = Twilio::Values.of({ 'Permission' => Twilio.serialize_list() { |e| e }, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) RoleInstance.new( @version, payload, sid: @solution[:sid], ) end |
#update_with_metadata(permission: nil) ⇒ RoleInstance
Update the RoleInstanceMetadata
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
# File 'lib/twilio-ruby/rest/conversations/v1/role.rb', line 343 def ( permission: nil ) data = Twilio::Values.of({ 'Permission' => Twilio.serialize_list() { |e| e }, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) role_instance = RoleInstance.new( @version, response.body, sid: @solution[:sid], ) RoleInstanceMetadata.new( @version, role_instance, response.headers, response.status_code ) end |