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
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ name: CI

on:
pull_request:
branches: [ '**' ]
branches: ["**"]

permissions:
contents: read

jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
tests:
strategy:
matrix:
ruby: [ '2.6', '2.7', '3.0' ]
ruby: ["3.4", "3.3", "3.2"]

name: Tests - Ruby ${{ matrix.ruby }}
# Set the type of machine to run on
Expand All @@ -19,9 +22,9 @@ jobs:
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
Expand All @@ -42,4 +45,3 @@ jobs:
- name: Run tests
run: |
bundle exec rake test

11 changes: 8 additions & 3 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ name: Lint Code Base
#############################
on:
pull_request:
branches: [ '**' ]
branches: ["**"]

permissions:
contents: read
statuses: write
checks: write

###############
# Set the Job #
Expand All @@ -36,7 +41,7 @@ jobs:
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
Expand All @@ -45,7 +50,7 @@ jobs:
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter@v3
uses: github/super-linter@v7
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
Expand Down
5 changes: 5 additions & 0 deletions .jscpd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"threshold": 2,
"ignore": ["spec/**"],
"reporters": ["threshold"]
}
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