Class: Twilio::REST::Memory::V1::ProfileContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/memory/v1/profile.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, store_id, profile_id) ⇒ ProfileContext

Initialize the ProfileContext

Parameters:

  • version (Version)

    Version that contains the resource

  • store_id (String)

    A unique Memory Store ID using Twilio Type ID (TTID) format

  • profile_id (String)

    The unique identifier for the profile using Twilio Type ID (TTID) format.



283
284
285
286
287
288
289
290
291
292
293
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 283

def initialize(version, store_id, profile_id)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)

    # Path Solution
    @solution = { store_id: store_id, profile_id: profile_id,  }
    @uri = "/Stores/#{@solution[:store_id]}/Profiles/#{@solution[:profile_id]}"

    
end

Instance Method Details

#deleteBoolean

Delete the ProfileInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 297

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    response = @version.('DELETE', @uri, headers: headers)
    ProfileInstance.new(
      @version,
      response.body,
        store_id: @solution[:store_id],
        profile_id: @solution[:profile_id],
    )
    
end

#delete_with_metadataBoolean

Delete the ProfileInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 316

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      profile_instance = ProfileInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      ProfileInstanceMetadata.new(@version, profile_instance, response.headers, response.status_code)
end

#inspectObject

Provide a detailed, user friendly representation



392
393
394
395
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 392

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

#patch(profile_patch: nil) ⇒ ProfileInstance

Patch the ProfileInstance

Parameters:

  • profile_patch (ProfilePatch) (defaults to: nil)

Returns:



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 336

def patch(profile_patch: nil
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
    
    payload = @version.patch('PATCH', @uri, headers: headers, data: profile_patch.to_json)
    ProfileInstance.new(
        @version,
        payload,
        store_id: @solution[:store_id],
        profile_id: @solution[:profile_id],
    )
end

#patch_with_metadata(profile_patch: nil) ⇒ ProfileInstance

Patch the ProfileInstanceMetadata

Parameters:

  • profile_patch (ProfilePatch) (defaults to: nil)

Returns:



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 358

def (profile_patch: nil
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
    
    response = @version.('PATCH', @uri, headers: headers, data: profile_patch.to_json)
    profile_instance = ProfileInstance.new(
        @version,
        response.body,
        store_id: @solution[:store_id],
        profile_id: @solution[:profile_id],
    )
    ProfileInstanceMetadata.new(
        @version,
        profile_instance,
        response.headers,
        response.status_code
    )
end

#to_sObject

Provide a user friendly representation



385
386
387
388
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 385

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Memory.V1.ProfileContext #{context}>"
end