update oauth endpoints to 1.1 paths

This commit is contained in:
stve 2015-10-06 23:24:54 -04:00
parent 0b2e842dcf
commit ef7d4458d0
2 changed files with 4 additions and 4 deletions

View file

@ -7,7 +7,7 @@ module Instapaper
module OAuth
# Gets an OAuth access token for a user.
def access_token(username, password)
response = perform_post_with_unparsed_response('/api/1/oauth/access_token', x_auth_username: username, x_auth_password: password, x_auth_mode: 'client_auth')
response = perform_post_with_unparsed_response('/api/1.1/oauth/access_token', x_auth_username: username, x_auth_password: password, x_auth_mode: 'client_auth')
parsed_response = QLineParser.parse(response)
fail Instapaper::Error::OAuthError, parsed_response['error'] if parsed_response.key?('error')
Instapaper::Credentials.new(parsed_response)

View file

@ -5,15 +5,15 @@ describe Instapaper::Client::OAuth do
describe '#token' do
before do
stub_post('/api/1/oauth/access_token').with(body: {x_auth_username: 'ohai', x_auth_password: 'p455w0rd', x_auth_mode: 'client_auth'})
stub_post('/api/1.1/oauth/access_token').with(body: {x_auth_username: 'ohai', x_auth_password: 'p455w0rd', x_auth_mode: 'client_auth'})
.to_return(body: fixture('access_token.txt'), headers: {content_type: 'text/plain; charset=utf-8'})
stub_post('/api/1/oauth/access_token').with(body: {x_auth_username: 'inval1d', x_auth_password: 'cr3dentials', x_auth_mode: 'client_auth'})
stub_post('/api/1.1/oauth/access_token').with(body: {x_auth_username: 'inval1d', x_auth_password: 'cr3dentials', x_auth_mode: 'client_auth'})
.to_return(body: fixture('invalid_credentials.txt'), headers: {content_type: 'text/plain; charset=utf-8'})
end
it 'gets the correct resource' do
client.access_token('ohai', 'p455w0rd')
expect(a_post('/api/1/oauth/access_token'))
expect(a_post('/api/1.1/oauth/access_token'))
.to have_been_made
end