Class: Twilio::REST::Insights::V2::ReportContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, report_id) ⇒ ReportContext

Initialize the ReportContext

Parameters:

  • version (Version)

    Version that contains the resource

  • report_id (String)

    A unique request id.



489
490
491
492
493
494
495
496
497
498
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 489

def initialize(version, report_id)
    super(version)
    

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

    
end

Instance Method Details

#create(insights_v2_create_account_report_request: :unset) ⇒ ReportInstance

Create the ReportInstance

Parameters:

  • insights_v2_create_account_report_request (InsightsV2CreateAccountReportRequest) (defaults to: :unset)

Returns:



503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 503

def create(insights_v2_create_account_report_request: :unset
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
    
    payload = @version.create('POST', @uri, headers: headers, data: .to_json)
    ReportInstance.new(
        @version,
        payload,
        report_id: @solution[:report_id],
    )
end

#create_with_metadata(insights_v2_create_account_report_request: :unset) ⇒ ReportInstance

Create the ReportInstanceMetadata

Parameters:

  • insights_v2_create_account_report_request (InsightsV2CreateAccountReportRequest) (defaults to: :unset)

Returns:



524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 524

def (insights_v2_create_account_report_request: :unset
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
    
    response = @version.('POST', @uri, headers: headers, data: .to_json)
    report_instance = ReportInstance.new(
        @version,
        response.body,
        report_id: @solution[:report_id],
    )
    .new(
        @version,
        report_instance,
        response.headers,
        response.status_code
    )
end

#fetchReportInstance

Fetch the ReportInstance

Returns:



550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 550

def fetch

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

#fetch_with_metadataReportInstance

Fetch the ReportInstanceMetadata

Returns:



569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 569

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    report_instance = ReportInstance.new(
        @version,
        response.body,
        report_id: @solution[:report_id],
    )
    .new(
        @version,
        report_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



601
602
603
604
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 601

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

#to_sObject

Provide a user friendly representation



594
595
596
597
# File 'lib/twilio-ruby/rest/insights/v2/report.rb', line 594

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