Class: Twilio::REST::Insights::V1::CallContext

Inherits:
Twilio::REST::InstanceContext show all
Defined in:
lib/twilio-ruby/rest/insights/v1/call.rb,
lib/twilio-ruby/rest/insights/v1/call/event.rb,
lib/twilio-ruby/rest/insights/v1/call/metric.rb,
lib/twilio-ruby/rest/insights/v1/call/summary.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected]

Defined Under Namespace

Classes: CallSummaryContext, CallSummaryInstance, CallSummaryList, CallSummaryPage, EventInstance, EventList, EventPage, MetricInstance, MetricList, MetricPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ CallContext

Initialize the CallContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The sid


73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 73

def initialize(version, sid)
  super(version)

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

  # Dependents
  @events = nil
  @metrics = nil
  @summary = nil
end

Instance Method Details

#eventsEventList, EventContext

Access the events

Returns:


99
100
101
102
103
104
105
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 99

def events
  unless @events
    @events = EventList.new(@version, call_sid: @solution[:sid], )
  end

  @events
end

#fetchCallInstance

Fetch the CallInstance

Returns:


89
90
91
92
93
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 89

def fetch
  payload = @version.fetch('GET', @uri)

  CallInstance.new(@version, payload, sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation


136
137
138
139
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 136

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

#metricsMetricList, MetricContext

Access the metrics

Returns:


111
112
113
114
115
116
117
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 111

def metrics
  unless @metrics
    @metrics = MetricList.new(@version, call_sid: @solution[:sid], )
  end

  @metrics
end

#summaryCallSummaryList, CallSummaryContext

Access the summary


123
124
125
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 123

def summary
  CallSummaryContext.new(@version, @solution[:sid], )
end

#to_sObject

Provide a user friendly representation


129
130
131
132
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 129

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