Class: Twilio::REST::Insights::V2::OutboundInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the OutboundInstance

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

  • sid (String)

    The SID of the Call resource to fetch.



477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 477

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'],
        'handle' => payload['handle'],
        'total_calls' => payload['total_calls'] == nil ? payload['total_calls'] : payload['total_calls'].to_i,
        'call_answer_score' => payload['call_answer_score'],
        'call_state_percentage' => payload['call_state_percentage'],
        'silent_calls_percentage' => payload['silent_calls_percentage'],
        'calls_by_device_type' => payload['calls_by_device_type'],
        'answer_rate_device_type' => payload['answer_rate_device_type'],
        'blocked_calls_by_carrier' => payload['blocked_calls_by_carrier'],
        'short_duration_calls_percentage' => payload['short_duration_calls_percentage'],
        'long_duration_calls_percentage' => payload['long_duration_calls_percentage'],
        'potential_robocalls_percentage' => payload['potential_robocalls_percentage'],
        'answering_machine_detection' => payload['answering_machine_detection'],
    }

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

Instance Method Details

#account_sidString

Returns The unique SID identifier of the Account.

Returns:

  • (String)

    The unique SID identifier of the Account.



520
521
522
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 520

def 
    @properties['account_sid']
end

#answer_rate_device_typeHash<String, Float>

Returns Answer rate for each device type. ‘voip`, `mobile`, `landline`, `unknown`.

Returns:

  • (Hash<String, Float>)

    Answer rate for each device type. ‘voip`, `mobile`, `landline`, `unknown`



586
587
588
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 586

def answer_rate_device_type
    @properties['answer_rate_device_type']
end

#answering_machine_detectionInsightsV2OutboundPhoneNumberReportAnsweringMachineDetection

Returns:

  • (InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection)


616
617
618
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 616

def answering_machine_detection
    @properties['answering_machine_detection']
end

#blocked_calls_by_carrierArray<CountyCarrierValue>

Returns Percentage of blocked calls by carrier per country.

Returns:

  • (Array<CountyCarrierValue>)

    Percentage of blocked calls by carrier per country.



592
593
594
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 592

def blocked_calls_by_carrier
    @properties['blocked_calls_by_carrier']
end

#call_answer_scoreFloat

Returns The call answer score measures customers behavior to the delivered calls. The score is a value between 0 and 100, where 100 indicates that all calls were successfully answered.

Returns:

  • (Float)

    The call answer score measures customers behavior to the delivered calls. The score is a value between 0 and 100, where 100 indicates that all calls were successfully answered.



562
563
564
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 562

def call_answer_score
    @properties['call_answer_score']
end

#call_state_percentageInsightsV2InboundPhoneNumberReportCallStatePercentage

Returns:

  • (InsightsV2InboundPhoneNumberReportCallStatePercentage)


568
569
570
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 568

def call_state_percentage
    @properties['call_state_percentage']
end

#calls_by_device_typeHash<String, Integer>

Returns Number of calls made with each device type. ‘voip`, `mobile`, `landline`, `unknown`.

Returns:

  • (Hash<String, Integer>)

    Number of calls made with each device type. ‘voip`, `mobile`, `landline`, `unknown`



580
581
582
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 580

def calls_by_device_type
    @properties['calls_by_device_type']
end

#contextOutboundContext

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

Returns:



511
512
513
514
515
516
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 511

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

#create(insights_v2_create_phone_numbers_report_request: :unset) ⇒ OutboundInstance

Create the OutboundInstance

Parameters:

  • insights_v2_create_phone_numbers_report_request (InsightsV2CreatePhoneNumbersReportRequest) (defaults to: :unset)

Returns:



624
625
626
627
628
629
630
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 624

def create(insights_v2_create_phone_numbers_report_request: :unset
)

    context.create(
        insights_v2_create_phone_numbers_report_request: insights_v2_create_phone_numbers_report_request, 
    )
end

#handleString

Returns Inbound phone number handle represented in the report.

Returns:

  • (String)

    Inbound phone number handle represented in the report.



550
551
552
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 550

def handle
    @properties['handle']
end

#inspectObject

Provide a detailed, user friendly representation



641
642
643
644
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 641

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

#long_duration_calls_percentageFloat

Returns Percentage of long duration calls ( >= 60 seconds).

Returns:

  • (Float)

    Percentage of long duration calls ( >= 60 seconds)



604
605
606
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 604

def long_duration_calls_percentage
    @properties['long_duration_calls_percentage']
end

#potential_robocalls_percentageFloat

Returns Percentage of completed outbound calls to unassigned or unallocated phone numbers.

Returns:

  • (Float)

    Percentage of completed outbound calls to unassigned or unallocated phone numbers.



610
611
612
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 610

def potential_robocalls_percentage
    @properties['potential_robocalls_percentage']
end

#report_idString

Returns The report identifier as Voice Insights Report TTID.

Returns:

  • (String)

    The report identifier as Voice Insights Report TTID.



526
527
528
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 526

def report_id
    @properties['report_id']
end

#request_metaReportMetadata

Returns:

  • (ReportMetadata)


538
539
540
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 538

def request_meta
    @properties['request_meta']
end

#short_duration_calls_percentageFloat

Returns Percentage of completed outbound calls under 10 seconds (PSTN Short call tags); More than 15% is typically low trust measured.

Returns:

  • (Float)

    Percentage of completed outbound calls under 10 seconds (PSTN Short call tags); More than 15% is typically low trust measured.



598
599
600
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 598

def short_duration_calls_percentage
    @properties['short_duration_calls_percentage']
end

#silent_calls_percentageFloat

Returns Percentage of inbound calls with silence tags over total outbound calls. A silent tag is indicative of a connectivity issue or muted audio.

Returns:

  • (Float)

    Percentage of inbound calls with silence tags over total outbound calls. A silent tag is indicative of a connectivity issue or muted audio.



574
575
576
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 574

def silent_calls_percentage
    @properties['silent_calls_percentage']
end

#statusReportStatus

Returns:

  • (ReportStatus)


532
533
534
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 532

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



634
635
636
637
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 634

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

#total_callsString

Returns Total number of calls made with the given handle during the report period.

Returns:

  • (String)

    Total number of calls made with the given handle during the report period.



556
557
558
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 556

def total_calls
    @properties['total_calls']
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



544
545
546
# File 'lib/twilio-ruby/rest/insights/v2/outbound.rb', line 544

def url
    @properties['url']
end