Skip to content

Commit 038a3f9

Browse files
dougblackcodejudas
authored andcommitted
Remove holdovers from legacy library (#346)
* Remove holdovers from legacy library * Remove unused/outdated imports * Update tests for Configuration removal * Remove more things * Remove more things
1 parent 8ccdb15 commit 038a3f9

9 files changed

+4
-239
lines changed

lib/rack/twilio_webhook_authentication.rb

Lines changed: 0 additions & 46 deletions
This file was deleted.

lib/twilio-ruby.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@
1010
require 'json'
1111

1212
require 'twilio-ruby/version' unless defined?(Twilio::VERSION)
13-
require 'rack/twilio_webhook_authentication'
1413

1514
require 'twilio-ruby/util'
1615
require 'twilio-ruby/jwt/jwt'
1716
require 'twilio-ruby/jwt/access_token'
1817
require 'twilio-ruby/jwt/client_capability'
1918
require 'twilio-ruby/jwt/task_router'
2019
require 'twilio-ruby/security/request_validator'
21-
require 'twilio-ruby/util/configuration'
2220

2321
require 'twilio-ruby/twiml/twiml'
2422
require 'twilio-ruby/twiml/voice_response'
@@ -42,20 +40,4 @@
4240

4341
module Twilio
4442
extend SingleForwardable
45-
46-
def_delegators :configuration, :account_sid, :auth_token
47-
48-
##
49-
# Pre-configure with account SID and auth token so that you don't need to
50-
# pass them to various initializers each time.
51-
def self.configure(&block)
52-
yield configuration
53-
end
54-
55-
##
56-
# Returns an existing or instantiates a new configuration object.
57-
def self.configuration
58-
@configuration ||= Util::Configuration.new
59-
end
60-
private_class_method :configuration
6143
end

lib/twilio-ruby/rest/client.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class Client
1414
##
1515
# Initializes the Twilio Client
1616
def initialize(username=nil, password=nil, account_sid=nil, region=nil, http_client=Twilio::HTTP::Client.new)
17-
@username = username || Twilio.account_sid
18-
@password = password || Twilio.auth_token
17+
@username = username
18+
@password = password
1919
@region = region
2020
@account_sid = account_sid || @username
2121
@auth_token = @password
@@ -394,4 +394,4 @@ class TaskRouterClient < ObsoleteClient; end
394394
# Dummy client which provides no functionality. Please use Twilio::REST::Client instead.
395395
class TrunkingClient < ObsoleteClient; end
396396
end
397-
end
397+
end

lib/twilio-ruby/security/request_validator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Twilio
22
module Security
33
class RequestValidator
44
def initialize(auth_token = nil)
5-
@auth_token = auth_token || Twilio.auth_token
5+
@auth_token = auth_token
66
raise ArgumentError, 'Auth token is required' if @auth_token.nil?
77
end
88

lib/twilio-ruby/util/configuration.rb

Lines changed: 0 additions & 7 deletions
This file was deleted.

spec/rack/twilio_webhook_authentication_spec.rb

Lines changed: 0 additions & 106 deletions
This file was deleted.

spec/security/request_validator_spec.rb

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,6 @@
11
require 'spec_helper'
22

33
describe Twilio::Security::RequestValidator do
4-
describe 'configuration' do
5-
after(:each) do
6-
Twilio.instance_variable_set('@configuration', nil)
7-
end
8-
9-
it 'should set the auth token from a configuration block' do
10-
Twilio.configure do |config|
11-
config.auth_token = 'someToken'
12-
end
13-
14-
validator = Twilio::Security::RequestValidator.new
15-
expect(validator.instance_variable_get('@auth_token')).to eq('someToken')
16-
end
17-
18-
it 'should overwrite the auth token if passed to initializer' do
19-
Twilio.configure do |config|
20-
config.auth_token = 'someToken'
21-
end
22-
23-
validator = Twilio::Security::RequestValidator.new 'otherToken'
24-
expect(validator.instance_variable_get('@auth_token')).to eq('otherToken')
25-
end
26-
27-
it 'should throw an argument error if the auth token isn\'t set' do
28-
expect { Twilio::Security::RequestValidator.new }.to raise_error(ArgumentError)
29-
end
30-
end
31-
324
describe 'validations' do
335
let(:token) { '2bd9e9638872de601313dc77410d3b23' }
346

spec/twilio_spec.rb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +0,0 @@
1-
describe Twilio do
2-
after(:each) do
3-
Twilio.instance_variable_set('@configuration', nil)
4-
end
5-
6-
it 'should set the account sid and auth token with a config block' do
7-
Twilio.configure do |config|
8-
config.account_sid = 'someSid'
9-
config.auth_token = 'someToken'
10-
end
11-
12-
expect(Twilio.account_sid).to eq('someSid')
13-
expect(Twilio.auth_token).to eq('someToken')
14-
end
15-
end

spec/util/configuration_spec.rb

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)