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/annotation.rb,
lib/twilio-ruby/rest/insights/v1/call/call_summary.rb

Defined Under Namespace

Classes: AnnotationContext, AnnotationInstance, AnnotationList, AnnotationPage, 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)


49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 49

def initialize(version, sid)
    super(version)

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

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

Instance Method Details

#annotationAnnotationList, AnnotationContext

Access the annotation



117
118
119
120
121
122
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 117

def annotation
    AnnotationContext.new(
            @version,
            @solution[:sid]
            )
end

#eventsEventList, EventContext

Access the events

Returns:



96
97
98
99
100
101
102
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 96

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

#fetchCallInstance

Fetch the CallInstance

Returns:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 65

def fetch

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

#inspectObject

Provide a detailed, user friendly representation



133
134
135
136
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 133

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

#metricsMetricList, MetricContext

Access the metrics

Returns:



85
86
87
88
89
90
91
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 85

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

#summaryCallSummaryList, CallSummaryContext

Access the summary



107
108
109
110
111
112
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 107

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

#to_sObject

Provide a user friendly representation



126
127
128
129
# File 'lib/twilio-ruby/rest/insights/v1/call.rb', line 126

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