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 resource from.

  • user_sid (String) —

    The SID of the User for the binding. See push notification configuration for more information.

  • sid (String) —

    The Twilio-provided string that uniquely identifies the User Binding resource to fetch.



190
191
192
193
194
195
196
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb', line 190

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

#delete ⇒ Boolean

Deletes the UserBindingInstance

Returns:

  • (Boolean) —

    true if delete succeeds, true otherwise



222
223
224
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb', line 222

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

#fetch ⇒ UserBindingInstance

Fetch a UserBindingInstance

Returns:



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb', line 201

def fetch
  params = Twilio::Values.of({})

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

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

#inspect ⇒ Object

Provide a detailed, user friendly representation



235
236
237
238
# File 'lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb', line 235

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

#to_s ⇒ Object

Provide a user friendly representation



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

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