Class: Twilio::REST::Notify::V1::ServiceContext::UserContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Notify::V1::ServiceContext::UserContext
- Defined in:
- lib/twilio-ruby/rest/notify/v1/service/user.rb,
lib/twilio-ruby/rest/notify/v1/service/user/user_binding.rb,
lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb
Overview
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Defined Under Namespace
Classes: SegmentMembershipContext, SegmentMembershipInstance, SegmentMembershipList, SegmentMembershipPage, UserBindingContext, UserBindingInstance, UserBindingList, UserBindingPage
Instance Method Summary collapse
-
#bindings(sid = :unset) ⇒ UserBindingList, UserBindingContext
Access the bindings.
-
#delete ⇒ Boolean
Deletes the UserInstance.
-
#fetch ⇒ UserInstance
Fetch a UserInstance.
-
#initialize(version, service_sid, identity) ⇒ UserContext
constructor
Initialize the UserContext.
-
#segment_memberships(segment = :unset) ⇒ SegmentMembershipList, SegmentMembershipContext
Access the segment_memberships.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, service_sid, identity) ⇒ UserContext
Initialize the UserContext
207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/twilio-ruby/rest/notify/v1/service/user.rb', line 207 def initialize(version, service_sid, identity) super(version) # Path Solution @solution = { service_sid: service_sid, identity: identity, } @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:identity]}" # Dependents @bindings = nil @segment_memberships = nil end |
Instance Method Details
#bindings(sid = :unset) ⇒ UserBindingList, UserBindingContext
Access the bindings
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/twilio-ruby/rest/notify/v1/service/user.rb', line 253 def bindings(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return UserBindingContext.new( @version, @solution[:service_sid], @solution[:identity], sid, ) end unless @bindings @bindings = UserBindingList.new( @version, service_sid: @solution[:service_sid], identity: @solution[:identity], ) end @bindings end |
#delete ⇒ Boolean
Deletes the UserInstance
225 226 227 |
# File 'lib/twilio-ruby/rest/notify/v1/service/user.rb', line 225 def delete @version.delete('delete', @uri) end |
#fetch ⇒ UserInstance
Fetch a UserInstance
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/twilio-ruby/rest/notify/v1/service/user.rb', line 232 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) UserInstance.new( @version, payload, service_sid: @solution[:service_sid], identity: @solution[:identity], ) end |
#segment_memberships(segment = :unset) ⇒ SegmentMembershipList, SegmentMembershipContext
Access the segment_memberships
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/twilio-ruby/rest/notify/v1/service/user.rb', line 280 def segment_memberships(segment=:unset) raise ArgumentError, 'segment cannot be nil' if segment.nil? if segment != :unset return SegmentMembershipContext.new( @version, @solution[:service_sid], @solution[:identity], segment, ) end unless @segment_memberships @segment_memberships = SegmentMembershipList.new( @version, service_sid: @solution[:service_sid], identity: @solution[:identity], ) end @segment_memberships end |
#to_s ⇒ Object
Provide a user friendly representation
305 306 307 308 |
# File 'lib/twilio-ruby/rest/notify/v1/service/user.rb', line 305 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Notify.V1.UserContext #{context}>" end |