Class: Twilio::REST::Chat::V2::ServiceContext::RoleContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Chat::V2::ServiceContext::RoleContext
- Defined in:
- lib/twilio-ruby/rest/chat/v2/service/role.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Deletes the RoleInstance.
-
#fetch ⇒ RoleInstance
Fetch a RoleInstance.
-
#initialize(version, service_sid, sid) ⇒ RoleContext
constructor
Initialize the RoleContext.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(permission: nil) ⇒ RoleInstance
Update the RoleInstance.
Constructor Details
#initialize(version, service_sid, sid) ⇒ RoleContext
Initialize the RoleContext
191 192 193 194 195 196 197 198 199 200 |
# File 'lib/twilio-ruby/rest/chat/v2/service/role.rb', line 191 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
Deletes the RoleInstance
225 226 227 |
# File 'lib/twilio-ruby/rest/chat/v2/service/role.rb', line 225 def delete @version.delete('delete', @uri) end |
#fetch ⇒ RoleInstance
Fetch a RoleInstance
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/twilio-ruby/rest/chat/v2/service/role.rb', line 205 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) RoleInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#to_s ⇒ Object
Provide a user friendly representation
254 255 256 257 |
# File 'lib/twilio-ruby/rest/chat/v2/service/role.rb', line 254 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Chat.V2.RoleContext #{context}>" end |
#update(permission: nil) ⇒ RoleInstance
Update the RoleInstance
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/twilio-ruby/rest/chat/v2/service/role.rb', line 233 def update(permission: nil) data = Twilio::Values.of({ 'Permission' => , }) payload = @version.update( 'POST', @uri, data: data, ) RoleInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |