Skip to content
Browse files

Merge branch 'develop'

  • Loading branch information...
2 parents 58440a2 + f4f26ab commit 6cdc0b3511b82d2d784cbbc0f4f37362aeb06b5b @andrewmbenton andrewmbenton committed Oct 19, 2012
View
3 lib/twilio-ruby.rb
@@ -35,6 +35,9 @@
require 'twilio-ruby/rest/conferences/participants'
require 'twilio-ruby/rest/queues'
require 'twilio-ruby/rest/queues/members'
+require 'twilio-ruby/rest/usage'
+require 'twilio-ruby/rest/usage/records'
+require 'twilio-ruby/rest/usage/triggers'
require 'twilio-ruby/rest/recordings'
require 'twilio-ruby/rest/transcriptions'
require 'twilio-ruby/rest/notifications'
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, :queues
+ :authorized_connect_apps, :queues, :usage
end
end
end
View
10 lib/twilio-ruby/rest/usage.rb
@@ -0,0 +1,10 @@
+module Twilio
+ module REST
+ class Usage < InstanceResource
+ def initialize(uri, client, params={})
+ super
+ resource :records, :triggers
+ end
+ end
+ end
+end
View
21 lib/twilio-ruby/rest/usage/records.rb
@@ -0,0 +1,21 @@
+module Twilio
+ module REST
+ class Records < ListResource
+
+ SUBRESOURCES = [:daily, :monthly, :yearly, :all_time, :today, :yesterday,
+ :this_month, :last_month]
+
+ def initialize(uri, client)
+ super
+ @list_key = 'usage_records'
+ end
+
+ def method_missing(method, *args)
+ super unless SUBRESOURCES.include? method
+ self.class.new "#{@uri}/#{twilify(method)}", @client
+ end
+ end
+
+ class Record < InstanceResource; end
+ end
+end
View
12 lib/twilio-ruby/rest/usage/triggers.rb
@@ -0,0 +1,12 @@
+module Twilio
+ module REST
+ class Triggers < ListResource
+ def initialize(uri, client)
+ super
+ @list_key = 'usage_triggers'
+ end
+ end
+
+ class Trigger < InstanceResource; end
+ end
+end
View
2 lib/twilio-ruby/version.rb
@@ -1,3 +1,3 @@
module Twilio
- VERSION = '3.8.0'
+ VERSION = '3.9.0'
end

0 comments on commit 6cdc0b3

Please sign in to comment.
Something went wrong with that request. Please try again.