twilio-ruby 3.12.0 → 3.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWZkNmViOGVhYzA4YzlhOWRkYzFjZDZhMTY1NTY1NmE5ZmVjZWI4MQ==
4
+ OWU0YjUzYzFjNmY0YTc4NzM1MDMyZjAyZjQwZmJkNzM5ZDM3MGVjZg==
5
5
  data.tar.gz: !binary |-
6
- ODBhOTdkNTE2NjE0OGUzZmJhY2U3NzdhMTM2ODU0N2EwNzNlZTYyOA==
6
+ MzY4NWQwNjRhMTZhODRhNzViZDdmYmQ4MmYxNDZhNmE4YTY3YWY2ZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTY0NDM4N2Q3ODA1MDdmYTc2OTY3ODE2OGE4YjBlMjExMDBmZTBkYzkzZWE2
10
- MThkMGZhZWY4MDhiZWIxOTE0OGVjZjQ2NjQ3OTBlNzcwZjhiMWI4ZTcxOGU0
11
- MzQ3ZTQ3MjcyYmYzNjdkZjFiZTYxOTQxODI5YjViMzI2YTE2MzE=
9
+ ZWVmMzJjZjEwMjFhNTI1MDY4ZGJkZTgyMTQ0OWNlYWI3YmNjOTRmMzUxNTFl
10
+ YmYxYzQyMWQzMjY2ZGM2NTc5ZjUwYzhiOGFkZDM0OWY0MjFhNDRiY2FiNmY4
11
+ ZTkxNDVjYTkzN2NmZDMyZjNmYTJlMTkzMzk0ZjA4MTY5MjgzMjg=
12
12
  data.tar.gz: !binary |-
13
- ZDgwN2ZhOWQzMzYzMGQ3MzJkY2EyNzZiOTk5MDA5ZGZmZjEwZjE0ODc2NDdl
14
- ODE1M2FmNTUwMGVjNjgwNzc5MzIxZjRkZGE2ZmJkZjdjYTllMzY4ZTYzMjQ4
15
- ZGVjZGIyMzkwZjMxZWRkOTcwYTE5MmIzNjQ4OTVjYTkyZjdkOTI=
13
+ NmY3NGI1NzljMTY0MDA4NjM5YTg3NTFkZjQxYTcwZGUyYWYwMWJiNmFjMTdh
14
+ MDNmNTZhOGMwNGM5NDhhNmY4NTU3MDJhNThhMTBkYjBjYmM0YmQzZDk3OWJm
15
+ YTk3NjUyNGI2MGIxMTZmNGUzZGM1MmRiMTk0YWJjNGI2YmU5YmE=
data/lib/twilio-ruby.rb CHANGED
@@ -19,6 +19,8 @@ require 'twilio-ruby/rest/instance_resource'
19
19
  require 'twilio-ruby/rest/sandbox'
20
20
  require 'twilio-ruby/rest/accounts'
21
21
  require 'twilio-ruby/rest/calls'
22
+ require 'twilio-ruby/rest/call_feedback'
23
+ require 'twilio-ruby/rest/call_feedback_summary'
22
24
  require 'twilio-ruby/rest/sms'
23
25
  require 'twilio-ruby/rest/sms/short_codes'
24
26
  require 'twilio-ruby/rest/sms/messages'
@@ -0,0 +1,28 @@
1
+ module Twilio
2
+ module REST
3
+ class Feedback < ListResource;
4
+
5
+ ##
6
+ # Get this feedback object.
7
+ #
8
+ # Overridden because GETS to /Feedback
9
+ # returns an instance, not a list.
10
+ def get(params={}, full_path=false)
11
+ raise "Can't fetch feedback without a REST Client" unless @client
12
+ response = @client.get @path, params, full_path
13
+ path = full_path ? @path.split('.')[0] : @path
14
+ @instance_class.new path, @client, response
15
+ end
16
+
17
+ ##
18
+ # Creates a new Feedback object.
19
+ def create(params={})
20
+ raise "Can't create feedback without a REST Client" unless @client
21
+ response = @client.post @path, params
22
+ @instance_class.new @path, @client, response
23
+ end
24
+ end
25
+
26
+ class FeedbackInstance < InstanceResource; end
27
+ end
28
+ end
@@ -0,0 +1,13 @@
1
+ module Twilio
2
+ module REST
3
+ class FeedbackSummary < ListResource
4
+ def initialize(path, client)
5
+ @path, @client = path, client
6
+ @instance_class = Twilio::REST::FeedbackSummaryInstance
7
+ @list_key, @instance_id_key = 'feedback_summary', 'sid'
8
+ end
9
+ end
10
+
11
+ class FeedbackSummaryInstance < InstanceResource; end
12
+ end
13
+ end
@@ -1,6 +1,11 @@
1
1
  module Twilio
2
2
  module REST
3
3
  class Calls < ListResource
4
+ def initialize(path, client)
5
+ super
6
+ resource :feedback_summary
7
+ end
8
+
4
9
  def make(from, to, url)
5
10
  create :from => from, :to => to, :url => url
6
11
  end
@@ -9,7 +14,7 @@ module Twilio
9
14
  class Call < InstanceResource
10
15
  def initialize(path, client, params={})
11
16
  super path, client, params
12
- resource :recordings, :notifications
17
+ resource :recordings, :notifications, :feedback
13
18
  end
14
19
 
15
20
  def redirect_to(url)
@@ -3,9 +3,12 @@ module Twilio
3
3
  class ListResource
4
4
  include Utils
5
5
 
6
-
7
6
  def initialize(path, client)
8
- custom_names = {"Media" => "MediaInstance", "IpAddresses" => "IpAddress"}
7
+ custom_names = {
8
+ 'Media' => 'MediaInstance',
9
+ 'IpAddresses' => 'IpAddress',
10
+ 'Feedback' => 'FeedbackInstance',
11
+ }
9
12
  @path, @client = path, client
10
13
  resource_name = self.class.name.split('::')[-1]
11
14
  instance_name = custom_names.fetch(resource_name, resource_name.chop)
@@ -13,7 +16,7 @@ module Twilio
13
16
  # The next line grabs the enclosing module. Necessary for resources
14
17
  # contained in their own submodule like /SMS/Messages
15
18
  parent_module = self.class.to_s.split('::')[-2]
16
- full_module_path = parent_module == "REST" ? (Twilio::REST) : (Twilio::REST.const_get parent_module)
19
+ full_module_path = parent_module == 'REST' ? (Twilio::REST) : (Twilio::REST.const_get parent_module)
17
20
 
18
21
  @instance_class = full_module_path.const_get instance_name
19
22
  @list_key, @instance_id_key = detwilify(resource_name), 'sid'
@@ -94,7 +97,10 @@ module Twilio
94
97
  end
95
98
 
96
99
  def resource(*resources)
97
- custom_resource_names = {:sms => 'SMS', :sip => 'SIP'}
100
+ custom_resource_names = {
101
+ :sms => 'SMS',
102
+ :sip => 'SIP',
103
+ }
98
104
  resources.each do |r|
99
105
  resource = twilify r
100
106
  relative_path = custom_resource_names.fetch(r, resource)
@@ -2,8 +2,8 @@ module Twilio
2
2
  module REST
3
3
  class Records < ListResource
4
4
 
5
- SUBRESOURCES = [:daily, :monthly, :yearly, :all_time, :today, :yesterday,
6
- :this_month, :last_month]
5
+ SUBRESOURCES = [:daily, :monthly, :yearly, :all_time, :today,
6
+ :yesterday, :this_month, :last_month]
7
7
 
8
8
  def initialize(path, client)
9
9
  super
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '3.12.0'
2
+ VERSION = '3.12.1'
3
3
  end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Twilio::REST::Feedback do
4
+ before do
5
+ @call = Twilio::REST::Call.new('someUri', 'someClient')
6
+ end
7
+
8
+ it 'sets up a feedback resources object' do
9
+ @call.should respond_to(:feedback)
10
+ @call.feedback.instance_variable_get('@path').should == 'someUri/Feedback'
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe Twilio::REST::FeedbackSummary do
4
+ it 'creates a feedback summary object' do
5
+ calls = Twilio::REST::Calls.new('someUri', 'someClient')
6
+ calls.should respond_to(:feedback_summary)
7
+ calls.feedback_summary.instance_variable_get('@path').should == 'someUri/FeedbackSummary'
8
+ end
9
+ end
data/twilio-ruby.gemspec CHANGED
@@ -29,4 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency('rubysl') if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
30
30
 
31
31
  spec.add_development_dependency 'bundler', '~> 1.5'
32
+ spec.extra_rdoc_files = ['README.md', 'LICENSE.md']
33
+ spec.rdoc_options = ['--line-numbers', '--inline-source', '--title', 'twilio-ruby', '--main', 'README.md']
32
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilio-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.0
4
+ version: 3.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Benton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2014-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -134,6 +134,8 @@ files:
134
134
  - lib/twilio-ruby/rest/available_phone_numbers/local.rb
135
135
  - lib/twilio-ruby/rest/available_phone_numbers/mobile.rb
136
136
  - lib/twilio-ruby/rest/available_phone_numbers/toll_free.rb
137
+ - lib/twilio-ruby/rest/call_feedback.rb
138
+ - lib/twilio-ruby/rest/call_feedback_summary.rb
137
139
  - lib/twilio-ruby/rest/calls.rb
138
140
  - lib/twilio-ruby/rest/client.rb
139
141
  - lib/twilio-ruby/rest/conferences.rb
@@ -177,6 +179,8 @@ files:
177
179
  - lib/twilio-ruby/version.rb
178
180
  - spec/rack/twilio_webhook_authentication_spec.rb
179
181
  - spec/rest/account_spec.rb
182
+ - spec/rest/call_feedback_spec.rb
183
+ - spec/rest/call_feedback_summary_spec.rb
180
184
  - spec/rest/call_spec.rb
181
185
  - spec/rest/client_spec.rb
182
186
  - spec/rest/conference_spec.rb
@@ -225,6 +229,8 @@ summary: A simple library for communicating with the Twilio REST API, building T
225
229
  test_files:
226
230
  - spec/rack/twilio_webhook_authentication_spec.rb
227
231
  - spec/rest/account_spec.rb
232
+ - spec/rest/call_feedback_spec.rb
233
+ - spec/rest/call_feedback_summary_spec.rb
228
234
  - spec/rest/call_spec.rb
229
235
  - spec/rest/client_spec.rb
230
236
  - spec/rest/conference_spec.rb