lib/twilio-ruby/rest/preview/proxy/service/short_code.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/preview/proxy/service/short_code.rb in twilio-ruby-5.0.0.rc22
- old
+ new
@@ -29,21 +29,21 @@
# Retrieve a single page of ShortCodeInstance records from the API.
# Request is executed immediately.
# @param [String] sid The shortcode Sid that uniquely identifies this resource
# @return [ShortCodeInstance] Newly created ShortCodeInstance
def create(sid: nil)
- data = {
+ data = Twilio::Values.of({
'Sid' => sid,
- }
+ })
payload = @version.create(
'POST',
@uri,
data: data
)
- return ShortCodeInstance.new(
+ ShortCodeInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
)
end
@@ -114,25 +114,38 @@
# 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 ShortCodeInstance
- def page(page_token: nil, page_number: nil, page_size: nil)
- params = {
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
+ params = Twilio::Values.of({
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
- }
+ })
response = @version.page(
'GET',
@uri,
params
)
- return ShortCodePage.new(@version, response, @solution)
+ ShortCodePage.new(@version, response, @solution)
end
##
+ # Retrieve a single page of ShortCodeInstance records from the API.
+ # Request is executed immediately.
+ # @param [String] target_url API-generated URL for the requested results page
+ # @return [Page] Page of ShortCodeInstance
+ def get_page(target_url)
+ response = @version.domain.request(
+ 'GET',
+ target_url
+ )
+ ShortCodePage.new(@version, response, @solution)
+ end
+
+ ##
# Provide a user friendly representation
def to_s
'#<Twilio.Preview.Proxy.ShortCodeList>'
end
end
@@ -155,11 +168,11 @@
##
# Build an instance of ShortCodeInstance
# @param [Hash] payload Payload response from the API
# @return [ShortCodeInstance] ShortCodeInstance
def get_instance(payload)
- return ShortCodeInstance.new(
+ ShortCodeInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
)
end
@@ -191,25 +204,25 @@
##
# Deletes the ShortCodeInstance
# @return [Boolean] true if delete succeeds, true otherwise
def delete
- return @version.delete('delete', @uri)
+ @version.delete('delete', @uri)
end
##
# Fetch a ShortCodeInstance
# @return [ShortCodeInstance] Fetched ShortCodeInstance
def fetch
- params = {}
+ params = Twilio::Values.of({})
payload = @version.fetch(
'GET',
@uri,
params,
)
- return ShortCodeInstance.new(
+ ShortCodeInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
sid: @solution[:sid],
)
\ No newline at end of file