Class: Twilio::REST::Sync::V1::ServiceContext::SyncMapContext::SyncMapPermissionInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, map_sid: nil, identity: nil) ⇒ SyncMapPermissionInstance

Initialize the SyncMapPermissionInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • service_sid (String) (defaults to: nil)

    The SID of the [Sync Service](www.twilio.com/docs/sync/api/service) the resource is associated with.

  • map_sid (String) (defaults to: nil)

    The SID of the Sync Map to which the Permission applies.

  • identity (String) (defaults to: nil)

    The application-defined string that uniquely identifies the User’s Sync Map Permission resource to fetch.



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 253

def initialize(version, payload, service_sid: nil, map_sid: nil, identity: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'service_sid' => payload['service_sid'],
      'map_sid' => payload['map_sid'],
      'identity' => payload['identity'],
      'read' => payload['read'],
      'write' => payload['write'],
      'manage' => payload['manage'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {
      'service_sid' => service_sid,
      'map_sid' => map_sid,
      'identity' => identity || @properties['identity'],
  }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



295
296
297
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 295

def 
  @properties['account_sid']
end

#contextSyncMapPermissionContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



281
282
283
284
285
286
287
288
289
290
291
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 281

def context
  unless @instance_context
    @instance_context = SyncMapPermissionContext.new(
        @version,
        @params['service_sid'],
        @params['map_sid'],
        @params['identity'],
    )
  end
  @instance_context
end

#deleteBoolean

Delete the SyncMapPermissionInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



351
352
353
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 351

def delete
  context.delete
end

#fetchSyncMapPermissionInstance

Fetch the SyncMapPermissionInstance

Returns:



344
345
346
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 344

def fetch
  context.fetch
end

#identityString

Returns The identity of the user to whom the Sync Document Permission applies.

Returns:

  • (String)

    The identity of the user to whom the Sync Document Permission applies



313
314
315
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 313

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



377
378
379
380
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 377

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Sync.V1.SyncMapPermissionInstance #{values}>"
end

#manageBoolean

Returns Manage access.

Returns:

  • (Boolean)

    Manage access



331
332
333
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 331

def manage
  @properties['manage']
end

#map_sidString

Returns Sync Map SID.

Returns:

  • (String)

    Sync Map SID



307
308
309
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 307

def map_sid
  @properties['map_sid']
end

#readBoolean

Returns Read access.

Returns:

  • (Boolean)

    Read access



319
320
321
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 319

def read
  @properties['read']
end

#service_sidString

Returns The SID of the Sync Service that the resource is associated with.

Returns:

  • (String)

    The SID of the Sync Service that the resource is associated with



301
302
303
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 301

def service_sid
  @properties['service_sid']
end

#to_sObject

Provide a user friendly representation



370
371
372
373
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 370

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Sync.V1.SyncMapPermissionInstance #{values}>"
end

#update(read: nil, write: nil, manage: nil) ⇒ SyncMapPermissionInstance

Update the SyncMapPermissionInstance

Parameters:

  • read (Boolean) (defaults to: nil)

    Whether the identity can read the Sync Map and its Items. Default value is ‘false`.

  • write (Boolean) (defaults to: nil)

    Whether the identity can create, update, and delete Items in the Sync Map. Default value is ‘false`.

  • manage (Boolean) (defaults to: nil)

    Whether the identity can delete the Sync Map. Default value is ‘false`.

Returns:



364
365
366
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 364

def update(read: nil, write: nil, manage: nil)
  context.update(read: read, write: write, manage: manage, )
end

#urlString

Returns The absolute URL of the Sync Map Permission resource.

Returns:

  • (String)

    The absolute URL of the Sync Map Permission resource



337
338
339
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 337

def url
  @properties['url']
end

#writeBoolean

Returns Write access.

Returns:

  • (Boolean)

    Write access



325
326
327
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 325

def write
  @properties['write']
end