Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Merge pull request #30 from swiftype/jasonstoltz/pass-user-pass-proxy
Browse files Browse the repository at this point in the history
Passing username and password through for proxies
  • Loading branch information
JasonStoltz authored Oct 18, 2018
2 parents d284523 + 1a0f7b1 commit 62b3b43
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To install the gem, execute:

gem install swiftype

Or place `gem 'swiftype', '~> 1.2.0` in your `Gemfile` and run `bundle install`.
Or place `gem 'swiftype', '~> 1.3.1` in your `Gemfile` and run `bundle install`.

## Usage

Expand Down Expand Up @@ -372,8 +372,8 @@ swiftype-rb 1.0 has been rewritten to be simpler and easier to use. However, it

To upgrade from the old version of swiftype-rb:

* If you previously used the `Swiftype` client, migrate your API calls to the `Swiftype::Client` format.
* If you previously used the `Swiftype::Easy` client, change `Swiftype::Easy` to `Swiftype::Client`. Almost all method calls should be the same (there are a few minor changes).
- If you previously used the `Swiftype` client, migrate your API calls to the `Swiftype::Client` format.
- If you previously used the `Swiftype::Easy` client, change `Swiftype::Easy` to `Swiftype::Client`. Almost all method calls should be the same (there are a few minor changes).

Additionally, the result object returned by search methods (for example, the old Swiftype gem's `Engine#search` or `Swiftype::Easy#search` methods) returns results in a different way. Instead of being an array of `Swiftype::Document` objects, it will be an array of Hashes.

Expand Down
2 changes: 1 addition & 1 deletion lib/swiftype/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def request(method, path, params={})

if proxy
proxy_parts = URI.parse(proxy)
http = Net::HTTP.new(uri.host, uri.port, proxy_parts.host, proxy_parts.port)
http = Net::HTTP.new(uri.host, uri.port, proxy_parts.host, proxy_parts.port, proxy_parts.user, proxy_parts.password)
else
http = Net::HTTP.new(uri.host, uri.port)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/swiftype/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Swiftype
VERSION = "1.3.0"
VERSION = "1.3.1"
end
4 changes: 2 additions & 2 deletions spec/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@
end

context 'with proxy specified' do
let(:options) { { :proxy => 'http://localhost:8888' } }
let(:options) { { :proxy => 'http://username:password@localhost:8888' } }

it 'will set proxy' do
expect(options_client.proxy).to eq('http://localhost:8888')
expect(options_client.proxy).to eq('http://username:password@localhost:8888')
end

# There doesn't seem to be an elgant way to test that a request actually uses a proxy, so the best
Expand Down

0 comments on commit 62b3b43

Please sign in to comment.