Class: Twilio::REST::Insights::V2::ReportInstance

Inherits:
Twilio::REST::InstanceResource show all
Defined in:
lib/twilio-ruby/rest/insights/v2/report.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, report_id: nil) ⇒ ReportInstance

Initialize the ReportInstance

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

  • sid (String) —

    The SID of the Call resource to fetch.



692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 692

def initialize(version, payload , report_id: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'report_id' => payload['report_id'],
        'status' => payload['status'],
        'request_meta' => payload['request_meta'],
        'url' => payload['url'],
        'report' => payload['report'],
    }

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

Instance Method Details

#account_sid ⇒ String

Returns The unique SID identifier of the Account.

Returns:

  • (String) —

    The unique SID identifier of the Account.



724
725
726
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 724

def 
    @properties['account_sid']
end

#context ⇒ ReportContext

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

Returns:



715
716
717
718
719
720
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 715

def context
    unless @instance_context
        @instance_context = ReportContext.new(@version , @params['report_id'])
    end
    @instance_context
end

#fetch ⇒ ReportInstance

Fetch the ReportInstance

Returns:



761
762
763
764
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 761

def fetch

    context.fetch
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



775
776
777
778
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 775

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

#report ⇒ AccountReport

Returns:

  • (AccountReport)


754
755
756
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 754

def report
    @properties['report']
end

#report_id ⇒ String

Returns The report identifier as Voice Insights Report TTID.

Returns:

  • (String) —

    The report identifier as Voice Insights Report TTID.



730
731
732
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 730

def report_id
    @properties['report_id']
end

#request_meta ⇒ ReportMetadata

Returns:

  • (ReportMetadata)


742
743
744
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 742

def request_meta
    @properties['request_meta']
end

#status ⇒ ReportStatus

Returns:

  • (ReportStatus)


736
737
738
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 736

def status
    @properties['status']
end

#to_s ⇒ Object

Provide a user friendly representation



768
769
770
771
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 768

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

#url ⇒ String

Returns The URL of this resource.

Returns:

  • (String) —

    The URL of this resource.



748
749
750
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 748

def url
    @properties['url']
end