From f745e5bc733dc4b4caed8e41a22d2e6f056ecf95 Mon Sep 17 00:00:00 2001 From: stve Date: Tue, 17 Feb 2015 23:32:34 -0500 Subject: [PATCH] configure params should be called oauth_token/secret --- README.md | 6 +++--- lib/instapaper/api/oauth.rb | 2 +- lib/instapaper/client.rb | 6 +++--- lib/instapaper/folder.rb | 2 +- lib/instapaper/highlight.rb | 4 ++-- lib/instapaper/http/headers.rb | 4 ++-- lib/instapaper/user.rb | 10 +++++----- spec/instapaper/api/bookmarks_spec.rb | 2 +- spec/instapaper/api/folders_spec.rb | 2 +- spec/instapaper/api/highlights_spec.rb | 2 +- spec/instapaper/api/oauth_spec.rb | 6 +++--- spec/instapaper/client_spec.rb | 2 +- spec/instapaper/error_spec.rb | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index f9e65b1..1b5954e 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Instapaper is a ruby wrapper for interacting with [Instapaper's Full API](https: ## Usage -This library offers full support for all methods exposed through Instapaper's Full API. Note that Instapaper's API does not support the request-token/authorize workflow. To obtain an access token, use the `token` method. +This library offers full support for all methods exposed through Instapaper's Full API. Note that Instapaper's API does not support the request-token/authorize workflow. To obtain an access token, use the `access_token` method. ## Changes in 1.0.0 @@ -34,8 +34,8 @@ Also new in `1.x` client = Instapaper::Client.new do |client| client.consumer_key = YOUR_CONSUMER_KEY client.consumer_secret = YOUR_CONSUMER_SECRET - client.access_token = YOUR_OAUTH_TOKEN - client.access_token_secret = YOUR_OAUTH_TOKEN_SECRET + client.oauth_token = YOUR_OAUTH_TOKEN + client.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET end ``` diff --git a/lib/instapaper/api/oauth.rb b/lib/instapaper/api/oauth.rb index ec90793..08ff667 100644 --- a/lib/instapaper/api/oauth.rb +++ b/lib/instapaper/api/oauth.rb @@ -5,7 +5,7 @@ module Instapaper # Defines methods related to OAuth module OAuth # Gets an OAuth access token for a user. - def token(username, password) + 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') QLineParser.parse(response) end diff --git a/lib/instapaper/client.rb b/lib/instapaper/client.rb index 0626ae2..a451e86 100644 --- a/lib/instapaper/client.rb +++ b/lib/instapaper/client.rb @@ -8,7 +8,7 @@ module Instapaper include Instapaper::API include Instapaper::HTTP::Utils - attr_accessor :access_token, :access_token_secret, :consumer_key, :consumer_secret, :proxy + attr_accessor :oauth_token, :oauth_token_secret, :consumer_key, :consumer_secret, :proxy attr_writer :user_agent # Initializes a new Client object @@ -34,8 +34,8 @@ module Instapaper { consumer_key: @consumer_key, consumer_secret: @consumer_secret, - access_token: @access_token, - access_token_secret: @access_token_secret, + oauth_token: @oauth_token, + oauth_token_secret: @oauth_token_secret, } end diff --git a/lib/instapaper/folder.rb b/lib/instapaper/folder.rb index 99a61f2..ee1d808 100644 --- a/lib/instapaper/folder.rb +++ b/lib/instapaper/folder.rb @@ -10,6 +10,6 @@ module Instapaper attribute :title, String attribute :sync_to_mobile, String attribute :position, String - end + end end end diff --git a/lib/instapaper/highlight.rb b/lib/instapaper/highlight.rb index 4f363af..28b323c 100644 --- a/lib/instapaper/highlight.rb +++ b/lib/instapaper/highlight.rb @@ -10,7 +10,7 @@ module Instapaper attribute :bookmark_id, String attribute :text, String attribute :position, String - attribute :time, String - end + attribute :time, String + end end end diff --git a/lib/instapaper/http/headers.rb b/lib/instapaper/http/headers.rb index 1f75075..085f680 100644 --- a/lib/instapaper/http/headers.rb +++ b/lib/instapaper/http/headers.rb @@ -33,8 +33,8 @@ module Instapaper { consumer_key: @client.consumer_key, consumer_secret: @client.consumer_secret, - token: @client.access_token, - token_secret: @client.access_token_secret, + token: @client.oauth_token, + token_secret: @client.oauth_token_secret, } else @client.consumer_credentials diff --git a/lib/instapaper/user.rb b/lib/instapaper/user.rb index 3fb9be3..8f1ed67 100644 --- a/lib/instapaper/user.rb +++ b/lib/instapaper/user.rb @@ -5,10 +5,10 @@ module Instapaper include Virtus.value_object values do - attribute :type, String - attribute :user_id, String - attribute :username, String - attribute :subscription_is_active, String - end + attribute :type, String + attribute :user_id, String + attribute :username, String + attribute :subscription_is_active, String + end end end diff --git a/spec/instapaper/api/bookmarks_spec.rb b/spec/instapaper/api/bookmarks_spec.rb index fa85c42..ff1527a 100644 --- a/spec/instapaper/api/bookmarks_spec.rb +++ b/spec/instapaper/api/bookmarks_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Instapaper::Client::Bookmarks do - let(:client) { Instapaper::Client.new(consumer_key: 'CK', consumer_secret: 'CS', access_token: 'OT', access_token_secret: 'OS') } + let(:client) { Instapaper::Client.new(consumer_key: 'CK', consumer_secret: 'CS', oauth_token: 'OT', oauth_token_secret: 'OS') } describe '#bookmarks' do before do diff --git a/spec/instapaper/api/folders_spec.rb b/spec/instapaper/api/folders_spec.rb index a9a0764..2d689c9 100644 --- a/spec/instapaper/api/folders_spec.rb +++ b/spec/instapaper/api/folders_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Instapaper::Client::Folders do - let(:client) { Instapaper::Client.new(consumer_key: 'CK', consumer_secret: 'CS', access_token: 'OT', access_token_secret: 'OS') } + let(:client) { Instapaper::Client.new(consumer_key: 'CK', consumer_secret: 'CS', oauth_token: 'OT', oauth_token_secret: 'OS') } describe '#folders' do before do diff --git a/spec/instapaper/api/highlights_spec.rb b/spec/instapaper/api/highlights_spec.rb index 95acac8..ea31d93 100644 --- a/spec/instapaper/api/highlights_spec.rb +++ b/spec/instapaper/api/highlights_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Instapaper::Client::Highlights do - let(:client) { Instapaper::Client.new(consumer_key: 'CK', consumer_secret: 'CS', access_token: 'OT', access_token_secret: 'OS') } + let(:client) { Instapaper::Client.new(consumer_key: 'CK', consumer_secret: 'CS', oauth_token: 'OT', oauth_token_secret: 'OS') } describe '#highlights' do before do diff --git a/spec/instapaper/api/oauth_spec.rb b/spec/instapaper/api/oauth_spec.rb index 15b899b..0d6098a 100644 --- a/spec/instapaper/api/oauth_spec.rb +++ b/spec/instapaper/api/oauth_spec.rb @@ -12,20 +12,20 @@ describe Instapaper::Client::OAuth do end it 'gets the correct resource' do - client.token('ohai', 'p455w0rd') + client.access_token('ohai', 'p455w0rd') expect(a_post('/api/1/oauth/access_token')) .to have_been_made end it 'returns the a hash containing an oauth token and secret' do - tokens = client.token('ohai', 'p455w0rd') + tokens = client.access_token('ohai', 'p455w0rd') expect(tokens).to be_a Hash expect(tokens.key?('oauth_token')).to be true expect(tokens.key?('oauth_token_secret')).to be true end it 'returns a hash containing the error on invalid credentials' do - tokens = client.token('inval1d', 'cr3dentials') + tokens = client.access_token('inval1d', 'cr3dentials') expect(tokens).to be_a Hash expect(tokens.key?('error')).to be true end diff --git a/spec/instapaper/client_spec.rb b/spec/instapaper/client_spec.rb index de60263..198c32d 100644 --- a/spec/instapaper/client_spec.rb +++ b/spec/instapaper/client_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Instapaper::Client do - let(:client) { Instapaper::Client.new(consumer_key: 'CK', consumer_secret: 'CS', access_token: 'OT', access_token_secret: 'OS') } + let(:client) { Instapaper::Client.new(consumer_key: 'CK', consumer_secret: 'CS', oauth_token: 'OT', oauth_token_secret: 'OS') } describe '#credentials' do it 'returns the credentials as hash' do diff --git a/spec/instapaper/error_spec.rb b/spec/instapaper/error_spec.rb index efa6ea1..d47c27a 100644 --- a/spec/instapaper/error_spec.rb +++ b/spec/instapaper/error_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Instapaper::Error do before do - @client = Instapaper::Client.new(consumer_key: 'CK', consumer_secret: 'CS', access_token: 'AT', access_token_secret: 'AS') + @client = Instapaper::Client.new(consumer_key: 'CK', consumer_secret: 'CS', oauth_token: 'AT', oauth_token_secret: 'AS') end describe '#code' do @@ -26,7 +26,7 @@ describe Instapaper::Error do .to_return(status: status, body: '', headers: {content_type: 'application/json; charset=utf-8'}) end it "raises #{exception}" do - expect { @client.token('foo', 'bar') }.to raise_error(Instapaper::Error) + expect { @client.access_token('foo', 'bar') }.to raise_error(Instapaper::Error) end end end