lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb in twilio-ruby-5.38.0 vs lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb in twilio-ruby-5.39.0
- old
+ new
@@ -26,12 +26,11 @@
@solution = {service_sid: service_sid}
@uri = "/Services/#{@solution[:service_sid]}/Users"
end
##
- # Retrieve a single page of UserInstance records from the API.
- # Request is executed immediately.
+ # Create the UserInstance
# @param [String] identity The `identity` value that uniquely identifies the new
# resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within
# the [Service](https://www.twilio.com/docs/chat/rest/service-resource). This
# value is often a username or email address. See the Identity documentation for
# more info.
@@ -40,24 +39,23 @@
# User.
# @param [String] attributes A valid JSON string that contains
# application-specific data.
# @param [String] friendly_name A descriptive string that you create to describe
# the new resource. This value is often used for display purposes.
- # @return [UserInstance] Newly created UserInstance
- def create(identity: nil, role_sid: :unset, attributes: :unset, friendly_name: :unset)
+ # @param [user.WebhookEnabledType] x_twilio_webhook_enabled The
+ # X-Twilio-Webhook-Enabled HTTP request header
+ # @return [UserInstance] Created UserInstance
+ def create(identity: nil, role_sid: :unset, attributes: :unset, friendly_name: :unset, x_twilio_webhook_enabled: :unset)
data = Twilio::Values.of({
'Identity' => identity,
'RoleSid' => role_sid,
'Attributes' => attributes,
'FriendlyName' => friendly_name,
})
+ headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
- payload = @version.create(
- 'POST',
- @uri,
- data: data
- )
+ payload = @version.create('POST', @uri, data: data, headers: headers)
UserInstance.new(@version, payload, service_sid: @solution[:service_sid], )
end
##
@@ -119,15 +117,13 @@
params = Twilio::Values.of({
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
})
- response = @version.page(
- 'GET',
- @uri,
- params
- )
+
+ response = @version.page('GET', @uri, params)
+
UserPage.new(@version, response, @solution)
end
##
# Retrieve a single page of UserInstance records from the API.
@@ -199,29 +195,23 @@
@user_channels = nil
@user_bindings = nil
end
##
- # Fetch a UserInstance
+ # Fetch the UserInstance
# @return [UserInstance] Fetched UserInstance
def fetch
- params = Twilio::Values.of({})
+ payload = @version.fetch('GET', @uri)
- payload = @version.fetch(
- 'GET',
- @uri,
- params,
- )
-
UserInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
end
##
- # Deletes the UserInstance
+ # Delete the UserInstance
# @return [Boolean] true if delete succeeds, false otherwise
def delete
- @version.delete('delete', @uri)
+ @version.delete('DELETE', @uri)
end
##
# Update the UserInstance
# @param [String] role_sid The SID of the
@@ -229,23 +219,22 @@
# User.
# @param [String] attributes A valid JSON string that contains
# application-specific data.
# @param [String] friendly_name A descriptive string that you create to describe
# the resource. It is often used for display purposes.
+ # @param [user.WebhookEnabledType] x_twilio_webhook_enabled The
+ # X-Twilio-Webhook-Enabled HTTP request header
# @return [UserInstance] Updated UserInstance
- def update(role_sid: :unset, attributes: :unset, friendly_name: :unset)
+ def update(role_sid: :unset, attributes: :unset, friendly_name: :unset, x_twilio_webhook_enabled: :unset)
data = Twilio::Values.of({
'RoleSid' => role_sid,
'Attributes' => attributes,
'FriendlyName' => friendly_name,
})
+ headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
- payload = @version.update(
- 'POST',
- @uri,
- data: data,
- )
+ payload = @version.update('POST', @uri, data: data, headers: headers)
UserInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
end
##
@@ -438,18 +427,18 @@
def url
@properties['url']
end
##
- # Fetch a UserInstance
+ # Fetch the UserInstance
# @return [UserInstance] Fetched UserInstance
def fetch
context.fetch
end
##
- # Deletes the UserInstance
+ # Delete the UserInstance
# @return [Boolean] true if delete succeeds, false otherwise
def delete
context.delete
end
@@ -460,12 +449,19 @@
# User.
# @param [String] attributes A valid JSON string that contains
# application-specific data.
# @param [String] friendly_name A descriptive string that you create to describe
# the resource. It is often used for display purposes.
+ # @param [user.WebhookEnabledType] x_twilio_webhook_enabled The
+ # X-Twilio-Webhook-Enabled HTTP request header
# @return [UserInstance] Updated UserInstance
- def update(role_sid: :unset, attributes: :unset, friendly_name: :unset)
- context.update(role_sid: role_sid, attributes: attributes, friendly_name: friendly_name, )
+ def update(role_sid: :unset, attributes: :unset, friendly_name: :unset, x_twilio_webhook_enabled: :unset)
+ context.update(
+ role_sid: role_sid,
+ attributes: attributes,
+ friendly_name: friendly_name,
+ x_twilio_webhook_enabled: x_twilio_webhook_enabled,
+ )
end
##
# Access the user_channels
# @return [user_channels] user_channels
\ No newline at end of file