Class: Twilio::REST::Preview::DeployedDevices::FleetContext::DeploymentContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, fleet_sid, sid) ⇒ DeploymentContext

Initialize the DeploymentContext

Parameters:

  • version (Version)

    Version that contains the resource

  • fleet_sid (String)
  • sid (String)

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



161
162
163
164
165
166
167
168
169
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 161

def initialize(version, fleet_sid, sid)
    super(version)

    # Path Solution
    @solution = { fleet_sid: fleet_sid, sid: sid,  }
    @uri = "/Fleets/#{@solution[:fleet_sid]}/Deployments/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the DeploymentInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



173
174
175
176
177
178
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 173

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchDeploymentInstance

Fetch the DeploymentInstance

Returns:



183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 183

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    payload = @version.fetch('GET', @uri, headers: headers)
    DeploymentInstance.new(
        @version,
        payload,
        fleet_sid: @solution[:fleet_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



232
233
234
235
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 232

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Preview.DeployedDevices.DeploymentContext #{context}>"
end

#to_sObject

Provide a user friendly representation



225
226
227
228
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 225

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Preview.DeployedDevices.DeploymentContext #{context}>"
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:



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb', line 201

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

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'SyncServiceSid' => sync_service_sid,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    DeploymentInstance.new(
        @version,
        payload,
        fleet_sid: @solution[:fleet_sid],
        sid: @solution[:sid],
    )
end