Skip to content
Open
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
17 changes: 14 additions & 3 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,28 @@ jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version: ['2.6', '2.7']
ruby-version: ['3.2', '3.1', '3.0', '2.7', '2.6']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rake

rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
bundler-cache: true
- name: Rubocop
run: bundle exec rubocop
run: bundle exec rubocop
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
require:
- rubocop-performance

inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.6
Exclude:
- '*.gemspec'
- 'Gemfile*'
Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source 'https://rubygems.org'
gemspec

group :test do
gem 'rubocop', '~> 0.52.1', require: false
gem 'rubocop', '~> 1.0', require: false
gem 'rubocop-performance', require: false
gem 'awesome_print', require: 'ap'
end
6 changes: 3 additions & 3 deletions lib/fhir_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
FHIR.logger.level = Logger::INFO

root = File.expand_path '.', File.dirname(File.absolute_path(__FILE__))
Dir.glob(File.join(root, 'fhir_client', 'sections', '**', '*.rb')).each do |file|
Dir.glob(File.join(root, 'fhir_client', 'sections', '**', '*.rb')).sort.each do |file|
require file
end
Dir.glob(File.join(root, 'fhir_client', 'ext', '**', '*.rb')).each do |file|
Dir.glob(File.join(root, 'fhir_client', 'ext', '**', '*.rb')).sort.each do |file|
require file
end

Expand All @@ -25,6 +25,6 @@
require_relative 'fhir_client/client_exception'
require_relative 'fhir_client/version'

Dir.glob(File.join(root, 'fhir_client', 'model', '**', '*.rb')).each do |file|
Dir.glob(File.join(root, 'fhir_client', 'model', '**', '*.rb')).sort.each do |file|
require file
end
10 changes: 5 additions & 5 deletions lib/fhir_client/ext/bundle.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
module FHIR
module BundleExtras
def self_link
link.select { |n| n.relation == 'self' }.first
link.find { |n| n.relation == 'self' }
end

def first_link
link.select { |n| n.relation == 'first' }.first
link.find { |n| n.relation == 'first' }
end

def last_link
link.select { |n| n.relation == 'last' }.first
link.find { |n| n.relation == 'last' }
end

def next_link
link.select { |n| n.relation == 'next' }.first
link.find { |n| n.relation == 'next' }
end

def previous_link
link.select { |n| n.relation == 'previous' || n.relation == 'prev' }.first
link.find { |n| n.relation == 'previous' || n.relation == 'prev' }
end

def get_by_id(id)
Expand Down