Class: Twilio::REST::Memory::V1::ProfileInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, store_id: nil, profile_id: nil) ⇒ ProfileInstance

Initialize the ProfileInstance

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 Profile resource.

  • sid (String)

    The SID of the Call resource to fetch.



545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 545

def initialize(version, payload , store_id: nil, profile_id: nil)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)
    
    # Marshaled Properties
    @properties = { 
        'id' => payload['id'],
        'message' => payload['message'],
        'profiles' => payload['profiles'],
        'meta' => payload['meta'],
    }

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

Instance Method Details

#contextProfileContext

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

Returns:



567
568
569
570
571
572
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 567

def context
    unless @instance_context
        @instance_context = ProfileContext.new(@version , @params['store_id'], @params['profile_id'])
    end
    @instance_context
end

#deleteBoolean

Delete the ProfileInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



601
602
603
604
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 601

def delete

    context.delete
end

#idString

Returns The canonical profile ID.

Returns:

  • (String)

    The canonical profile ID.



576
577
578
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 576

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



627
628
629
630
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 627

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

#messageString

Returns:

  • (String)


582
583
584
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 582

def message
    @properties['message']
end

#metaProfilesMeta

Returns:

  • (ProfilesMeta)


594
595
596
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 594

def meta
    @properties['meta']
end

#patch(profile_patch: nil) ⇒ ProfileInstance

Patch the ProfileInstance

Parameters:

  • profile_patch (ProfilePatch) (defaults to: nil)

Returns:



610
611
612
613
614
615
616
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 610

def patch(profile_patch: nil
)

    context.patch(
        profile_patch: profile_patch, 
    )
end

#profilesArray<String>

Returns:

  • (Array<String>)


588
589
590
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 588

def profiles
    @properties['profiles']
end

#to_sObject

Provide a user friendly representation



620
621
622
623
# File 'lib/twilio-ruby/rest/memory/v1/profile.rb', line 620

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