summaryrefslogtreecommitdiff
path: root/bin/api
diff options
context:
space:
mode:
Diffstat (limited to 'bin/api')
-rwxr-xr-xbin/api5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/api b/bin/api
index e63c7138..83c2726d 100755
--- a/bin/api
+++ b/bin/api
@@ -5,6 +5,7 @@ require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
+ gem "csv", "~> 3.0"
gem "declarative_policy", "~> 1.0"
gem "erb", "~> 4.0"
gem "globalid", "~> 1.0"
@@ -30,7 +31,9 @@ $host = ENV.fetch("HOST", "localhost:#{$port}")
class Entity
class << self
def all
- @items ||= []
+ @items ||= ::CSV.read(File.join(__dir__, "../db/#{self.name.downcase}s.csv"), headers: true).map do |row|
+ new(row.to_h.transform_keys(&:to_sym))
+ end
end
def create!(attributes)