Class: Twilio::REST::Content::V1::ContentContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/content/v1/content.rb,
lib/twilio-ruby/rest/content/v1/content/approval_fetch.rb,
lib/twilio-ruby/rest/content/v1/content/approval_create.rb

Defined Under Namespace

Classes: ApprovalCreateInstance, ApprovalCreateList, ApprovalCreatePage, ApprovalFetchContext, ApprovalFetchInstance, ApprovalFetchList, ApprovalFetchPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ ContentContext

Initialize the ContentContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The Twilio-provided string that uniquely identifies the Content resource to fetch.



719
720
721
722
723
724
725
726
727
728
729
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 719

def initialize(version, sid)
    super(version)

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

    # Dependents
    @approval_create = nil
    @approval_fetch = nil
end

Instance Method Details

#approval_createApprovalCreateList, ApprovalCreateContext

Access the approval_create

Returns:



765
766
767
768
769
770
771
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 765

def approval_create
  unless @approval_create
    @approval_create = ApprovalCreateList.new(
            @version, content_sid: @solution[:sid], )
  end
  @approval_create
end

#approval_fetchApprovalFetchList, ApprovalFetchContext

Access the approval_fetch



776
777
778
779
780
781
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 776

def approval_fetch
    ApprovalFetchContext.new(
            @version,
            @solution[:sid]
            )
end

#deleteBoolean

Delete the ContentInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



733
734
735
736
737
738
739
740
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 733

def delete

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

#fetchContentInstance

Fetch the ContentInstance

Returns:



745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 745

def fetch

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

#inspectObject

Provide a detailed, user friendly representation



792
793
794
795
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 792

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

#to_sObject

Provide a user friendly representation



785
786
787
788
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 785

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