From 3ccc71233e2eb23eb7997d44b0b23844490110a7 Mon Sep 17 00:00:00 2001 From: Alexander Paramonov Date: Mon, 20 May 2013 14:36:20 +0300 Subject: [PATCH] Add option to specify a proxy --- lib/linked_in/helpers/authorization.rb | 3 ++- spec/cases/oauth_spec.rb | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/linked_in/helpers/authorization.rb b/lib/linked_in/helpers/authorization.rb index c691c9e8..29554b6e 100644 --- a/lib/linked_in/helpers/authorization.rb +++ b/lib/linked_in/helpers/authorization.rb @@ -48,7 +48,8 @@ def parse_oauth_options :request_token_url => full_oauth_url_for(:request_token, :api_host), :access_token_url => full_oauth_url_for(:access_token, :api_host), :authorize_url => full_oauth_url_for(:authorize, :auth_host), - :site => @consumer_options[:site] || @consumer_options[:api_host] || DEFAULT_OAUTH_OPTIONS[:api_host] + :site => @consumer_options[:site] || @consumer_options[:api_host] || DEFAULT_OAUTH_OPTIONS[:api_host], + :proxy => @consumer_options.fetch(:proxy, nil) } end diff --git a/spec/cases/oauth_spec.rb b/spec/cases/oauth_spec.rb index 07c7792e..bb9f38eb 100644 --- a/spec/cases/oauth_spec.rb +++ b/spec/cases/oauth_spec.rb @@ -20,6 +20,19 @@ end end + describe "proxy oauth options" do + let(:proxy) { "http://dummy.proxy" } + let(:consumer) do + LinkedIn::Client.new('1234', '1234', { + :proxy => proxy, + }).consumer + end + + it "should send requests though proxy" do + consumer.proxy.should eq proxy + end + end + describe "different api and auth hosts options" do let(:consumer) do LinkedIn::Client.new('1234', '1234', {