Class: Twilio::REST::Bulkexports::V1::ExportContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/bulkexports/v1/export.rb,
lib/twilio-ruby/rest/bulkexports/v1/export/day.rb,
lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Defined Under Namespace

Classes: DayContext, DayInstance, DayList, DayPage, ExportCustomJobInstance, ExportCustomJobList, ExportCustomJobPage

Instance Method Summary collapse

Constructor Details

#initialize(version, resource_type) ⇒ ExportContext

Initialize the ExportContext

Parameters:

  • version (Version)

    Version that contains the resource

  • resource_type (String)

    The type of communication – Messages, Calls



91
92
93
94
95
96
97
98
99
100
101
# File 'lib/twilio-ruby/rest/bulkexports/v1/export.rb', line 91

def initialize(version, resource_type)
  super(version)

  # Path Solution
  @solution = {resource_type: resource_type, }
  @uri = "/Exports/#{@solution[:resource_type]}"

  # Dependents
  @days = nil
  @export_custom_jobs = nil
end

Instance Method Details

#days(day = :unset) ⇒ DayList, DayContext

Access the days

Returns:

Raises:

  • (ArgumentError)


122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/twilio-ruby/rest/bulkexports/v1/export.rb', line 122

def days(day=:unset)
  raise ArgumentError, 'day cannot be nil' if day.nil?

  if day != :unset
    return DayContext.new(@version, @solution[:resource_type], day, )
  end

  unless @days
    @days = DayList.new(@version, resource_type: @solution[:resource_type], )
  end

  @days
end

#export_custom_jobsExportCustomJobList, ExportCustomJobContext

Access the export_custom_jobs

Returns:



140
141
142
143
144
145
146
# File 'lib/twilio-ruby/rest/bulkexports/v1/export.rb', line 140

def export_custom_jobs
  unless @export_custom_jobs
    @export_custom_jobs = ExportCustomJobList.new(@version, resource_type: @solution[:resource_type], )
  end

  @export_custom_jobs
end

#fetchExportInstance

Fetch a ExportInstance

Returns:



106
107
108
109
110
111
112
113
114
115
116
# File 'lib/twilio-ruby/rest/bulkexports/v1/export.rb', line 106

def fetch
  params = Twilio::Values.of({})

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

  ExportInstance.new(@version, payload, resource_type: @solution[:resource_type], )
end

#inspectObject

Provide a detailed, user friendly representation



157
158
159
160
# File 'lib/twilio-ruby/rest/bulkexports/v1/export.rb', line 157

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

#to_sObject

Provide a user friendly representation



150
151
152
153
# File 'lib/twilio-ruby/rest/bulkexports/v1/export.rb', line 150

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