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.



536
537
538
539
540
541
542
543
544
545
546
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 536

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:



576
577
578
579
580
581
582
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 576

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



587
588
589
590
591
592
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 587

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

#deleteBoolean

Delete the ContentInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



550
551
552
553
554
555
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 550

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:



560
561
562
563
564
565
566
567
568
569
570
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 560

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



603
604
605
606
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 603

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

#to_sObject

Provide a user friendly representation



596
597
598
599
# File 'lib/twilio-ruby/rest/content/v1/content.rb', line 596

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