lib/twilio-ruby/rest/notify/v1/service/user/user_binding.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/notify/v1/service/user/user_binding.rb in twilio-ruby-5.0.0.rc22
- old
+ new
@@ -36,27 +36,27 @@
# @param [String] tag The tag
# @param [String] notification_protocol_version The notification_protocol_version
# @param [String] credential_sid The credential_sid
# @param [String] endpoint The endpoint
# @return [UserBindingInstance] Newly created UserBindingInstance
- def create(binding_type: nil, address: nil, tag: nil, notification_protocol_version: nil, credential_sid: nil, endpoint: nil)
- data = {
+ def create(binding_type: nil, address: nil, tag: :unset, notification_protocol_version: :unset, credential_sid: :unset, endpoint: :unset)
+ data = Twilio::Values.of({
'BindingType' => binding_type,
'Address' => address,
'Tag' => tag,
'NotificationProtocolVersion' => notification_protocol_version,
'CredentialSid' => credential_sid,
'Endpoint' => endpoint,
- }
+ })
payload = @version.create(
'POST',
@uri,
data: data
)
- return UserBindingInstance.new(
+ UserBindingInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
identity: @solution[:identity],
)
@@ -74,11 +74,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(start_date: nil, end_date: nil, tag: nil, limit: nil, page_size: nil)
+ def list(start_date: :unset, end_date: :unset, tag: :unset, limit: nil, page_size: nil)
self.stream(
start_date: start_date,
end_date: end_date,
tag: tag,
limit: limit,
@@ -98,11 +98,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(start_date: nil, end_date: nil, tag: nil, limit: nil, page_size: nil)
+ def stream(start_date: :unset, end_date: :unset, tag: :unset, limit: nil, page_size: nil)
limits = @version.read_limits(limit, page_size)
page = self.page(
start_date: start_date,
end_date: end_date,
@@ -146,28 +146,41 @@
# @param [String] tag The tag
# @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 UserBindingInstance
- def page(start_date: nil, end_date: nil, tag: nil, page_token: nil, page_number: nil, page_size: nil)
- params = {
+ def page(start_date: :unset, end_date: :unset, tag: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
+ params = Twilio::Values.of({
'StartDate' => Twilio.serialize_iso8601(start_date),
'EndDate' => Twilio.serialize_iso8601(end_date),
'Tag' => tag,
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
- }
+ })
response = @version.page(
'GET',
@uri,
params
)
- return UserBindingPage.new(@version, response, @solution)
+ UserBindingPage.new(@version, response, @solution)
end
##
+ # Retrieve a single page of UserBindingInstance records from the API.
+ # Request is executed immediately.
+ # @param [String] target_url API-generated URL for the requested results page
+ # @return [Page] Page of UserBindingInstance
+ def get_page(target_url)
+ response = @version.domain.request(
+ 'GET',
+ target_url
+ )
+ UserBindingPage.new(@version, response, @solution)
+ end
+
+ ##
# Provide a user friendly representation
def to_s
'#<Twilio.Notify.V1.UserBindingList>'
end
end
@@ -191,11 +204,11 @@
##
# Build an instance of UserBindingInstance
# @param [Hash] payload Payload response from the API
# @return [UserBindingInstance] UserBindingInstance
def get_instance(payload)
- return UserBindingInstance.new(
+ UserBindingInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
identity: @solution[:identity],
)
@@ -230,19 +243,19 @@
##
# Fetch a UserBindingInstance
# @return [UserBindingInstance] Fetched UserBindingInstance
def fetch
- params = {}
+ params = Twilio::Values.of({})
payload = @version.fetch(
'GET',
@uri,
params,
)
- return UserBindingInstance.new(
+ UserBindingInstance.new(
@version,
payload,
service_sid: @solution[:service_sid],
identity: @solution[:identity],
sid: @solution[:sid],
@@ -251,10 +264,10 @@
##
# Deletes the UserBindingInstance
# @return [Boolean] true if delete succeeds, true otherwise
def delete
- return @version.delete('delete', @uri)
+ @version.delete('delete', @uri)
end
##
# Provide a user friendly representation
def to_s
\ No newline at end of file