Skip to content

Commit

Permalink
Update http dependency to ~> 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Jan 19, 2016
1 parent 53587e2 commit eba5114
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/twitter/rest/oauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def token(options = {})
options[:grant_type] ||= 'client_credentials'
url = 'https://api.twitter.com/oauth2/token'
headers = Twitter::Headers.new(self, :post, url, options).request_headers
response = HTTP.with(headers).post(url, form: options)
response = HTTP.headers(headers).post(url, form: options)
response.parse['access_token']
end
alias bearer_token token
Expand Down Expand Up @@ -56,7 +56,7 @@ def reverse_token
options = {x_auth_mode: 'reverse_auth'}
url = 'https://api.twitter.com/oauth/request_token'
auth_header = Twitter::Headers.new(self, :post, url, options).oauth_auth_header.to_s
HTTP.with(authorization: auth_header).post(url, params: options).to_s
HTTP.headers(authorization: auth_header).post(url, params: options).to_s
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/rest/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def initialize(client, request_method, path, options = {})
# @return [Array, Hash]
def perform
options_key = @request_method == :get ? :params : :form
response = http_client.with(@headers).public_send(@request_method, @uri.to_s, options_key => @options)
response = http_client.headers(@headers).public_send(@request_method, @uri.to_s, options_key => @options)
response_body = symbolize_keys!(response.parse)
response_headers = response.headers
fail_or_return_response_body(response.code, response_body, response_headers)
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/streaming/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def before_request(&block)
def request(method, uri, params)
before_request.call
headers = Twitter::Headers.new(self, method, uri, params).request_headers
request = HTTP::Request.new(method, uri + '?' + URI.encode_www_form(params), headers, proxy)
request = HTTP::Request.new(verb: method, uri: uri + '?' + URI.encode_www_form(params), headers: headers, proxy: proxy)
response = Streaming::Response.new do |data|
if item = Streaming::MessageParser.parse(data) # rubocop:disable AssignmentInCondition
yield(item)
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/streaming/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def stream(_, response)
end
it 'requests via the proxy' do
@client.connection = FakeConnection.new(fixture('track_streaming.json'))
expect(HTTP::Request).to receive(:new).with(:get, 'https://stream.twitter.com:443/1.1/statuses/sample.json?', kind_of(Hash), proxy)
expect(HTTP::Request).to receive(:new).with(verb: :get, uri: 'https://stream.twitter.com:443/1.1/statuses/sample.json?', headers: kind_of(Hash), proxy: proxy)
@client.sample {}
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/twitter/streaming/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def <<(data)
let(:uri) { 'https://stream.twitter.com:443/1.1/statuses/sample.json' }
let(:ssl_socket) { double('ssl_socket') }

let(:request) { HTTP::Request.new(method, uri, {}) }
let(:request) { HTTP::Request.new(verb: method, uri: uri) }

it 'requests via the proxy' do
expect(connection.ssl_socket_class).to receive(:new).and_return(ssl_socket)
Expand All @@ -56,7 +56,7 @@ def <<(data)

context 'when using a proxy' do
let(:proxy) { {proxy_address: '127.0.0.1', proxy_port: 3328} }
let(:request) { HTTP::Request.new(method, uri, {}, proxy) }
let(:request) { HTTP::Request.new(verb: method, uri: uri, proxy: proxy) }

it 'requests via the proxy' do
expect(connection).to receive(:new_tcp_socket).with('127.0.0.1', 3328)
Expand Down
2 changes: 1 addition & 1 deletion twitter.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'addressable', '~> 2.3'
spec.add_dependency 'buftok', '~> 0.2.0'
spec.add_dependency 'equalizer', '~> 0.0.11'
spec.add_dependency 'http', '~> 0.9.4'
spec.add_dependency 'http', '~> 1.0'
spec.add_dependency 'http-form_data', '~> 1.0'
spec.add_dependency 'http_parser.rb', '~> 0.6.0'
spec.add_dependency 'memoizable', '~> 0.4.0'
Expand Down

0 comments on commit eba5114

Please sign in to comment.