Class: Twilio::REST::IpMessaging::V1::ServiceContext::RoleContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::IpMessaging::V1::ServiceContext::RoleContext
- Defined in:
- lib/twilio-ruby/rest/ip_messaging/v1/service/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, service_sid, 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, service_sid, sid) ⇒ RoleContext
Initialize the RoleContext
232 233 234 235 236 237 238 239 240 241 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb', line 232 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Roles/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the RoleInstance
245 246 247 248 249 250 251 252 253 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb', line 245 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
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb', line 258 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
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb', line 277 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) RoleInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ RoleInstance
Fetch the RoleInstanceMetadata
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb', line 297 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, service_sid: @solution[:service_sid], sid: @solution[:sid], ) RoleInstanceMetadata.new( @version, role_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
390 391 392 393 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb', line 390 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V1.RoleContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
383 384 385 386 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb', line 383 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V1.RoleContext #{context}>" end |
#update(permission: nil) ⇒ RoleInstance
Update the RoleInstance
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb', line 324 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, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#update_with_metadata(permission: nil) ⇒ RoleInstance
Update the RoleInstanceMetadata
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb', line 351 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, service_sid: @solution[:service_sid], sid: @solution[:sid], ) RoleInstanceMetadata.new( @version, role_instance, response.headers, response.status_code ) end |