From 29e49c1ed77f9eaae3bed165171787f946987283 Mon Sep 17 00:00:00 2001 From: stve Date: Mon, 9 Feb 2015 00:42:31 -0500 Subject: [PATCH] fix more rubocop failures --- lib/instapaper/authentication.rb | 4 +-- lib/instapaper/client/bookmark.rb | 12 ++++---- lib/instapaper/client/folder.rb | 4 +-- lib/instapaper/client/user.rb | 2 +- lib/instapaper/connection.rb | 1 - spec/instapaper/client/account_spec.rb | 2 +- spec/instapaper/client/bookmark_spec.rb | 38 ++++++++++++------------- spec/instapaper/client/folder_spec.rb | 14 ++++----- spec/instapaper/client/user_spec.rb | 8 +++--- spec/instapaper/client_spec.rb | 2 +- 10 files changed, 43 insertions(+), 44 deletions(-) diff --git a/lib/instapaper/authentication.rb b/lib/instapaper/authentication.rb index 65f0399..d9e93c9 100644 --- a/lib/instapaper/authentication.rb +++ b/lib/instapaper/authentication.rb @@ -11,14 +11,14 @@ module Instapaper consumer_key: consumer_key, consumer_secret: consumer_secret, token: oauth_token, - token_secret: oauth_token_secret + token_secret: oauth_token_secret, } end def consumer_tokens { consumer_key: consumer_key, - consumer_secret: consumer_secret + consumer_secret: consumer_secret, } end diff --git a/lib/instapaper/client/bookmark.rb b/lib/instapaper/client/bookmark.rb index 0cdb497..4cc92da 100644 --- a/lib/instapaper/client/bookmark.rb +++ b/lib/instapaper/client/bookmark.rb @@ -2,7 +2,7 @@ module Instapaper class Client # Defines methods related to bookmarks module Bookmark - # Lists the user’s unread bookmarks, and can also synchronize reading positions. + # Lists the user's unread bookmarks, and can also synchronize reading positions. # @option limit: Optional. A number between 1 and 500, default 25. # @option folder_id: Optional. Possible values are unread (default), starred, archive, or a folder_id value from /api/1/folders/list. # @option have: Optional. A concatenation of bookmark_id values that the client already has from the specified folder. See below. @@ -10,7 +10,7 @@ module Instapaper post('bookmarks/list', options)[2..-1] end - # Updates the user’s reading progress on a single article. + # Updates the user's reading progress on a single article. # @param bookmark_id [String] The id of the bookmark to update. # @param progress [Float] The user’s progress, as a floating-point number between 0.0 and 1.0, defined as the top edge of the user’s current viewport, expressed as a percentage of the article’s total length. # @param progress_timestamp [Integer] The Unix timestamp value of the time that the progress was recorded. @@ -18,14 +18,14 @@ module Instapaper post('bookmarks/update_read_progress', bookmark_id: bookmark_id, progress: progress, progress_timestamp: progress_timestamp.to_i).first end - # Adds a new unread bookmark to the user’s account. + # Adds a new unread bookmark to the user's account. # @param url [String] The url of the bookmark. def add_bookmark(url, options = {}) post('bookmarks/add', options.merge(url: url)).first end # Permanently deletes the specified bookmark. - # This is NOT the same as Archive. Please be clear to users if you’re going to do this. + # This is NOT the same as Archive. Please be clear to users if you're going to do this. # @param bookmark_id [String] The id of the bookmark. def delete_bookmark(bookmark_id) post('bookmarks/delete', bookmark_id: bookmark_id) @@ -67,11 +67,11 @@ module Instapaper end alias_method :move_bookmark, :move - # Returns the specified bookmark’s processed text-view HTML, which is + # Returns the specified bookmark's processed text-view HTML, which is # always text/html encoded as UTF-8. # @param bookmark_id [String] The id of the bookmark. def text(bookmark_id) - post('bookmarks/get_text', { bookmark_id: bookmark_id }, true).body + post('bookmarks/get_text', {bookmark_id: bookmark_id}, true).body end alias_method :get_text, :text end diff --git a/lib/instapaper/client/folder.rb b/lib/instapaper/client/folder.rb index ef99036..449d5ff 100644 --- a/lib/instapaper/client/folder.rb +++ b/lib/instapaper/client/folder.rb @@ -2,7 +2,7 @@ module Instapaper class Client # Defines methods related to folders module Folder - # List the account’s user-created folders. + # List the account's user-created folders. # @note This only includes organizational folders and does not include RSS-feed folders or starred-subscription folders def folders post('folders/list') @@ -20,7 +20,7 @@ module Instapaper post('folders/delete', folder_id: folder_id) end - # Re-orders a user’s folders. + # Re-orders a user's folders. # @param order [Array] An array of folder_id:position pairs joined by commas. # @example Ordering folder_ids 100, 200, and 300 # Instapaper.set_order(['100:1','200:2','300:3']) diff --git a/lib/instapaper/client/user.rb b/lib/instapaper/client/user.rb index 879364e..96602dd 100644 --- a/lib/instapaper/client/user.rb +++ b/lib/instapaper/client/user.rb @@ -4,7 +4,7 @@ module Instapaper module User # Gets an OAuth access token for a user. def access_token(username, password) - response = post('oauth/access_token', { x_auth_username: username, x_auth_password: password, x_auth_mode: 'client_auth' }, true) + response = post('oauth/access_token', {x_auth_username: username, x_auth_password: password, x_auth_mode: 'client_auth'}, true) params = response.body.split('&') values = params.map { |part| part.split('=') }.flatten if values.length == 1 diff --git a/lib/instapaper/connection.rb b/lib/instapaper/connection.rb index 0395415..a1f1175 100644 --- a/lib/instapaper/connection.rb +++ b/lib/instapaper/connection.rb @@ -12,7 +12,6 @@ module Instapaper 'User-Agent' => user_agent }, proxy: proxy, - ssl: { verify: false }, url: api_endpoint) Faraday.new(merged_options) do |builder| diff --git a/spec/instapaper/client/account_spec.rb b/spec/instapaper/client/account_spec.rb index 4b1afdb..4286d58 100644 --- a/spec/instapaper/client/account_spec.rb +++ b/spec/instapaper/client/account_spec.rb @@ -8,7 +8,7 @@ describe Instapaper::Client::Account do describe '.verify_credentials' do before do stub_post('account/verify_credentials') - .to_return(body: fixture('verify_credentials.json'), headers: { content_type: 'application/json; charset=utf-8' }) + .to_return(body: fixture('verify_credentials.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do diff --git a/spec/instapaper/client/bookmark_spec.rb b/spec/instapaper/client/bookmark_spec.rb index c62ba88..7999a15 100644 --- a/spec/instapaper/client/bookmark_spec.rb +++ b/spec/instapaper/client/bookmark_spec.rb @@ -8,7 +8,7 @@ describe Instapaper::Client::Bookmark do describe '.bookmarks' do before do stub_post('bookmarks/list') - .to_return(body: fixture('bookmarks_list.json'), headers: { content_type: 'application/json; charset=utf-8' }) + .to_return(body: fixture('bookmarks_list.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do @@ -36,12 +36,12 @@ describe Instapaper::Client::Bookmark do before do @time = Time.now stub_post('bookmarks/update_read_progress') - .to_return(body: fixture('bookmarks_update_read_progress.json'), headers: { content_type: 'application/json; charset=utf-8' }) + .to_return(body: fixture('bookmarks_update_read_progress.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do @client.update_read_progress(123, 0.5, @time) - expect(a_post('bookmarks/update_read_progress').with(body: { bookmark_id: '123', progress: '0.5', progress_timestamp: @time.to_i.to_s })) + expect(a_post('bookmarks/update_read_progress').with(body: {bookmark_id: '123', progress: '0.5', progress_timestamp: @time.to_i.to_s})) .to have_been_made end @@ -56,12 +56,12 @@ describe Instapaper::Client::Bookmark do describe '.add_bookmark' do before do stub_post('bookmarks/add') - .to_return(body: fixture('bookmarks_add.json'), headers: { content_type: 'application/json; charset=utf-8' }) + .to_return(body: fixture('bookmarks_add.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do @client.add_bookmark('http://someurl.com', title: 'This is the title', description: 'This is the description') - expect(a_post('bookmarks/add').with(body: { url: 'http://someurl.com', title: 'This is the title', description: 'This is the description' })) + expect(a_post('bookmarks/add').with(body: {url: 'http://someurl.com', title: 'This is the title', description: 'This is the description'})) .to have_been_made end @@ -75,12 +75,12 @@ describe Instapaper::Client::Bookmark do describe '.delete_bookmark' do before do stub_post('bookmarks/delete') - .to_return(body: '[]', headers: { content_type: 'application/json; charset=utf-8' }) + .to_return(body: '[]', headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do @client.delete_bookmark(123) - expect(a_post('bookmarks/delete').with(body: { bookmark_id: '123' })) + expect(a_post('bookmarks/delete').with(body: {bookmark_id: '123'})) .to have_been_made end @@ -94,12 +94,12 @@ describe Instapaper::Client::Bookmark do describe '.star' do before do stub_post('bookmarks/star') - .to_return(body: fixture('bookmarks_star.json'), headers: { content_type: 'application/json; charset=utf-8' }) + .to_return(body: fixture('bookmarks_star.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do @client.star(123) - expect(a_post('bookmarks/star').with(body: { bookmark_id: '123' })) + expect(a_post('bookmarks/star').with(body: {bookmark_id: '123'})) .to have_been_made end @@ -118,12 +118,12 @@ describe Instapaper::Client::Bookmark do describe '.unstar' do before do stub_post('bookmarks/unstar') - .to_return(body: fixture('bookmarks_unstar.json'), headers: { content_type: 'application/json; charset=utf-8' }) + .to_return(body: fixture('bookmarks_unstar.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do @client.unstar(123) - expect(a_post('bookmarks/unstar').with(body: { bookmark_id: '123' })) + expect(a_post('bookmarks/unstar').with(body: {bookmark_id: '123'})) .to have_been_made end @@ -142,12 +142,12 @@ describe Instapaper::Client::Bookmark do describe '.archive' do before do stub_post('bookmarks/archive') - .to_return(body: fixture('bookmarks_archive.json'), headers: { content_type: 'application/json; charset=utf-8' }) + .to_return(body: fixture('bookmarks_archive.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do @client.archive(123) - expect(a_post('bookmarks/archive').with(body: { bookmark_id: '123' })) + expect(a_post('bookmarks/archive').with(body: {bookmark_id: '123'})) .to have_been_made end @@ -165,12 +165,12 @@ describe Instapaper::Client::Bookmark do describe '.unarchive' do before do stub_post('bookmarks/unarchive') - .to_return(body: fixture('bookmarks_unarchive.json'), headers: { content_type: 'application/json; charset=utf-8' }) + .to_return(body: fixture('bookmarks_unarchive.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do @client.unarchive(123) - expect(a_post('bookmarks/unarchive').with(body: { bookmark_id: '123' })) + expect(a_post('bookmarks/unarchive').with(body: {bookmark_id: '123'})) .to have_been_made end @@ -188,12 +188,12 @@ describe Instapaper::Client::Bookmark do describe '.move' do before do stub_post('bookmarks/move') - .to_return(body: fixture('bookmarks_move.json'), headers: { content_type: 'application/json; charset=utf-8' }) + .to_return(body: fixture('bookmarks_move.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do @client.move(123, 12_345) - expect(a_post('bookmarks/move').with(body: { bookmark_id: '123', folder_id: '12345' })) + expect(a_post('bookmarks/move').with(body: {bookmark_id: '123', folder_id: '12345'})) .to have_been_made end @@ -211,12 +211,12 @@ describe Instapaper::Client::Bookmark do describe '.text' do before do stub_post('bookmarks/get_text') - .to_return(body: fixture('bookmarks_get_text.txt'), headers: { content_type: 'text/html; charset=utf-8' }) + .to_return(body: fixture('bookmarks_get_text.txt'), headers: {content_type: 'text/html; charset=utf-8'}) end it 'should get the correct resource' do @client.text(123) - expect(a_post('bookmarks/get_text').with(body: { bookmark_id: '123' })) + expect(a_post('bookmarks/get_text').with(body: {bookmark_id: '123'})) .to have_been_made end diff --git a/spec/instapaper/client/folder_spec.rb b/spec/instapaper/client/folder_spec.rb index 5674310..f09253e 100644 --- a/spec/instapaper/client/folder_spec.rb +++ b/spec/instapaper/client/folder_spec.rb @@ -8,7 +8,7 @@ describe Instapaper::Client::Folder do describe '.folders' do before do stub_post('folders/list') - .to_return(body: fixture('folders_list.json'), headers: { content_type: 'application/json; charset=utf-8' }) + .to_return(body: fixture('folders_list.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do @@ -28,8 +28,8 @@ describe Instapaper::Client::Folder do describe '.add_folder' do before do - stub_post('folders/add').with(body: { title: 'Ruby' }) - .to_return(body: fixture('folders_add.json'), headers: { content_type: 'application/json; charset=utf-8' }) + stub_post('folders/add').with(body: {title: 'Ruby'}) + .to_return(body: fixture('folders_add.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do @@ -49,8 +49,8 @@ describe Instapaper::Client::Folder do describe '.delete_folder' do before do - stub_post('folders/delete'). with(body: { folder_id: '1' }) - .to_return(body: fixture('folders_delete.json'), headers: { content_type: 'application/json; charset=utf-8' }) + stub_post('folders/delete'). with(body: {folder_id: '1'}) + .to_return(body: fixture('folders_delete.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do @@ -68,8 +68,8 @@ describe Instapaper::Client::Folder do describe '.set_order' do before do - stub_post('folders/set_order'). with(body: { order: '1121173:2,1121174:1' }) - .to_return(body: fixture('folders_set_order.json'), headers: { content_type: 'application/json; charset=utf-8' }) + stub_post('folders/set_order'). with(body: {order: '1121173:2,1121174:1'}) + .to_return(body: fixture('folders_set_order.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'should get the correct resource' do diff --git a/spec/instapaper/client/user_spec.rb b/spec/instapaper/client/user_spec.rb index 08cc049..2b81ecb 100644 --- a/spec/instapaper/client/user_spec.rb +++ b/spec/instapaper/client/user_spec.rb @@ -7,10 +7,10 @@ describe Instapaper::Client::User do describe '.access_token' do before do - stub_post('oauth/access_token').with(body: { x_auth_username: 'ohai', x_auth_password: 'p455w0rd', x_auth_mode: 'client_auth' }) - .to_return(body: fixture('access_token.qline'), headers: { content_type: 'text/plain; charset=utf-8' }) - stub_post('oauth/access_token').with(body: { x_auth_username: 'inval1d', x_auth_password: 'cr3dentials', x_auth_mode: 'client_auth' }) - .to_return(body: fixture('invalid_credentials.qline'), headers: { content_type: 'text/plain; charset=utf-8' }) + stub_post('oauth/access_token').with(body: {x_auth_username: 'ohai', x_auth_password: 'p455w0rd', x_auth_mode: 'client_auth'}) + .to_return(body: fixture('access_token.qline'), headers: {content_type: 'text/plain; charset=utf-8'}) + stub_post('oauth/access_token').with(body: {x_auth_username: 'inval1d', x_auth_password: 'cr3dentials', x_auth_mode: 'client_auth'}) + .to_return(body: fixture('invalid_credentials.qline'), headers: {content_type: 'text/plain; charset=utf-8'}) end it 'should get the correct resource' do diff --git a/spec/instapaper/client_spec.rb b/spec/instapaper/client_spec.rb index 8ea8716..eb456a9 100644 --- a/spec/instapaper/client_spec.rb +++ b/spec/instapaper/client_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Instapaper::Client do before do - @options = { adapter: :em_synchrony, user_agent: 'Instapaper::Client spec' } + @options = {adapter: :em_synchrony, user_agent: 'Instapaper::Client spec'} @keys = Instapaper::Configuration::VALID_OPTIONS_KEYS end