Class: Twilio::REST::IpMessaging::V1::ServiceContext::UserContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::IpMessaging::V1::ServiceContext::UserContext
- Defined in:
- lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb,
lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb
Defined Under Namespace
Classes: UserChannelInstance, UserChannelList, UserChannelPage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the UserInstance.
-
#fetch ⇒ UserInstance
Fetch the UserInstance.
-
#initialize(version, service_sid, sid) ⇒ UserContext
constructor
Initialize the UserContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(role_sid: :unset, attributes: :unset, friendly_name: :unset) ⇒ UserInstance
Update the UserInstance.
-
#user_channels ⇒ UserChannelList, UserChannelContext
Access the user_channels.
Constructor Details
#initialize(version, service_sid, sid) ⇒ UserContext
Initialize the UserContext
174 175 176 177 178 179 180 181 182 183 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 174 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:sid]}" # Dependents @user_channels = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the UserInstance
187 188 189 190 191 192 193 194 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 187 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ UserInstance
Fetch the UserInstance
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 199 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) UserInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
270 271 272 273 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 270 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V1.UserContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
263 264 265 266 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 263 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V1.UserContext #{context}>" end |
#update(role_sid: :unset, attributes: :unset, friendly_name: :unset) ⇒ UserInstance
Update the UserInstance
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 222 def update( role_sid: :unset, attributes: :unset, friendly_name: :unset ) data = Twilio::Values.of({ 'RoleSid' => role_sid, 'Attributes' => attributes, 'FriendlyName' => friendly_name, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) UserInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#user_channels ⇒ UserChannelList, UserChannelContext
Access the user_channels
253 254 255 256 257 258 259 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb', line 253 def user_channels unless @user_channels @user_channels = UserChannelList.new( @version, service_sid: @solution[:service_sid], user_sid: @solution[:sid], ) end @user_channels end |