Class: Twilio::REST::Api::V2010::AccountContext::QueueContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Api::V2010::AccountContext::QueueContext
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/queue.rb,
lib/twilio-ruby/rest/api/v2010/account/queue/member.rb
Defined Under Namespace
Classes: MemberContext, MemberInstance, MemberList, MemberPage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the QueueInstance.
-
#fetch ⇒ QueueInstance
Fetch the QueueInstance.
-
#initialize(version, account_sid, sid) ⇒ QueueContext
constructor
Initialize the QueueContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#members(call_sid = :unset) ⇒ MemberList, MemberContext
Access the members.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, max_size: :unset) ⇒ QueueInstance
Update the QueueInstance.
Constructor Details
#initialize(version, account_sid, sid) ⇒ QueueContext
Initialize the QueueContext
158 159 160 161 162 163 164 165 166 167 |
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 158 def initialize(version, account_sid, sid) super(version) # Path Solution @solution = { account_sid: account_sid, sid: sid, } @uri = "/Accounts/#{@solution[:account_sid]}/Queues/#{@solution[:sid]}.json" # Dependents @members = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the QueueInstance
171 172 173 174 |
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 171 def delete @version.delete('DELETE', @uri) end |
#fetch ⇒ QueueInstance
Fetch the QueueInstance
179 180 181 182 183 184 185 186 187 188 |
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 179 def fetch payload = @version.fetch('GET', @uri) QueueInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
243 244 245 246 |
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 243 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.QueueContext #{context}>" end |
#members(call_sid = :unset) ⇒ MemberList, MemberContext
Access the members
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 218 def members(call_sid=:unset) raise ArgumentError, 'call_sid cannot be nil' if call_sid.nil? if call_sid != :unset return MemberContext.new(@version, @solution[:account_sid], @solution[:sid],call_sid ) end unless @members @members = MemberList.new( @version, account_sid: @solution[:account_sid], queue_sid: @solution[:sid], ) end @members end |
#to_s ⇒ Object
Provide a user friendly representation
236 237 238 239 |
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 236 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.QueueContext #{context}>" end |
#update(friendly_name: :unset, max_size: :unset) ⇒ QueueInstance
Update the QueueInstance
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/twilio-ruby/rest/api/v2010/account/queue.rb', line 195 def update( friendly_name: :unset, max_size: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'MaxSize' => max_size, }) payload = @version.update('POST', @uri, data: data) QueueInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |