Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Allow token_credential_url to be set to a Hash #36

Merged
merged 1 commit into from

2 participants

@manuelmeurer

I fixed the issues from my original PR #31

The same fix as in c3efb8b, but for token_credential_uri. See google/google-api-ruby-client#90

@manuelmeurer manuelmeurer referenced this pull request from a commit in krautcomputing/signet
@manuelmeurer manuelmeurer Allow token_credential_url to be set to a Hash e1c51d1
@sporkmonger sporkmonger merged commit 915b1a8 into google:master

1 check passed

Details default The Travis CI build passed
@manuelmeurer manuelmeurer deleted the krautcomputing:token_credential_uri_as_hash_fixed branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 23, 2014
  1. @manuelmeurer
This page is out of date. Refresh to see the latest.
View
8 lib/signet/oauth_1/client.rb
@@ -186,12 +186,14 @@ def token_credential_uri
##
# Sets the token credential URI for this client.
#
- # @param [Addressable::URI, String, #to_str] new_token_credential_uri
+ # @param [Addressable::URI, Hash, String, #to_str] new_token_credential_uri
# The token credential URI.
def token_credential_uri=(new_token_credential_uri)
if new_token_credential_uri != nil
- new_token_credential_uri =
- Addressable::URI.parse(new_token_credential_uri)
+ new_token_credential_uri = Addressable::URI.send(
+ new_token_credential_uri.kind_of?(Hash) ? :new : :parse,
+ new_token_credential_uri
+ )
@token_credential_uri = new_token_credential_uri
else
@token_credential_uri = nil
View
8 lib/signet/oauth_2/client.rb
@@ -294,12 +294,14 @@ def token_credential_uri
##
# Sets the token credential URI for this client.
#
- # @param [Addressable::URI, String, #to_str] new_token_credential_uri
+ # @param [Addressable::URI, Hash, String, #to_str] new_token_credential_uri
# The token credential URI.
def token_credential_uri=(new_token_credential_uri)
if new_token_credential_uri != nil
- new_token_credential_uri =
- Addressable::URI.parse(new_token_credential_uri)
+ new_token_credential_uri = Addressable::URI.send(
+ new_token_credential_uri.kind_of?(Hash) ? :new : :parse,
+ new_token_credential_uri
+ )
@token_credential_uri = new_token_credential_uri
else
@token_credential_uri = nil
View
7 spec/signet/oauth_1/client_spec.rb
@@ -92,6 +92,13 @@ def merge_body(chunked_body)
@client.token_credential_uri.should === "http://example.com/"
end
+ it 'should allow the token_credential_uri to be set to a Hash' do
+ @client.token_credential_uri = {
+ :scheme => 'http', :host => 'example.com', :path => '/token'
+ }
+ @client.token_credential_uri.to_s.should === 'http://example.com/token'
+ end
+
it 'should allow the token_credential_uri to be set to a URI' do
@client.token_credential_uri =
Addressable::URI.parse("http://example.com/")
View
7 spec/signet/oauth_2/client_spec.rb
@@ -166,6 +166,13 @@
@client.token_credential_uri.should === "https://example.com/token"
end
+ it 'should allow the token_credential_uri to be set to a Hash' do
+ @client.token_credential_uri = {
+ :scheme => 'https', :host => 'example.com', :path => '/token'
+ }
+ @client.token_credential_uri.to_s.should === 'https://example.com/token'
+ end
+
it 'should allow the token_credential_uri to be set to a URI' do
@client.token_credential_uri =
Addressable::URI.parse("https://example.com/token")
Something went wrong with that request. Please try again.