lib/twilio-ruby/rest/notify/v1/service.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/notify/v1/service.rb in twilio-ruby-5.0.0.rc22
- old
+ new
@@ -36,31 +36,31 @@
# @param [String] fcm_credential_sid The fcm_credential_sid
# @param [String] default_fcm_notification_protocol_version The
# default_fcm_notification_protocol_version
# @param [Boolean] log_enabled The log_enabled
# @return [ServiceInstance] Newly created ServiceInstance
- def create(friendly_name: nil, apn_credential_sid: nil, gcm_credential_sid: nil, messaging_service_sid: nil, facebook_messenger_page_id: nil, default_apn_notification_protocol_version: nil, default_gcm_notification_protocol_version: nil, fcm_credential_sid: nil, default_fcm_notification_protocol_version: nil, log_enabled: nil)
- data = {
+ def create(friendly_name: :unset, apn_credential_sid: :unset, gcm_credential_sid: :unset, messaging_service_sid: :unset, facebook_messenger_page_id: :unset, default_apn_notification_protocol_version: :unset, default_gcm_notification_protocol_version: :unset, fcm_credential_sid: :unset, default_fcm_notification_protocol_version: :unset, log_enabled: :unset)
+ data = Twilio::Values.of({
'FriendlyName' => friendly_name,
'ApnCredentialSid' => apn_credential_sid,
'GcmCredentialSid' => gcm_credential_sid,
'MessagingServiceSid' => messaging_service_sid,
'FacebookMessengerPageId' => facebook_messenger_page_id,
'DefaultApnNotificationProtocolVersion' => default_apn_notification_protocol_version,
'DefaultGcmNotificationProtocolVersion' => default_gcm_notification_protocol_version,
'FcmCredentialSid' => fcm_credential_sid,
'DefaultFcmNotificationProtocolVersion' => default_fcm_notification_protocol_version,
'LogEnabled' => log_enabled,
- }
+ })
payload = @version.create(
'POST',
@uri,
data: data
)
- return ServiceInstance.new(
+ ServiceInstance.new(
@version,
payload,
)
end
@@ -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(friendly_name: nil, limit: nil, page_size: nil)
+ def list(friendly_name: :unset, limit: nil, page_size: nil)
self.stream(
friendly_name: friendly_name,
limit: limit,
page_size: page_size
).entries
@@ -94,11 +94,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(friendly_name: nil, limit: nil, page_size: nil)
+ def stream(friendly_name: :unset, limit: nil, page_size: nil)
limits = @version.read_limits(limit, page_size)
page = self.page(
friendly_name: friendly_name,
page_size: limits[:page_size],
@@ -136,26 +136,39 @@
# @param [String] friendly_name The friendly_name
# @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 ServiceInstance
- def page(friendly_name: nil, page_token: nil, page_number: nil, page_size: nil)
- params = {
+ def page(friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
+ params = Twilio::Values.of({
'FriendlyName' => friendly_name,
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
- }
+ })
response = @version.page(
'GET',
@uri,
params
)
- return ServicePage.new(@version, response, @solution)
+ ServicePage.new(@version, response, @solution)
end
##
+ # Retrieve a single page of ServiceInstance records from the API.
+ # Request is executed immediately.
+ # @param [String] target_url API-generated URL for the requested results page
+ # @return [Page] Page of ServiceInstance
+ def get_page(target_url)
+ response = @version.domain.request(
+ 'GET',
+ target_url
+ )
+ ServicePage.new(@version, response, @solution)
+ end
+
+ ##
# Provide a user friendly representation
def to_s
'#<Twilio.Notify.V1.ServiceList>'
end
end
@@ -177,11 +190,11 @@
##
# Build an instance of ServiceInstance
# @param [Hash] payload Payload response from the API
# @return [ServiceInstance] ServiceInstance
def get_instance(payload)
- return ServiceInstance.new(
+ ServiceInstance.new(
@version,
payload,
)
end
@@ -216,26 +229,26 @@
##
# Deletes the ServiceInstance
# @return [Boolean] true if delete succeeds, true otherwise
def delete
- return @version.delete('delete', @uri)
+ @version.delete('delete', @uri)
end
##
# Fetch a ServiceInstance
# @return [ServiceInstance] Fetched ServiceInstance
def fetch
- params = {}
+ params = Twilio::Values.of({})
payload = @version.fetch(
'GET',
@uri,
params,
)
- return ServiceInstance.new(
+ ServiceInstance.new(
@version,
payload,
sid: @solution[:sid],
)
end
@@ -254,31 +267,31 @@
# @param [String] fcm_credential_sid The fcm_credential_sid
# @param [String] default_fcm_notification_protocol_version The
# default_fcm_notification_protocol_version
# @param [Boolean] log_enabled The log_enabled
# @return [ServiceInstance] Updated ServiceInstance
- def update(friendly_name: nil, apn_credential_sid: nil, gcm_credential_sid: nil, messaging_service_sid: nil, facebook_messenger_page_id: nil, default_apn_notification_protocol_version: nil, default_gcm_notification_protocol_version: nil, fcm_credential_sid: nil, default_fcm_notification_protocol_version: nil, log_enabled: nil)
- data = {
+ def update(friendly_name: :unset, apn_credential_sid: :unset, gcm_credential_sid: :unset, messaging_service_sid: :unset, facebook_messenger_page_id: :unset, default_apn_notification_protocol_version: :unset, default_gcm_notification_protocol_version: :unset, fcm_credential_sid: :unset, default_fcm_notification_protocol_version: :unset, log_enabled: :unset)
+ data = Twilio::Values.of({
'FriendlyName' => friendly_name,
'ApnCredentialSid' => apn_credential_sid,
'GcmCredentialSid' => gcm_credential_sid,
'MessagingServiceSid' => messaging_service_sid,
'FacebookMessengerPageId' => facebook_messenger_page_id,
'DefaultApnNotificationProtocolVersion' => default_apn_notification_protocol_version,
'DefaultGcmNotificationProtocolVersion' => default_gcm_notification_protocol_version,
'FcmCredentialSid' => fcm_credential_sid,
'DefaultFcmNotificationProtocolVersion' => default_fcm_notification_protocol_version,
'LogEnabled' => log_enabled,
- }
+ })
payload = @version.update(
'POST',
@uri,
data: data,
)
- return ServiceInstance.new(
+ ServiceInstance.new(
@version,
payload,
sid: @solution[:sid],
)
end
@@ -507,10 +520,10 @@
# @param [String] fcm_credential_sid The fcm_credential_sid
# @param [String] default_fcm_notification_protocol_version The
# default_fcm_notification_protocol_version
# @param [Boolean] log_enabled The log_enabled
# @return [ServiceInstance] Updated ServiceInstance
- def update(friendly_name: nil, apn_credential_sid: nil, gcm_credential_sid: nil, messaging_service_sid: nil, facebook_messenger_page_id: nil, default_apn_notification_protocol_version: nil, default_gcm_notification_protocol_version: nil, fcm_credential_sid: nil, default_fcm_notification_protocol_version: nil, log_enabled: nil)
+ def update(friendly_name: :unset, apn_credential_sid: :unset, gcm_credential_sid: :unset, messaging_service_sid: :unset, facebook_messenger_page_id: :unset, default_apn_notification_protocol_version: :unset, default_gcm_notification_protocol_version: :unset, fcm_credential_sid: :unset, default_fcm_notification_protocol_version: :unset, log_enabled: :unset)
context.update(
friendly_name: friendly_name,
apn_credential_sid: apn_credential_sid,
gcm_credential_sid: gcm_credential_sid,
messaging_service_sid: messaging_service_sid,
\ No newline at end of file