Permalink
Browse files

Some spec changes and queues.

  • Loading branch information...
1 parent ce7d36c commit 504498dd3d75420e3393688048c720f2ac8053e1 Oscar Sanchez committed Aug 6, 2012
View
2 lib/twilio-ruby.rb
@@ -37,3 +37,5 @@
require 'twilio-ruby/rest/transcriptions'
require 'twilio-ruby/rest/notifications'
require 'twilio-ruby/rest/client'
+require 'twilio-ruby/rest/queues'
+require 'twilio-ruby/rest/queues/members'
View
2 lib/twilio-ruby/rest/accounts.rb
@@ -8,7 +8,7 @@ def initialize(uri, client, params={})
resource :sandbox, :available_phone_numbers, :incoming_phone_numbers,
:calls, :outgoing_caller_ids, :conferences, :sms, :recordings,
:transcriptions, :notifications, :applications, :connect_apps,
- :authorized_connect_apps
+ :authorized_connect_apps, :queues
end
end
end
View
16 lib/twilio-ruby/rest/queues.rb
@@ -0,0 +1,16 @@
+module Twilio
+ module REST
+ class Queues < ListResource; end
+
+ class Queue < InstanceResource
+ def initialize(uri, client, params={})
+ super uri, client, params
+ resource :members
+ end
+
+ def max_size(max)
+ update :max_size => max
+ end
+ end
+ end
+end
View
18 lib/twilio-ruby/rest/queues/members.rb
@@ -0,0 +1,18 @@
+module Twilio
+ module REST
+ class Members < ListResource
+ def initialize(uri, client)
+ super
+ # hard-code the json key since members don't have sids
+ @instance_id_key = 'call_sid'
+ end
+ end
+
+ class Member < InstanceResource
+ def dequeue(url, method)
+ update :url => url
+ update :method => method
+ end
+ end
+ end
+end
View
8 spec/rest/account_spec.rb
@@ -31,6 +31,12 @@
account.conferences.instance_variable_get('@uri').should == 'someUri/Conferences'
end
+ it 'should set up a queues resources object' do
+ account = Twilio::REST::Account.new('someUri', 'someClient')
+ account.respond_to?(:queues).should == true
+ account.queues.instance_variable_get('@uri').should == 'someUri/Queues'
+ end
+
it 'should set up a sms resource object' do
account = Twilio::REST::Account.new('someUri', 'someClient')
account.respond_to?(:sms).should == true
@@ -54,4 +60,4 @@
account.respond_to?(:notifications).should == true
account.notifications.instance_variable_get('@uri').should == 'someUri/Notifications'
end
-end
+end

0 comments on commit 504498d

Please sign in to comment.