Permalink
Browse files

adding support for usage records and usage triggers

  • Loading branch information...
1 parent 8cd9096 commit f4f26abc46098bf27c20c0ac8dc0f667f1ae3338 @andrewmbenton andrewmbenton committed Oct 19, 2012
View
@@ -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'
@@ -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
@@ -0,0 +1,10 @@
+module Twilio
+ module REST
+ class Usage < InstanceResource
+ def initialize(uri, client, params={})
+ super
+ resource :records, :triggers
+ end
+ end
+ end
+end
@@ -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
@@ -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
@@ -1,3 +1,3 @@
module Twilio
- VERSION = '3.8.0'
+ VERSION = '3.9.0'
end

0 comments on commit f4f26ab

Please sign in to comment.