Class: Twilio::REST::Preview::DeployedDevices::FleetContext::DeploymentInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, fleet_sid: nil, sid: nil) ⇒ DeploymentInstance

Initialize the DeploymentInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • fleet_sid (String) (defaults to: nil)

    Specifies the unique string identifier of the Fleet that the given Deployment belongs to.

  • sid (String) (defaults to: nil)

    Provides a 34 character string that uniquely identifies the requested Deployment resource.



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 259

def initialize(version, payload, fleet_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'url' => payload['url'],
      'friendly_name' => payload['friendly_name'],
      'fleet_sid' => payload['fleet_sid'],
      'account_sid' => payload['account_sid'],
      'sync_service_sid' => payload['sync_service_sid'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
  }

  # Context
  @instance_context = nil
  @params = {'fleet_sid' => fleet_sid, 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The unique SID that identifies this Account.

Returns:

  • (String)

    The unique SID that identifies this Account.



316
317
318
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 316

def 
  @properties['account_sid']
end

#contextDeploymentContext

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

Returns:



283
284
285
286
287
288
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 283

def context
  unless @instance_context
    @instance_context = DeploymentContext.new(@version, @params['fleet_sid'], @params['sid'], )
  end
  @instance_context
end

#date_createdTime

Returns The date this Deployment was created.

Returns:

  • (Time)

    The date this Deployment was created.



328
329
330
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 328

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this Deployment was updated.

Returns:

  • (Time)

    The date this Deployment was updated.



334
335
336
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 334

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the DeploymentInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



348
349
350
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 348

def delete
  context.delete
end

#fetchDeploymentInstance

Fetch a DeploymentInstance

Returns:



341
342
343
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 341

def fetch
  context.fetch
end

#fleet_sidString

Returns The unique identifier of the Fleet.

Returns:

  • (String)

    The unique identifier of the Fleet.



310
311
312
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 310

def fleet_sid
  @properties['fleet_sid']
end

#friendly_nameString

Returns A human readable description for this Deployment.

Returns:

  • (String)

    A human readable description for this Deployment



304
305
306
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 304

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



373
374
375
376
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 373

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

#sidString

Returns A string that uniquely identifies this Deployment.

Returns:

  • (String)

    A string that uniquely identifies this Deployment.



292
293
294
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 292

def sid
  @properties['sid']
end

#sync_service_sidString

Returns The unique identifier of the Sync service instance.

Returns:

  • (String)

    The unique identifier of the Sync service instance.



322
323
324
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 322

def sync_service_sid
  @properties['sync_service_sid']
end

#to_sObject

Provide a user friendly representation



366
367
368
369
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 366

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

#update(friendly_name: :unset, sync_service_sid: :unset) ⇒ DeploymentInstance

Update the DeploymentInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    Provides a human readable descriptive text for this Deployment, up to 64 characters long

  • sync_service_sid (String) (defaults to: :unset)

    Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment.

Returns:



360
361
362
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 360

def update(friendly_name: :unset, sync_service_sid: :unset)
  context.update(friendly_name: friendly_name, sync_service_sid: sync_service_sid, )
end

#urlString

Returns URL of this Deployment.

Returns:

  • (String)

    URL of this Deployment.



298
299
300
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 298

def url
  @properties['url']
end