diff --git a/.rubocop.yml b/.rubocop.yml index 6cca6d2..8b76fd4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,12 +1,15 @@ AllCops: Include: - - './Rakefile' - - 'instapaper.gemspec' - - 'lib/**/*.rb' - - 'spec/**/*.rb' + - "./Rakefile" + - "instapaper.gemspec" + - "lib/**/*.rb" + - "spec/**/*.rb" DisplayCopNames: true NewCops: enable +Gemspec/RequireMFA: + Enabled: false + Metrics/BlockLength: Max: 36 Exclude: @@ -15,7 +18,7 @@ Metrics/BlockLength: Metrics/BlockNesting: Max: 2 -Metrics/LineLength: +Layout/LineLength: AllowURI: true Enabled: false @@ -29,10 +32,10 @@ Metrics/ParameterLists: Style/CollectionMethods: PreferredMethods: - map: 'collect' - reduce: 'inject' - find: 'detect' - find_all: 'select' + map: "collect" + reduce: "inject" + find: "detect" + find_all: "select" Style/Documentation: Enabled: false @@ -53,15 +56,15 @@ Layout/SpaceInsideHashLiteralBraces: EnforcedStyle: no_space Style/TrailingCommaInArguments: - EnforcedStyleForMultiline: 'comma' + EnforcedStyleForMultiline: "comma" Style/TrailingCommaInArrayLiteral: - EnforcedStyleForMultiline: 'comma' + EnforcedStyleForMultiline: "comma" Style/TrailingCommaInHashLiteral: - EnforcedStyleForMultiline: 'comma' + EnforcedStyleForMultiline: "comma" -Style/FileName: +Naming/FileName: Exclude: - Rakefile - Gemfile diff --git a/Gemfile b/Gemfile index 621ba6f..f69d498 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ gem 'jruby-openssl', platforms: :jruby gem 'json', platforms: :mri_19 group :development do + gem 'bundler' gem 'kramdown' end diff --git a/instapaper.gemspec b/instapaper.gemspec index 6c6f97b..671489a 100644 --- a/instapaper.gemspec +++ b/instapaper.gemspec @@ -8,7 +8,6 @@ Gem::Specification.new do |spec| spec.add_dependency 'multi_json', '~> 1' spec.add_dependency 'simple_oauth', '~> 0.3' spec.add_dependency 'virtus', '~> 1' - spec.add_development_dependency 'bundler' spec.author = 'Steve Agalloco' spec.description = "Ruby Client for Instapaper's Full API" spec.email = 'steve.agalloco@gmail.com' @@ -20,4 +19,5 @@ Gem::Specification.new do |spec| spec.required_ruby_version = '>= 2.0.0' spec.summary = 'Ruby Instapaper Client' spec.version = Instapaper::VERSION + spec.metadata['rubygems_mfa_required'] = 'true' end diff --git a/lib/instapaper/api/folders.rb b/lib/instapaper/api/folders.rb index ad4c435..a2dc63a 100644 --- a/lib/instapaper/api/folders.rb +++ b/lib/instapaper/api/folders.rb @@ -18,7 +18,7 @@ def add_folder(title) # Deletes the folder and moves any articles in it to the Archive. # @param folder_id [String] The id of the folder. - def delete_folder(folder_id) + def delete_folder(folder_id) # rubocop:disable Naming/PredicateMethod perform_post_with_unparsed_response('/api/1.1/folders/delete', folder_id: folder_id) true end @@ -27,7 +27,7 @@ def delete_folder(folder_id) # @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']) - def set_order(order = []) # rubocop:disable Naming/AccessorMethodName + def set_order(order = []) perform_post_with_objects('/api/1.1/folders/set_order', {order: order.join(',')}, Instapaper::Folder) end end diff --git a/lib/instapaper/api/highlights.rb b/lib/instapaper/api/highlights.rb index b39e94c..d6e1b5a 100644 --- a/lib/instapaper/api/highlights.rb +++ b/lib/instapaper/api/highlights.rb @@ -24,7 +24,7 @@ def add_highlight(bookmark_id, options = {}) # Delete a highlight # @param highlight_id [String, Integer] # @return [Boolean] - def delete_highlight(highlight_id, options = {}) + def delete_highlight(highlight_id, options = {}) # rubocop:disable Naming/PredicateMethod perform_post_with_unparsed_response("/api/1.1/highlights/#{highlight_id}/delete", options) true end diff --git a/lib/instapaper/bookmark_list.rb b/lib/instapaper/bookmark_list.rb index 777d490..5307a56 100644 --- a/lib/instapaper/bookmark_list.rb +++ b/lib/instapaper/bookmark_list.rb @@ -8,9 +8,9 @@ class BookmarkList values do attribute :user, Instapaper::User - attribute :bookmarks, Array[Instapaper::Bookmark] - attribute :highlights, Array[Instapaper::Highlight] - attribute :delete_ids, Array[Integer] + attribute :bookmarks, [Instapaper::Bookmark] + attribute :highlights, [Instapaper::Highlight] + attribute :delete_ids, [Integer] end def each(&block) diff --git a/lib/instapaper/http/utils.rb b/lib/instapaper/http/utils.rb index 972fa6e..8a19522 100644 --- a/lib/instapaper/http/utils.rb +++ b/lib/instapaper/http/utils.rb @@ -42,7 +42,7 @@ def perform_post_with_object(path, options, klass) # @param klass [Class] def perform_request_with_object(request_method, path, options, klass) response = perform_request(request_method, path, options) - response = response.is_a?(Array) ? response.first : response + response = response.first if response.is_a?(Array) klass.new(coerce_hash(response)) end diff --git a/spec/instapaper/http/response_spec.rb b/spec/instapaper/http/response_spec.rb index 28f5967..d206ae9 100644 --- a/spec/instapaper/http/response_spec.rb +++ b/spec/instapaper/http/response_spec.rb @@ -30,12 +30,15 @@ def parse(_) describe '#valid?' do context 'when http error' do + it 'should be invalid' end context 'when body unparseable' do + it 'should be invalid' end context 'when error in body' do + it 'should be invalid' end end end