lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb in twilio-ruby-5.38.0 vs lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb in twilio-ruby-5.39.0

- old
+ new

@@ -30,28 +30,23 @@ @solution = {service_sid: service_sid, channel_sid: channel_sid} @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Invites" end ## - # Retrieve a single page of InviteInstance records from the API. - # Request is executed immediately. + # Create the InviteInstance # @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). See # [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. # @param [String] role_sid The SID of the # [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the new # member. - # @return [InviteInstance] Newly created InviteInstance + # @return [InviteInstance] Created InviteInstance def create(identity: nil, role_sid: :unset) data = Twilio::Values.of({'Identity' => identity, 'RoleSid' => role_sid, }) - payload = @version.create( - 'POST', - @uri, - data: data - ) + payload = @version.create('POST', @uri, data: data) InviteInstance.new( @version, payload, service_sid: @solution[:service_sid], @@ -131,15 +126,13 @@ 'Identity' => Twilio.serialize_list(identity) { |e| e }, 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, }) - response = @version.page( - 'GET', - @uri, - params - ) + + response = @version.page('GET', @uri, params) + InvitePage.new(@version, response, @solution) end ## # Retrieve a single page of InviteInstance records from the API. @@ -215,35 +208,29 @@ @solution = {service_sid: service_sid, channel_sid: channel_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Invites/#{@solution[:sid]}" end ## - # Fetch a InviteInstance + # Fetch the InviteInstance # @return [InviteInstance] Fetched InviteInstance def fetch - params = Twilio::Values.of({}) + payload = @version.fetch('GET', @uri) - payload = @version.fetch( - 'GET', - @uri, - params, - ) - InviteInstance.new( @version, payload, service_sid: @solution[:service_sid], channel_sid: @solution[:channel_sid], sid: @solution[:sid], ) end ## - # Deletes the InviteInstance + # Delete the InviteInstance # @return [Boolean] true if delete succeeds, false otherwise def delete - @version.delete('delete', @uri) + @version.delete('DELETE', @uri) end ## # Provide a user friendly representation def to_s @@ -373,17 +360,17 @@ def url @properties['url'] end ## - # Fetch a InviteInstance + # Fetch the InviteInstance # @return [InviteInstance] Fetched InviteInstance def fetch context.fetch end ## - # Deletes the InviteInstance + # Delete the InviteInstance # @return [Boolean] true if delete succeeds, false otherwise def delete context.delete end \ No newline at end of file