Class: Twilio::REST::Conversations::V1::ServiceContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Conversations::V1::ServiceContext
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/service.rb,
lib/twilio-ruby/rest/conversations/v1/service/role.rb,
lib/twilio-ruby/rest/conversations/v1/service/user.rb,
lib/twilio-ruby/rest/conversations/v1/service/binding.rb,
lib/twilio-ruby/rest/conversations/v1/service/conversation.rb,
lib/twilio-ruby/rest/conversations/v1/service/configuration.rb,
lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb,
lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb,
lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb,
lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb,
lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb,
lib/twilio-ruby/rest/conversations/v1/service/participant_conversation.rb,
lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb,
lib/twilio-ruby/rest/conversations/v1/service/conversation_with_participants.rb,
lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb
Defined Under Namespace
Classes: BindingContext, BindingInstance, BindingList, BindingPage, ConfigurationContext, ConfigurationInstance, ConfigurationList, ConfigurationPage, ConversationContext, ConversationInstance, ConversationList, ConversationPage, ConversationWithParticipantsInstance, ConversationWithParticipantsList, ConversationWithParticipantsPage, ParticipantConversationInstance, ParticipantConversationList, ParticipantConversationPage, RoleContext, RoleInstance, RoleList, RolePage, UserContext, UserInstance, UserList, UserPage
Instance Method Summary collapse
-
#bindings(sid = :unset) ⇒ BindingList, BindingContext
Access the bindings.
-
#configuration ⇒ ConfigurationList, ConfigurationContext
Access the configuration.
-
#conversation_with_participants ⇒ ConversationWithParticipantsList, ConversationWithParticipantsContext
Access the conversation_with_participants.
-
#conversations(sid = :unset) ⇒ ConversationList, ConversationContext
Access the conversations.
-
#delete ⇒ Boolean
Delete the ServiceInstance.
-
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance.
-
#initialize(version, sid) ⇒ ServiceContext
constructor
Initialize the ServiceContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#participant_conversations ⇒ ParticipantConversationList, ParticipantConversationContext
Access the participant_conversations.
-
#roles(sid = :unset) ⇒ RoleList, RoleContext
Access the roles.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#users(sid = :unset) ⇒ UserList, UserContext
Access the users.
Constructor Details
#initialize(version, sid) ⇒ ServiceContext
Initialize the ServiceContext
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 161 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Services/#{@solution[:sid]}" # Dependents @participant_conversations = nil @conversation_with_participants = nil @configuration = nil @users = nil @roles = nil @bindings = nil @conversations = nil end |
Instance Method Details
#bindings(sid = :unset) ⇒ BindingList, BindingContext
Access the bindings
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 282 def bindings(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return BindingContext.new(@version, @solution[:sid],sid ) end unless @bindings @bindings = BindingList.new( @version, chat_service_sid: @solution[:sid], ) end @bindings end |
#configuration ⇒ ConfigurationList, ConfigurationContext
Access the configuration
234 235 236 237 238 239 |
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 234 def configuration ConfigurationContext.new( @version, @solution[:sid] ) end |
#conversation_with_participants ⇒ ConversationWithParticipantsList, ConversationWithParticipantsContext
Access the conversation_with_participants
223 224 225 226 227 228 229 |
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 223 def conversation_with_participants unless @conversation_with_participants @conversation_with_participants = ConversationWithParticipantsList.new( @version, chat_service_sid: @solution[:sid], ) end @conversation_with_participants end |
#conversations(sid = :unset) ⇒ ConversationList, ConversationContext
Access the conversations
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 301 def conversations(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return ConversationContext.new(@version, @solution[:sid],sid ) end unless @conversations @conversations = ConversationList.new( @version, chat_service_sid: @solution[:sid], ) end @conversations end |
#delete ⇒ Boolean
Delete the ServiceInstance
180 181 182 183 184 185 186 187 |
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 180 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 192 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
326 327 328 329 |
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 326 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.ServiceContext #{context}>" end |
#participant_conversations ⇒ ParticipantConversationList, ParticipantConversationContext
Access the participant_conversations
212 213 214 215 216 217 218 |
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 212 def participant_conversations unless @participant_conversations @participant_conversations = ParticipantConversationList.new( @version, chat_service_sid: @solution[:sid], ) end @participant_conversations end |
#roles(sid = :unset) ⇒ RoleList, RoleContext
Access the roles
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 263 def roles(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return RoleContext.new(@version, @solution[:sid],sid ) end unless @roles @roles = RoleList.new( @version, chat_service_sid: @solution[:sid], ) end @roles end |
#to_s ⇒ Object
Provide a user friendly representation
319 320 321 322 |
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 319 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.ServiceContext #{context}>" end |
#users(sid = :unset) ⇒ UserList, UserContext
Access the users
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/twilio-ruby/rest/conversations/v1/service.rb', line 244 def users(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return UserContext.new(@version, @solution[:sid],sid ) end unless @users @users = UserList.new( @version, chat_service_sid: @solution[:sid], ) end @users end |