From 1ceb9ab31c0ca4bb68d72153bbf33322b64723ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 20:22:59 +0000 Subject: [PATCH 1/3] build(deps): bump the gh group with 2 updates Bumps the gh group with 2 updates: [docker/login-action](https://github.com/docker/login-action) and [docker/build-push-action](https://github.com/docker/build-push-action). Updates `docker/login-action` from 2 to 3 - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v2...v3) Updates `docker/build-push-action` from 4 to 5 - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v4...v5) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: gh - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: gh ... Signed-off-by: dependabot[bot] --- .github/workflows/deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index caa17e7..9cc2a54 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -15,12 +15,12 @@ jobs: - uses: actions/checkout@v4 - run: echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY}:$(git log -1 --pretty=%ad --date=format:%Y-%m-%d)-$(git log --pretty=format:'%h' -n 1)" >> $GITHUB_ENV - run: docker build -t $IMAGE . - - uses: docker/login-action@v2 + - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/build-push-action@v4 + - uses: docker/build-push-action@v5 with: push: true tags: ${{ env.IMAGE }} From 0ec46f83a33c32d77c635bd53267b5435356501d Mon Sep 17 00:00:00 2001 From: Kyrre Havik Date: Fri, 22 Sep 2023 09:28:50 +0200 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20bruk=20lokal=20fil=20hvis=20milj?= =?UTF-8?q?=C3=B8variabel=20mangler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/g.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/g.rb b/lib/g.rb index 452e5f8..20e31a0 100644 --- a/lib/g.rb +++ b/lib/g.rb @@ -4,7 +4,7 @@ require 'json' module Grunnbeløp - @grunnbeløp_data = JSON.parse(File.read(ENV.fetch('GRUNNBELOP', nil)), object_class: Hash) + @grunnbeløp_data = JSON.parse(File.read(ENV.fetch('GRUNNBELOP', './grunnbeløp.json')), object_class: Hash) @date_format = '%Y-%m-%d' def self.by_date(needle) From b846e181657ede5b27c57972db229683ae4e3ba6 Mon Sep 17 00:00:00 2001 From: Kyrre Havik Date: Fri, 22 Sep 2023 09:29:23 +0200 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20st=C3=B8tte=20for=20norsk=20talem?= =?UTF-8?q?=C3=A5te?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dette er egentlig for å unngå feilen vi får i #47. --- lib/api.rb | 4 ++-- test/test_api.rb | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/api.rb b/lib/api.rb index fdb2cdd..905732e 100644 --- a/lib/api.rb +++ b/lib/api.rb @@ -45,7 +45,7 @@ class G < Grape::API helpers do params :grunnbeløp do - optional :dato, type: Date, coerce_with: DateTime.method(:iso8601) + optional :dato, type: Date end def logger @@ -85,7 +85,7 @@ def logger detail 'Man kan få historikk fra en spesifikk dato ved å spesifisere ?fra=' end params do - optional :fra, type: Date, coerce_with: DateTime.method(:iso8601) + optional :fra, type: Date end get :historikk do fra = params[:fra] diff --git a/test/test_api.rb b/test/test_api.rb index e96a5f7..fcc5520 100644 --- a/test/test_api.rb +++ b/test/test_api.rb @@ -31,10 +31,12 @@ def app JSON.parse(last_response.body)) end - it 'returnere feilkode ved ugyldige datoer' do + it 'vi støtter norsk talemål å skrive dato på' do get '/api/v1/grunnbeloep?dato=24-08-2010' - assert_equal 400, last_response.status - assert_equal 'dato is invalid', JSON.parse(last_response.body)['error'] + assert last_response.ok? + assert_equal({ 'dato' => '1996-05-01', 'grunnbeloep' => 41_000, 'grunnbeloepPerMaaned' => 3_417, + 'gjennomsnittPerAar' => 40_410, 'omregningsfaktor' => 1.045119 }, + JSON.parse(last_response.body)) end it 'returnerer all historikk for grunnbeløp' do