class Twilio::REST::IpMessaging::V2::ServiceContext::UserContext

Public Class Methods

new(version, service_sid, sid) click to toggle source

Initialize the UserContext @param [Version] version Version that contains the resource @param [String] service_sid The service_sid @param [String] sid The sid @return [UserContext] UserContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
174 def initialize(version, service_sid, sid)
175   super(version)
176 
177   # Path Solution
178   @solution = {service_sid: service_sid, sid: sid, }
179   @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:sid]}"
180 
181   # Dependents
182   @user_channels = nil
183   @user_bindings = nil
184 end

Public Instance Methods

delete() click to toggle source

Delete the UserInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
198 def delete
199    @version.delete('DELETE', @uri)
200 end
fetch() click to toggle source

Fetch the UserInstance @return [UserInstance] Fetched UserInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
189 def fetch
190   payload = @version.fetch('GET', @uri)
191 
192   UserInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
193 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
276 def inspect
277   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
278   "#<Twilio.IpMessaging.V2.UserContext #{context}>"
279 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
269 def to_s
270   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
271   "#<Twilio.IpMessaging.V2.UserContext #{context}>"
272 end
update(role_sid: :unset, attributes: :unset, friendly_name: :unset, x_twilio_webhook_enabled: :unset) click to toggle source

Update the UserInstance @param [String] role_sid The role_sid @param [String] attributes The attributes @param [String] friendly_name The friendly_name @param [user.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

@return [UserInstance] Updated UserInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
210 def update(role_sid: :unset, attributes: :unset, friendly_name: :unset, x_twilio_webhook_enabled: :unset)
211   data = Twilio::Values.of({
212       'RoleSid' => role_sid,
213       'Attributes' => attributes,
214       'FriendlyName' => friendly_name,
215   })
216   headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
217 
218   payload = @version.update('POST', @uri, data: data, headers: headers)
219 
220   UserInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
221 end
user_bindings(sid=:unset) click to toggle source

Access the user_bindings @return [UserBindingList] @return [UserBindingContext] if sid was passed.

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
249 def user_bindings(sid=:unset)
250   raise ArgumentError, 'sid cannot be nil' if sid.nil?
251 
252   if sid != :unset
253     return UserBindingContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
254   end
255 
256   unless @user_bindings
257     @user_bindings = UserBindingList.new(
258         @version,
259         service_sid: @solution[:service_sid],
260         user_sid: @solution[:sid],
261     )
262   end
263 
264   @user_bindings
265 end
user_channels(channel_sid=:unset) click to toggle source

Access the user_channels @return [UserChannelList] @return [UserChannelContext] if channel_sid was passed.

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb
227 def user_channels(channel_sid=:unset)
228   raise ArgumentError, 'channel_sid cannot be nil' if channel_sid.nil?
229 
230   if channel_sid != :unset
231     return UserChannelContext.new(@version, @solution[:service_sid], @solution[:sid], channel_sid, )
232   end
233 
234   unless @user_channels
235     @user_channels = UserChannelList.new(
236         @version,
237         service_sid: @solution[:service_sid],
238         user_sid: @solution[:sid],
239     )
240   end
241 
242   @user_channels
243 end