Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -15,7 +18,7 @@ Metrics/BlockLength:
Metrics/BlockNesting:
Max: 2

Metrics/LineLength:
Layout/LineLength:
AllowURI: true
Enabled: false

Expand All @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gem 'jruby-openssl', platforms: :jruby
gem 'json', platforms: :mri_19

group :development do
gem 'bundler'
gem 'kramdown'
end

Expand Down
2 changes: 1 addition & 1 deletion instapaper.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
4 changes: 2 additions & 2 deletions lib/instapaper/api/folders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/instapaper/api/highlights.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/instapaper/bookmark_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/instapaper/http/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions spec/instapaper/http/response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading