twilio-ruby 3.11.4 → 3.11.5

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60caf96e0be84c2a084bd580c8c181b92909f5c4
4
- data.tar.gz: 4c46e3cce1c9828ce1245c50037fabc534734808
3
+ metadata.gz: 7ab94258630ce056a2ec9062bcead79026e6ace5
4
+ data.tar.gz: dee171b3ef56e709b2a83e9266ec0afd4ea49ba2
5
5
  SHA512:
6
- metadata.gz: 142f0aa26b716d745ca24bf6ee5ce6df21404d0298e90f8642a58c128ae0ac6c476eb038dfd156980cd57fa773852b11e5f284f4768763beabb19a00a7d10255
7
- data.tar.gz: 84711f852670886bcffaa74a2d0394a6bcf58af0e93837872bf18df57c2484b95a431b03bf208bf5506e4ea3429cbc6e877dc6956b3e616076bb832a4c79daa1
6
+ metadata.gz: 51e94cefd327185a93ae3fadf1151a13affae35f4d7af2bd0fbc418d25a82ac800ca79974b719edf6e572f3649db87364c5794f56597db3fdcc2452823173372
7
+ data.tar.gz: 921bede6c840a2dcb37495e1778982c322c6d04406466b56964f003f0ffcb0263a9cccf71b4b5564e1a64033f8f9e8cd62219e4cc8616dff5f09c29140f37793
data/AUTHORS.md CHANGED
@@ -7,18 +7,25 @@ A huge thanks to all of our contributors:
7
7
  - Adam Ballai
8
8
  - Alexander Murmann & Ryan Spore
9
9
  - Andrew Benton
10
+ - Brian Levine
10
11
  - Caley Woods
11
12
  - Carlos Diaz-Padron
12
13
  - Connor Montgomery
13
14
  - Doug Black
15
+ - Elaine Tsai
14
16
  - Fiona Tay & Will Read
15
17
  - Geoff Petrie
18
+ - Guille Carlos
16
19
  - Josh Hull
17
20
  - Joël Franusic
18
21
  - K Gautam Pai
19
22
  - Kevin Burke
20
23
  - Kyle Conroy
24
+ - Oscar
21
25
  - Oscar Sanchez
22
26
  - Rafael Chacon
23
27
  - Ryan Spore
28
+ - Sam Kimbrel
29
+ - Torey Heinz
30
+ - Vipul A M
24
31
  - vfrride
data/CHANGES CHANGED
@@ -1,6 +1,22 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ Version 3.11.5
5
+
6
+ Released February 4
7
+
8
+ - Add bangs for twilify to indicate it's a dangerous operation.
9
+ - Remove reference to deprecated OpenSSL Digest parameter.
10
+ - Encode dates properly before passing them to the Twilio API.
11
+
12
+ Version 3.11.4
13
+
14
+ Released October 21, 2013
15
+
16
+ - Add support for listing IncomingPhoneNumbers by type.
17
+ - Add support for searching for mobile enabled numbers for
18
+ both IncomingPhoneNumbers and AvailablePhoneNumbers.
19
+
4
20
  Version 3.11.3
5
21
 
6
22
  Released October 15, 2013
@@ -80,7 +80,7 @@ Retrieving Sent Messages
80
80
 
81
81
  @client = Twilio::REST::Client.new account_sid, auth_token
82
82
 
83
- @client.account.messages.each do |message|
83
+ @client.account.messages.list.each do |message|
84
84
  puts message.body
85
85
 
86
86
 
@@ -81,6 +81,9 @@ puts @account.messages.get('SMXXXXXXXX').body
81
81
  # update an existing phone number's voice url
82
82
  @account.incoming_phone_numbers.get('PNdba508c5616a7f5e141789f44f022cc3').update({:voice_url => 'http://example.com/voice'})
83
83
 
84
+ # decommission an existing phone number
85
+ numbers = @account.incoming_phone_numbers.list(:friendly_name => 'A Fabulous Friendly Name')
86
+ numbers[0].delete
84
87
  ################ CONFERENCES ################
85
88
 
86
89
  # get a particular conference's participants object and stash it
@@ -47,10 +47,13 @@ module Twilio
47
47
 
48
48
  API_VERSION = '2010-04-01'
49
49
 
50
+ # 1.8.7 doesn't have the RUBY_ENGINE constant.
51
+ engine = !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby'
52
+
50
53
  HTTP_HEADERS = {
51
54
  'Accept' => 'application/json',
52
55
  'Accept-Charset' => 'utf-8',
53
- 'User-Agent' => "twilio-ruby/#{Twilio::VERSION}",
56
+ 'User-Agent' => "twilio-ruby/#{Twilio::VERSION} (#{engine}/#{RUBY_PLATFORM} #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL})",
54
57
  }
55
58
 
56
59
  DEFAULTS = {
@@ -4,9 +4,9 @@ module Twilio
4
4
 
5
5
  def twilify(something)
6
6
  if something.is_a? Hash
7
- Hash[*something.to_a.map {|a| [twilify(a[0]).to_sym, a[1]]}.flatten(1)]
7
+ Hash[*something.to_a.map! {|a| [twilify(a[0]).to_sym, a[1]]}.flatten(1)]
8
8
  else
9
- something.to_s.split('_').map do |s|
9
+ something.to_s.split('_').map! do |s|
10
10
  [s[0,1].capitalize, s[1..-1]].join
11
11
  end.join
12
12
  end
@@ -14,7 +14,7 @@ module Twilio
14
14
 
15
15
  def detwilify(something)
16
16
  if something.is_a? Hash
17
- Hash[*something.to_a.map {|pair| [detwilify(pair[0]).to_sym, pair[1]]}.flatten]
17
+ Hash[*something.to_a.map! {|pair| [detwilify(pair[0]).to_sym, pair[1]]}.flatten]
18
18
  else
19
19
  something.to_s.gsub(/[A-Z][a-z]*/) {|s| "_#{s.downcase}"}.gsub(/^_/, '')
20
20
  end
@@ -1,7 +1,15 @@
1
1
  module Twilio
2
2
  module Util
3
3
  def url_encode(hash)
4
- hash.to_a.map {|p| p.map {|e| CGI.escape e.to_s}.join '='}.join '&'
4
+ hash.to_a.map {|p| p.map {|e| CGI.escape get_string(e)}.join '='}.join '&'
5
+ end
6
+
7
+ def get_string(obj)
8
+ if obj.respond_to?(:strftime)
9
+ obj.strftime('%Y-%m-%d')
10
+ else
11
+ obj.to_s
12
+ end
5
13
  end
6
14
  end
7
15
  end
@@ -13,7 +13,7 @@ module Twilio
13
13
 
14
14
  def build_signature_for(url, params)
15
15
  data = url + params.sort.join
16
- digest = OpenSSL::Digest::Digest.new('sha1')
16
+ digest = OpenSSL::Digest.new('sha1')
17
17
  Base64.encode64(OpenSSL::HMAC.digest(digest, @auth_token, data)).strip
18
18
  end
19
19
 
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '3.11.4'
2
+ VERSION = '3.11.5'
3
3
  end
@@ -68,7 +68,7 @@ describe Twilio::Util::Capability do
68
68
  @capability.allow_client_outgoing 'myAppSid', app_params_hash
69
69
  app_params = @capability.instance_eval {url_encode(app_params_hash)}
70
70
  params_hash = {'appSid' => 'myAppSid', 'appParams' => app_params}
71
- params = @capability.instance_eval {url_encode(params_hash)}
71
+ @capability.instance_eval {url_encode(params_hash)}
72
72
  token = @capability.generate
73
73
  decoded = JWT.decode token, 'myAuthToken'
74
74
  queries(decoded['scope']).should == [['outgoing', params_hash]]
@@ -102,7 +102,7 @@ describe Twilio::Util::Capability do
102
102
  @capability.allow_client_outgoing 'myAppSid', app_params_hash
103
103
  app_params = @capability.instance_eval {url_encode(app_params_hash)}
104
104
  params_hash = {'appSid' => 'myAppSid', 'appParams' => app_params, 'clientName' => 'andrew'}
105
- params = @capability.instance_eval {url_encode(params_hash)}
105
+ @capability.instance_eval {url_encode(params_hash)}
106
106
  token = @capability.generate
107
107
  decoded = JWT.decode token, 'myAuthToken'
108
108
  scopes = queries(decoded['scope'])
@@ -122,7 +122,7 @@ describe Twilio::Util::Capability do
122
122
  @capability.allow_client_incoming 'andrew'
123
123
  app_params = @capability.instance_eval {url_encode(app_params_hash)}
124
124
  params_hash = {'appSid' => 'myAppSid', 'appParams' => app_params, 'clientName' => 'andrew'}
125
- params = @capability.instance_eval {url_encode(params_hash)}
125
+ @capability.instance_eval {url_encode(params_hash)}
126
126
  token = @capability.generate
127
127
  decoded = JWT.decode token, 'myAuthToken'
128
128
  scopes = queries(decoded['scope'])
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Twilio::Util do
4
+ include Twilio::Util
5
+
6
+ it 'should parse a Date object' do
7
+ today = Time.now
8
+ url = url_encode({'DateSent>' => today})
9
+
10
+ url.should == "DateSent%3E=#{today.strftime('%Y-%m-%d')}"
11
+ end
12
+ end
@@ -20,6 +20,8 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency('builder', '>= 2.1.2')
21
21
  s.add_dependency('jwt', '>= 0.1.2')
22
22
  s.add_dependency('jruby-openssl') if RUBY_PLATFORM == 'java'
23
+ # Workaround for RBX <= 2.2.1, should be fixed in next version
24
+ s.add_dependency('rubysl') if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
23
25
 
24
26
  s.add_development_dependency 'rake', '~> 0.9.0'
25
27
  s.add_development_dependency 'rspec', '~> 2.6.0'
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilio-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.4
4
+ version: 3.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Benton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-21 00:00:00.000000000 Z
11
+ date: 2014-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.1.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.1.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: jwt
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.1.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.1.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.9.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.9.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 2.6.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 2.6.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: fakeweb
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 1.3.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.3.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rack
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: 1.3.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 1.3.0
111
111
  description: A simple library for communicating with the Twilio REST API, building
@@ -117,8 +117,8 @@ extra_rdoc_files:
117
117
  - README.md
118
118
  - LICENSE
119
119
  files:
120
- - .gitignore
121
- - .travis.yml
120
+ - ".gitignore"
121
+ - ".travis.yml"
122
122
  - AUTHORS.md
123
123
  - CHANGES
124
124
  - Gemfile
@@ -215,7 +215,6 @@ files:
215
215
  - lib/twilio-ruby/util/capability.rb
216
216
  - lib/twilio-ruby/util/request_validator.rb
217
217
  - lib/twilio-ruby/version.rb
218
- - pull.txt
219
218
  - spec/rest/account_spec.rb
220
219
  - spec/rest/call_spec.rb
221
220
  - spec/rest/client_spec.rb
@@ -228,6 +227,7 @@ files:
228
227
  - spec/spec_helper.rb
229
228
  - spec/util/capability_spec.rb
230
229
  - spec/util/request_validator_spec.rb
230
+ - spec/util/url_encode_spec.rb
231
231
  - twilio-ruby.gemspec
232
232
  homepage: http://github.com/twilio/twilio-ruby
233
233
  licenses:
@@ -235,27 +235,27 @@ licenses:
235
235
  metadata: {}
236
236
  post_install_message:
237
237
  rdoc_options:
238
- - --line-numbers
239
- - --inline-source
240
- - --title
238
+ - "--line-numbers"
239
+ - "--inline-source"
240
+ - "--title"
241
241
  - twilio-ruby
242
- - --main
242
+ - "--main"
243
243
  - README.md
244
244
  require_paths:
245
245
  - lib
246
246
  required_ruby_version: !ruby/object:Gem::Requirement
247
247
  requirements:
248
- - - '>='
248
+ - - ">="
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
251
  required_rubygems_version: !ruby/object:Gem::Requirement
252
252
  requirements:
253
- - - '>='
253
+ - - ">="
254
254
  - !ruby/object:Gem::Version
255
255
  version: '0'
256
256
  requirements: []
257
257
  rubyforge_project:
258
- rubygems_version: 2.1.4
258
+ rubygems_version: 2.2.1
259
259
  signing_key:
260
260
  specification_version: 4
261
261
  summary: A simple library for communicating with the Twilio REST API, building TwiML,
@@ -273,3 +273,4 @@ test_files:
273
273
  - spec/spec_helper.rb
274
274
  - spec/util/capability_spec.rb
275
275
  - spec/util/request_validator_spec.rb
276
+ - spec/util/url_encode_spec.rb
data/pull.txt DELETED
@@ -1,21 +0,0 @@
1
- This pull moves the /SMS endpoints into their own `SMS` module. This allows both of the `Message` classes to coexist, since one is in its own namespace, so I was able to bring back the class living at `sms.messages`. This means `@client.account.sms.messages` will once again make requests to the `/SMS/Messages` endpoint. This change re-enables Test Credentials for the `sms.messages` class.
2
-
3
- This required a change to both `instance_resource.rb` and `list_resource.rb` because both were relying on the assumption that all classes live in the Twilio::REST module.
4
-
5
- To use the new submodule functionality, just set the `@submodule` variable to the name of the new submodule on the class declaring the subresources. Here is how it was done for `/SMS/Messages`.
6
-
7
- ```ruby
8
- module Twilio
9
- module REST
10
- class Sms < InstanceResource
11
- def initialize(path, client, params={})
12
- super
13
- @submodule = :SMS
14
- resource :messages, :short_codes
15
- end
16
- end
17
- end
18
- end
19
- ```
20
-
21
- @labcoder @carlosdp @alexcchan