From 9eec49aec4f3d85b7af1e9de87a3cf9eb36686cb Mon Sep 17 00:00:00 2001 From: Runar Ingebrigtsen Date: Fri, 29 May 2026 15:00:48 +0200 Subject: [PATCH] Scaffold fiken gem: gemspec, dev tooling, rubocop, and CI --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ .gitignore | 8 ++++++++ .rspec | 3 +++ .rubocop.yml | 29 +++++++++++++++++++++++++++++ CHANGELOG.md | 5 +++++ Gemfile | 13 +++++++++++++ LICENSE.txt | 21 +++++++++++++++++++++ Rakefile | 9 +++++++++ bin/console | 7 +++++++ bin/setup | 5 +++++ fiken.gemspec | 29 +++++++++++++++++++++++++++++ lib/fiken/version.rb | 5 +++++ 12 files changed, 155 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 .rspec create mode 100644 .rubocop.yml create mode 100644 CHANGELOG.md create mode 100644 Gemfile create mode 100644 LICENSE.txt create mode 100644 Rakefile create mode 100755 bin/console create mode 100755 bin/setup create mode 100644 fiken.gemspec create mode 100644 lib/fiken/version.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..eb9517d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + ruby: ["3.1", "3.2", "3.3"] + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - run: bundle exec rspec + - run: bundle exec rubocop diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd92e1e --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +/.bundle/ +/vendor/bundle/ +/pkg/ +/tmp/ +/coverage/ +*.gem +Gemfile.lock +.rspec_status diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..7a2cc1a --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--require spec_helper +--format documentation +--color diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..6b7aa54 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,29 @@ +AllCops: + TargetRubyVersion: 3.1 + NewCops: enable + SuggestExtensions: false + +Style/Documentation: + Enabled: false + +Style/StringLiterals: + EnforcedStyle: double_quotes + +Metrics/MethodLength: + Max: 20 + +Metrics/BlockLength: + Exclude: + - "spec/**/*" + - "*.gemspec" + +Metrics/AbcSize: + Max: 25 + +Metrics/ParameterLists: + CountKeywordArgs: false + +Naming/PredicateMethod: + AllowedMethods: + - delete + - delete_path diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3325944 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## [Unreleased] + +- Initial work toward a resource-oriented Ruby client for the Fiken API v2. diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..c5004ee --- /dev/null +++ b/Gemfile @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gemspec + +group :development, :test do + gem "rake", "~> 13.0" + gem "rspec", "~> 3.13" + gem "rubocop", "~> 1.60" + gem "vcr", "~> 6.2" + gem "webmock", "~> 3.19" +end diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..e458214 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2026 Runar Ingebrigtsen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..7e3446c --- /dev/null +++ b/Rakefile @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require "rspec/core/rake_task" +require "rubocop/rake_task" + +RSpec::Core::RakeTask.new(:spec) +RuboCop::RakeTask.new + +task default: %i[spec rubocop] diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..1ce81e6 --- /dev/null +++ b/bin/console @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "fiken" +require "irb" + +IRB.start(__FILE__) diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..c75939f --- /dev/null +++ b/bin/setup @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' + +bundle install diff --git a/fiken.gemspec b/fiken.gemspec new file mode 100644 index 0000000..dee9c3f --- /dev/null +++ b/fiken.gemspec @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require_relative "lib/fiken/version" + +Gem::Specification.new do |spec| + spec.name = "fiken" + spec.version = Fiken::VERSION + spec.authors = ["Runar Ingebrigtsen"] + spec.email = ["runar@rin.no"] + + spec.summary = "Ruby client for the Fiken API v2" + spec.description = "A resource-oriented Ruby client for the Fiken accounting API (v2), " \ + "with personal-token and OAuth2 authentication, pagination, and error handling." + spec.homepage = "https://github.com/runari/fiken" + spec.license = "MIT" + spec.required_ruby_version = ">= 3.1" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = spec.homepage + spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md" + spec.metadata["rubygems_mfa_required"] = "true" + + spec.files = Dir["lib/**/*.rb", "README.md", "CHANGELOG.md", "LICENSE.txt"] + spec.require_paths = ["lib"] + + spec.add_dependency "faraday", "~> 2.0" + spec.add_dependency "faraday-multipart", "~> 1.0" + spec.add_dependency "faraday-retry", "~> 2.0" +end diff --git a/lib/fiken/version.rb b/lib/fiken/version.rb new file mode 100644 index 0000000..e3c2622 --- /dev/null +++ b/lib/fiken/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module Fiken + VERSION = "0.1.0" +end