lib/twilio-ruby/rest/notify/v1/service.rb in twilio-ruby-5.38.0 vs lib/twilio-ruby/rest/notify/v1/service.rb in twilio-ruby-5.39.0
- old
+ new
@@ -24,12 +24,11 @@
@solution = {}
@uri = "/Services"
end
##
- # Retrieve a single page of ServiceInstance records from the API.
- # Request is executed immediately.
+ # Create the ServiceInstance
# @param [String] friendly_name A descriptive string that you create to describe
# the resource. It can be up to 64 characters long.
# @param [String] apn_credential_sid The SID of the
# [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use
# for APN Bindings.
@@ -61,11 +60,11 @@
# @param [String] alexa_skill_id Deprecated.
# @param [String] default_alexa_notification_protocol_version Deprecated.
# @param [String] delivery_callback_url URL to send delivery status callback.
# @param [Boolean] delivery_callback_enabled Callback configuration that enables
# delivery callbacks, default false
- # @return [ServiceInstance] Newly created ServiceInstance
+ # @return [ServiceInstance] Created ServiceInstance
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, alexa_skill_id: :unset, default_alexa_notification_protocol_version: :unset, delivery_callback_url: :unset, delivery_callback_enabled: :unset)
data = Twilio::Values.of({
'FriendlyName' => friendly_name,
'ApnCredentialSid' => apn_credential_sid,
'GcmCredentialSid' => gcm_credential_sid,
@@ -80,15 +79,11 @@
'DefaultAlexaNotificationProtocolVersion' => default_alexa_notification_protocol_version,
'DeliveryCallbackUrl' => delivery_callback_url,
'DeliveryCallbackEnabled' => delivery_callback_enabled,
})
- payload = @version.create(
- 'POST',
- @uri,
- data: data
- )
+ payload = @version.create('POST', @uri, data: data)
ServiceInstance.new(@version, payload, )
end
##
@@ -157,15 +152,13 @@
'FriendlyName' => friendly_name,
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
})
- response = @version.page(
- 'GET',
- @uri,
- params
- )
+
+ response = @version.page('GET', @uri, params)
+
ServicePage.new(@version, response, @solution)
end
##
# Retrieve a single page of ServiceInstance records from the API.
@@ -238,28 +231,22 @@
@bindings = nil
@notifications = nil
end
##
- # Deletes the ServiceInstance
+ # Delete the ServiceInstance
# @return [Boolean] true if delete succeeds, false otherwise
def delete
- @version.delete('delete', @uri)
+ @version.delete('DELETE', @uri)
end
##
- # Fetch a ServiceInstance
+ # Fetch the ServiceInstance
# @return [ServiceInstance] Fetched ServiceInstance
def fetch
- params = Twilio::Values.of({})
+ payload = @version.fetch('GET', @uri)
- payload = @version.fetch(
- 'GET',
- @uri,
- params,
- )
-
ServiceInstance.new(@version, payload, sid: @solution[:sid], )
end
##
# Update the ServiceInstance
@@ -315,15 +302,11 @@
'DefaultAlexaNotificationProtocolVersion' => default_alexa_notification_protocol_version,
'DeliveryCallbackUrl' => delivery_callback_url,
'DeliveryCallbackEnabled' => delivery_callback_enabled,
})
- payload = @version.update(
- 'POST',
- @uri,
- data: data,
- )
+ payload = @version.update('POST', @uri, data: data)
ServiceInstance.new(@version, payload, sid: @solution[:sid], )
end
##
@@ -543,17 +526,17 @@
def delivery_callback_enabled
@properties['delivery_callback_enabled']
end
##
- # Deletes the ServiceInstance
+ # Delete the ServiceInstance
# @return [Boolean] true if delete succeeds, false otherwise
def delete
context.delete
end
##
- # Fetch a ServiceInstance
+ # Fetch the ServiceInstance
# @return [ServiceInstance] Fetched ServiceInstance
def fetch
context.fetch
end
\ No newline at end of file