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

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

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

  • account_sid (String)

    The SID of the Account that created this Deployment resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 269

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  || @properties['fleet_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns Specifies the unique string identifier of the Account responsible for this Deployment.

Returns:

  • (String)

    Specifies the unique string identifier of the Account responsible for this Deployment.



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

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:



293
294
295
296
297
298
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 293

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

#date_createdTime

Returns Specifies the date this Deployment was created, given in UTC ISO 8601 format.

Returns:

  • (Time)

    Specifies the date this Deployment was created, given in UTC ISO 8601 format.



338
339
340
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 338

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns Specifies the date this Deployment was last updated, given in UTC ISO 8601 format.

Returns:

  • (Time)

    Specifies the date this Deployment was last updated, given in UTC ISO 8601 format.



344
345
346
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 344

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the DeploymentInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



351
352
353
354
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 351

def delete

    context.delete
end

#fetchDeploymentInstance

Fetch the DeploymentInstance

Returns:



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

def fetch

    context.fetch
end

#fleet_sidString

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

Returns:

  • (String)

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



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

def fleet_sid
    @properties['fleet_sid']
end

#friendly_nameString

Returns Contains a human readable descriptive text for this Deployment, up to 64 characters long.

Returns:

  • (String)

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



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

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



389
390
391
392
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 389

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

#sidString

Returns Contains a 34 character string that uniquely identifies this Deployment resource.

Returns:

  • (String)

    Contains a 34 character string that uniquely identifies this Deployment resource.



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

def sid
    @properties['sid']
end

#sync_service_sidString

Returns Specifies the unique string identifier of the Twilio Sync service instance linked to and accessible by this Deployment.

Returns:

  • (String)

    Specifies the unique string identifier of the Twilio Sync service instance linked to and accessible by this Deployment.



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

def sync_service_sid
    @properties['sync_service_sid']
end

#to_sObject

Provide a user friendly representation



382
383
384
385
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 382

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:



369
370
371
372
373
374
375
376
377
378
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 369

def update(
    friendly_name: :unset, 
    sync_service_sid: :unset
)

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

#urlString

Returns Contains an absolute URL for this Deployment resource.

Returns:

  • (String)

    Contains an absolute URL for this Deployment resource.



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

def url
    @properties['url']
end