lib/twilio-ruby/rest/fax/v1/fax.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/fax/v1/fax.rb in twilio-ruby-5.0.0.rc22
- old
+ new
@@ -34,11 +34,11 @@
# @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
- def list(from: nil, to: nil, date_created_on_or_before: nil, date_created_after: nil, limit: nil, page_size: nil)
+ def list(from: :unset, to: :unset, date_created_on_or_before: :unset, date_created_after: :unset, limit: nil, page_size: nil)
self.stream(
from: from,
to: to,
date_created_on_or_before: date_created_on_or_before,
date_created_after: date_created_after,
@@ -60,11 +60,11 @@
# @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
- def stream(from: nil, to: nil, date_created_on_or_before: nil, date_created_after: nil, limit: nil, page_size: nil)
+ def stream(from: :unset, to: :unset, date_created_on_or_before: :unset, date_created_after: :unset, limit: nil, page_size: nil)
limits = @version.read_limits(limit, page_size)
page = self.page(
from: from,
to: to,
@@ -111,57 +111,70 @@
# @param [Time] date_created_after The date_created_after
# @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 FaxInstance
- def page(from: nil, to: nil, date_created_on_or_before: nil, date_created_after: nil, page_token: nil, page_number: nil, page_size: nil)
- params = {
+ def page(from: :unset, to: :unset, date_created_on_or_before: :unset, date_created_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
+ params = Twilio::Values.of({
'From' => from,
'To' => to,
'DateCreatedOnOrBefore' => Twilio.serialize_iso8601(date_created_on_or_before),
'DateCreatedAfter' => Twilio.serialize_iso8601(date_created_after),
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
- }
+ })
response = @version.page(
'GET',
@uri,
params
)
- return FaxPage.new(@version, response, @solution)
+ FaxPage.new(@version, response, @solution)
end
##
# Retrieve a single page of FaxInstance records from the API.
# Request is executed immediately.
+ # @param [String] target_url API-generated URL for the requested results page
+ # @return [Page] Page of FaxInstance
+ def get_page(target_url)
+ response = @version.domain.request(
+ 'GET',
+ target_url
+ )
+ FaxPage.new(@version, response, @solution)
+ end
+
+ ##
+ # Retrieve a single page of FaxInstance records from the API.
+ # Request is executed immediately.
# @param [String] to The to
# @param [String] media_url The media_url
# @param [fax.Quality] quality The quality
# @param [String] status_callback The status_callback
# @param [String] from The from
# @param [String] sip_auth_username The sip_auth_username
# @param [String] sip_auth_password The sip_auth_password
# @return [FaxInstance] Newly created FaxInstance
- def create(to: nil, media_url: nil, quality: nil, status_callback: nil, from: nil, sip_auth_username: nil, sip_auth_password: nil)
- data = {
+ def create(to: nil, media_url: nil, quality: :unset, status_callback: :unset, from: :unset, sip_auth_username: :unset, sip_auth_password: :unset)
+ data = Twilio::Values.of({
'To' => to,
'MediaUrl' => media_url,
'Quality' => quality,
'StatusCallback' => status_callback,
'From' => from,
'SipAuthUsername' => sip_auth_username,
'SipAuthPassword' => sip_auth_password,
- }
+ })
payload = @version.create(
'POST',
@uri,
data: data
)
- return FaxInstance.new(
+ FaxInstance.new(
@version,
payload,
)
end
@@ -189,11 +202,11 @@
##
# Build an instance of FaxInstance
# @param [Hash] payload Payload response from the API
# @return [FaxInstance] FaxInstance
def get_instance(payload)
- return FaxInstance.new(
+ FaxInstance.new(
@version,
payload,
)
end
@@ -225,52 +238,52 @@
##
# Fetch a FaxInstance
# @return [FaxInstance] Fetched FaxInstance
def fetch
- params = {}
+ params = Twilio::Values.of({})
payload = @version.fetch(
'GET',
@uri,
params,
)
- return FaxInstance.new(
+ FaxInstance.new(
@version,
payload,
sid: @solution[:sid],
)
end
##
# Update the FaxInstance
# @param [fax.UpdateStatus] status The status
# @return [FaxInstance] Updated FaxInstance
- def update(status: nil)
- data = {
+ def update(status: :unset)
+ data = Twilio::Values.of({
'Status' => status,
- }
+ })
payload = @version.update(
'POST',
@uri,
data: data,
)
- return FaxInstance.new(
+ FaxInstance.new(
@version,
payload,
sid: @solution[:sid],
)
end
##
# Deletes the FaxInstance
# @return [Boolean] true if delete succeeds, true otherwise
def delete
- return @version.delete('delete', @uri)
+ @version.delete('delete', @uri)
end
##
# Access the media
# @return [FaxMediaList] FaxMediaList
@@ -436,10 +449,10 @@
##
# Update the FaxInstance
# @param [fax.UpdateStatus] status The status
# @return [FaxInstance] Updated FaxInstance
- def update(status: nil)
+ def update(status: :unset)
context.update(
status: status,
)
end
\ No newline at end of file