class Twilio::REST::Bulkexports::V1::ExportContext::ExportCustomJobList
Public Class Methods
Initialize the ExportCustomJobList
@param [Version] version Version
that contains the resource @param [String] resource_type The type of communication – Messages, Calls,
Conferences, and Participants
@return [ExportCustomJobList] ExportCustomJobList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb 21 def initialize(version, resource_type: nil) 22 super(version) 23 24 # Path Solution 25 @solution = {resource_type: resource_type} 26 @uri = "/Exports/#{@solution[:resource_type]}/Jobs" 27 end
Public Instance Methods
Create the ExportCustomJobInstance
@param [String] start_day The start day for the custom export specified as a
string in the format of yyyy-mm-dd
@param [String] end_day The end day for the custom export specified as a string
in the format of yyyy-mm-dd. End day is inclusive and must be 2 days earlier than the current UTC day.
@param [String] friendly_name The friendly name specified when creating the job @param [String] webhook_url The optional webhook url called on completion of the
job. If this is supplied, `WebhookMethod` must also be supplied. If you set neither webhook nor email, you will have to check your job's status manually.
@param [String] webhook_method This is the method used to call the webhook on
completion of the job. If this is supplied, `WebhookUrl` must also be supplied.
@param [String] email The optional email to send the completion notification to.
You can set both webhook, and email, or one or the other. If you set neither, the job will run but you will have to query to determine your job's status.
@return [ExportCustomJobInstance] Created ExportCustomJobInstance
# File lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb 126 def create(start_day: nil, end_day: nil, friendly_name: nil, webhook_url: :unset, webhook_method: :unset, email: :unset) 127 data = Twilio::Values.of({ 128 'StartDay' => start_day, 129 'EndDay' => end_day, 130 'FriendlyName' => friendly_name, 131 'WebhookUrl' => webhook_url, 132 'WebhookMethod' => webhook_method, 133 'Email' => email, 134 }) 135 136 payload = @version.create('POST', @uri, data: data) 137 138 ExportCustomJobInstance.new(@version, payload, resource_type: @solution[:resource_type], ) 139 end
When passed a block, yields ExportCustomJobInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb 67 def each 68 limits = @version.read_limits 69 70 page = self.page(page_size: limits[:page_size], ) 71 72 @version.stream(page, 73 limit: limits[:limit], 74 page_limit: limits[:page_limit]).each {|x| yield x} 75 end
Retrieve a single page of ExportCustomJobInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of ExportCustomJobInstance
# File lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb 101 def get_page(target_url) 102 response = @version.domain.request( 103 'GET', 104 target_url 105 ) 106 ExportCustomJobPage.new(@version, response, @solution) 107 end
Lists ExportCustomJobInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Array] Array of up to limit results
# File lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb 40 def list(limit: nil, page_size: nil) 41 self.stream(limit: limit, page_size: page_size).entries 42 end
Retrieve a single page of ExportCustomJobInstance
records from the API. Request
is executed immediately. @param [String] page_token PageToken provided by the API @param [Integer] page_number Page
Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page
of ExportCustomJobInstance
# File lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb 84 def page(page_token: :unset, page_number: :unset, page_size: :unset) 85 params = Twilio::Values.of({ 86 'PageToken' => page_token, 87 'Page' => page_number, 88 'PageSize' => page_size, 89 }) 90 91 response = @version.page('GET', @uri, params: params) 92 93 ExportCustomJobPage.new(@version, response, @solution) 94 end
Streams ExportCustomJobInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit.
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Enumerable] Enumerable that will yield up to limit results
# File lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb 55 def stream(limit: nil, page_size: nil) 56 limits = @version.read_limits(limit, page_size) 57 58 page = self.page(page_size: limits[:page_size], ) 59 60 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 61 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb 143 def to_s 144 '#<Twilio.Bulkexports.V1.ExportCustomJobList>' 145 end