Betterplace-BI
Description
This library transfers BI data from an application to a BIME-server.
Configuration
Via a config/bi.yml
file in YAML like so:
---
production:
update: yes
auth:
username: bi
password: secret
clear: http://localhost:1234/api/v1/all/:id
endpoints:
BI::TestModelValue:
POST: http://localhost:1234/api/v1/tests
DELETE: http://localhost:1234/api/v1/test/:id
bime_dir:
<%= Pathname.pwd.join('../bime') %>
Usage
For every Rails model TestModel
define a class named
BI::TestModelValue
like this:
class BI::TestModelValue
include BI::SharedValue
def self.update_class
::TestModel
end
field type: 'string', db: 'gorm:"type:uuid;primary_key"'
def id
@object.id
end
field type: '*int64', db: 'gorm:"type:bigint"'
def number
10 ** 10
end
field type: '*time.Time', db: # ISO timestamp string, e. g. "2018-11-05T15:40:14.362219+01:00"
def created_at
(@object.created_at)
end
end
Compute the values to be transfered by accessing @object and define GO types and GORM struct tags for these values.
Also include BI::Updater
in TestModel
like so:
class TestModel < ApplicationRecord
include BI::Updater
has_one :dependent
def trigger_dependent_updates
dependent.schedule_bi_update_job(true)
end
end
License
This software is licensed under the Apache 2.0 license.