Class: Twilio::REST::Insights::V2::InboundInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the InboundInstance

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

  • sid (String)

    The SID of the Call resource to fetch.



455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'lib/twilio-ruby/rest/insights/v2/inbound.rb', line 455

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'],
    }

    # 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.



491
492
493
# File 'lib/twilio-ruby/rest/insights/v2/inbound.rb', line 491

def 
    @properties['account_sid']
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.



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

def call_answer_score
    @properties['call_answer_score']
end

#call_state_percentageInsightsV2InboundPhoneNumberReportCallStatePercentage

Returns:

  • (InsightsV2InboundPhoneNumberReportCallStatePercentage)


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

def call_state_percentage
    @properties['call_state_percentage']
end

#contextInboundContext

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

Returns:



482
483
484
485
486
487
# File 'lib/twilio-ruby/rest/insights/v2/inbound.rb', line 482

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

#create(insights_v2_create_phone_numbers_report_request: :unset) ⇒ InboundInstance

Create the InboundInstance

Parameters:

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

Returns:



553
554
555
556
557
558
559
# File 'lib/twilio-ruby/rest/insights/v2/inbound.rb', line 553

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.



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

def handle
    @properties['handle']
end

#inspectObject

Provide a detailed, user friendly representation



570
571
572
573
# File 'lib/twilio-ruby/rest/insights/v2/inbound.rb', line 570

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

#report_idString

Returns The report identifier as Voice Insights Report TTID.

Returns:

  • (String)

    The report identifier as Voice Insights Report TTID.



497
498
499
# File 'lib/twilio-ruby/rest/insights/v2/inbound.rb', line 497

def report_id
    @properties['report_id']
end

#request_metaReportMetadata

Returns:

  • (ReportMetadata)


509
510
511
# File 'lib/twilio-ruby/rest/insights/v2/inbound.rb', line 509

def request_meta
    @properties['request_meta']
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.



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

def silent_calls_percentage
    @properties['silent_calls_percentage']
end

#statusReportStatus

Returns:

  • (ReportStatus)


503
504
505
# File 'lib/twilio-ruby/rest/insights/v2/inbound.rb', line 503

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



563
564
565
566
# File 'lib/twilio-ruby/rest/insights/v2/inbound.rb', line 563

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Insights.V2.InboundInstance #{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.



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

def total_calls
    @properties['total_calls']
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



515
516
517
# File 'lib/twilio-ruby/rest/insights/v2/inbound.rb', line 515

def url
    @properties['url']
end