Class: Twilio::REST::Chat::V2::ServiceContext::UserContext::UserBindingContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, user_sid, sid) ⇒ UserBindingContext

Initialize the UserBindingContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The SID of the Service to fetch the User Binding resource from.

  • user_sid (String)

    The SID of the User with the User Binding resource to fetch. See push notification configuration for more info.

  • sid (String)

    The SID of the User Binding resource to fetch.


187
188
189
190
191
192
193
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb', line 187

def initialize(version, service_sid, user_sid, sid)
  super(version)

  # Path Solution
  @solution = {service_sid: service_sid, user_sid: user_sid, sid: sid, }
  @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:user_sid]}/Bindings/#{@solution[:sid]}"
end

Instance Method Details

#deleteBoolean

Delete the UserBindingInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


213
214
215
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb', line 213

def delete
   @version.delete('DELETE', @uri)
end

#fetchUserBindingInstance

Fetch the UserBindingInstance

Returns:


198
199
200
201
202
203
204
205
206
207
208
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb', line 198

def fetch
  payload = @version.fetch('GET', @uri)

  UserBindingInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      user_sid: @solution[:user_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation


226
227
228
229
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb', line 226

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Chat.V2.UserBindingContext #{context}>"
end

#to_sObject

Provide a user friendly representation


219
220
221
222
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb', line 219

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Chat.V2.UserBindingContext #{context}>"
end