dina 0.8.9.0 → 0.9.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dina/authentication/authentication.rb +2 -6
- data/lib/dina/casters/date_caster.rb +15 -0
- data/lib/dina/components/address.rb +5 -1
- data/lib/dina/components/protocol_data.rb +26 -0
- data/lib/dina/components/protocol_data_element.rb +22 -0
- data/lib/dina/components/scheduled_action.rb +19 -0
- data/lib/dina/components/shipment.rb +3 -3
- data/lib/dina/models/acquisition_event.rb +2 -2
- data/lib/dina/models/material_sample/material_sample.rb +2 -2
- data/lib/dina/models/material_sample/project.rb +2 -2
- data/lib/dina/models/material_sample/protocol.rb +2 -0
- data/lib/dina/models/transaction/transaction.rb +3 -3
- data/lib/dina/version.rb +2 -2
- data/lib/dina.rb +2 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a7b64f70c92c1d4321c50087c9f2fe9b12ef6460f97f96f5ddd0c5104df9b1f
|
4
|
+
data.tar.gz: 118bdbeb9e1e04df4cf2b127b22f3601d9218e9c7c48ffc7a1e999f08bf11f9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64643210a89650b021eb6aee3d8918aaa266cb506ef001c702c17a0f51b59514f9febca4cc421dfd66cc6d352de3e677712867267946554040717558b2fb7a1e
|
7
|
+
data.tar.gz: 5feadd20765cff3e8728db5d5d9ee53423480d6fffe3dc5c609d3c8995718fba010818b6031e3623a7e34af3b4802eaf97c9f61c17f269253e5f8b03eb31ddb0
|
@@ -53,16 +53,12 @@ module Dina
|
|
53
53
|
Keycloak.auth_server_url = config.authorization_url
|
54
54
|
Keycloak.realm = config.realm
|
55
55
|
|
56
|
-
if ::File.zero?(config.token_store_file)
|
56
|
+
if ::File.zero?(config.token_store_file) || !token.key?(config.server_name.to_sym)
|
57
57
|
write_token(data: empty_token)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
# Gets, sets, and renews a Bearer access token as required
|
62
|
-
# and produces a Header string
|
63
|
-
#
|
64
|
-
# WARNING: this is not likely to be threadsafe unless we do away with @token
|
65
|
-
# and load the token_store_file with every call to header
|
61
|
+
# Gets, sets, and renews a Bearer access token as required and produces a Header string
|
66
62
|
#
|
67
63
|
# @return [String] the Bearer token
|
68
64
|
def header
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Dina
|
2
|
+
class DateCaster
|
3
|
+
def self.cast(value, default)
|
4
|
+
if value.is_a?(String)
|
5
|
+
y, m, d = value.split '-'
|
6
|
+
raise PropertyValueInvalid, "Invalid date" unless Date.valid_date?(y.to_i, m.to_i, d.to_i)
|
7
|
+
Date.parse(value).to_s
|
8
|
+
elsif value.is_a?(Date)
|
9
|
+
value.to_s
|
10
|
+
else
|
11
|
+
default
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -9,7 +9,11 @@ module Dina
|
|
9
9
|
attr_accessor :zipCode
|
10
10
|
attr_accessor :country
|
11
11
|
|
12
|
-
def initialize
|
12
|
+
def initialize(params = {})
|
13
|
+
params.each do |key, value|
|
14
|
+
setter = "#{key}="
|
15
|
+
send(setter, value) if respond_to?(setter.to_sym, false)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
def to_hash
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Dina
|
2
|
+
class ProtocolData
|
3
|
+
attr_accessor :key
|
4
|
+
attr_accessor :vocabularyBased #boolean
|
5
|
+
attr_accessor :protocolDataElement #array
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@protocolDataElement = []
|
9
|
+
end
|
10
|
+
|
11
|
+
def add_data_element(data_element)
|
12
|
+
if !data_element.instance_of?(ProtocolDataElement)
|
13
|
+
raise PropertyValueInvalid, "Data Element must be a ProtocolDataElement."
|
14
|
+
end
|
15
|
+
@protocolDataElement << data_element.to_hash
|
16
|
+
end
|
17
|
+
|
18
|
+
# Produce a hash with symbolized keys
|
19
|
+
def to_hash
|
20
|
+
hash = {}
|
21
|
+
instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
|
22
|
+
hash.deep_symbolize_keys
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Dina
|
2
|
+
class ProtocolDataElement
|
3
|
+
attr_accessor :elementType #string
|
4
|
+
attr_accessor :value #string
|
5
|
+
attr_accessor :vocabularyBased #boolean
|
6
|
+
attr_accessor :unit #string
|
7
|
+
|
8
|
+
def initialize(params = {})
|
9
|
+
params.each do |key, value|
|
10
|
+
setter = "#{key}="
|
11
|
+
send(setter, value) if respond_to?(setter.to_sym, false)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_hash
|
16
|
+
hash = {}
|
17
|
+
instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
|
18
|
+
hash.deep_symbolize_keys
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Dina
|
2
|
+
class ScheduledAction
|
3
|
+
attr_accessor :actionType
|
4
|
+
attr_accessor :date
|
5
|
+
attr_accessor :actionStatus
|
6
|
+
attr_accessor :remarks
|
7
|
+
attr_accessor :assignedTo
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_hash
|
13
|
+
hash = {}
|
14
|
+
instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
|
15
|
+
hash.deep_symbolize_keys
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -16,10 +16,10 @@ module Dina
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def add_address(address)
|
19
|
-
if !address.instance_of?(
|
20
|
-
raise PropertyValueInvalid, "Address must be
|
19
|
+
if !address.instance_of?(Address)
|
20
|
+
raise PropertyValueInvalid, "Address must be of type Address."
|
21
21
|
end
|
22
|
-
@address.merge!(address)
|
22
|
+
@address.merge!(address.to_hash)
|
23
23
|
end
|
24
24
|
|
25
25
|
def to_hash
|
@@ -4,9 +4,9 @@ module Dina
|
|
4
4
|
class AcquisitionEvent < BaseModel
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid
|
6
6
|
property :group, type: :string
|
7
|
-
property :receivedDate, type: :
|
7
|
+
property :receivedDate, type: :date
|
8
8
|
property :receptionRemarks, type: :string
|
9
|
-
property :isolatedOn, type: :
|
9
|
+
property :isolatedOn, type: :date
|
10
10
|
property :isolationRemarks, type: :string
|
11
11
|
property :createdBy, type: :string
|
12
12
|
property :createdOn, type: :time
|
@@ -17,11 +17,11 @@ module Dina
|
|
17
17
|
property :preparationFixative, type: :string
|
18
18
|
property :preparationMaterials, type: :string
|
19
19
|
property :preparationSubstrate, type: :string
|
20
|
-
property :preparationDate, type: :
|
20
|
+
property :preparationDate, type: :date
|
21
21
|
property :preparationRemarks, type: :string
|
22
22
|
property :dwcDegreeOfEstablishment, type: :string
|
23
23
|
property :materialSampleState, type: :string
|
24
|
-
property :stateChangedOn, type: :
|
24
|
+
property :stateChangedOn, type: :date
|
25
25
|
property :stateChangeRemarks, type: :string
|
26
26
|
property :materialSampleRemarks, type: :string
|
27
27
|
property :extensionValues, type: :object
|
@@ -6,8 +6,8 @@ module Dina
|
|
6
6
|
property :group, type: :string
|
7
7
|
property :name, type: :string
|
8
8
|
property :multilingualDescription, type: :multilingual_description
|
9
|
-
property :startDate, type: :
|
10
|
-
property :endDate, type: :
|
9
|
+
property :startDate, type: :date
|
10
|
+
property :endDate, type: :date
|
11
11
|
property :status, type: :string
|
12
12
|
property :createdBy, type: :string
|
13
13
|
property :createdOn, type: :time
|
@@ -5,7 +5,9 @@ module Dina
|
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid
|
6
6
|
property :group, type: :string
|
7
7
|
property :name, type: :string
|
8
|
+
property :protocolType, type: :string
|
8
9
|
property :multilingualDescription, type: :multilingual_description
|
10
|
+
property :protocolData, type: :array
|
9
11
|
property :createdBy, type: :string
|
10
12
|
property :createdOn, type: :time
|
11
13
|
|
@@ -11,9 +11,9 @@ module Dina
|
|
11
11
|
property :otherIdentifiers, type: :array, default: []
|
12
12
|
property :status, type: :string
|
13
13
|
property :purpose, type: :string
|
14
|
-
property :openedDate, type: :
|
15
|
-
property :closedDate, type: :
|
16
|
-
property :dueDate, type: :
|
14
|
+
property :openedDate, type: :date
|
15
|
+
property :closedDate, type: :date
|
16
|
+
property :dueDate, type: :date
|
17
17
|
property :remarks, type: :string
|
18
18
|
property :managedAttributes, type: :object
|
19
19
|
property :agentRoles, type: :array # Each of type Dina::AgentRole
|
data/lib/dina/version.rb
CHANGED
data/lib/dina.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "keycloak"
|
2
2
|
require "json_api_client"
|
3
3
|
require "time"
|
4
|
+
require "date"
|
4
5
|
require "securerandom"
|
5
6
|
require "require_all"
|
6
7
|
require_all File.join(File.dirname(__FILE__), 'dina')
|
@@ -11,6 +12,7 @@ module Dina
|
|
11
12
|
JsonApiClient::Paginating::NestedParamPaginator.per_page_param = "limit"
|
12
13
|
JsonApiClient::Schema.register array: ArrayCaster
|
13
14
|
JsonApiClient::Schema.register object: ObjectCaster
|
15
|
+
JsonApiClient::Schema.register date: DateCaster
|
14
16
|
JsonApiClient::Schema.register multilingual_title: MultilingualTitleCaster
|
15
17
|
JsonApiClient::Schema.register multilingual_description: MultilingualDescriptionCaster
|
16
18
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David P. Shorthouse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_api_client
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- lib/dina.rb
|
146
146
|
- lib/dina/authentication/authentication.rb
|
147
147
|
- lib/dina/casters/array_caster.rb
|
148
|
+
- lib/dina/casters/date_caster.rb
|
148
149
|
- lib/dina/casters/multilingual_description.rb
|
149
150
|
- lib/dina/casters/multilingual_description_caster.rb
|
150
151
|
- lib/dina/casters/multilingual_title.rb
|
@@ -155,6 +156,9 @@ files:
|
|
155
156
|
- lib/dina/components/determination.rb
|
156
157
|
- lib/dina/components/geographic_source.rb
|
157
158
|
- lib/dina/components/georeference_assertion.rb
|
159
|
+
- lib/dina/components/protocol_data.rb
|
160
|
+
- lib/dina/components/protocol_data_element.rb
|
161
|
+
- lib/dina/components/scheduled_action.rb
|
158
162
|
- lib/dina/components/shipment.rb
|
159
163
|
- lib/dina/exceptions.rb
|
160
164
|
- lib/dina/json_api_client_patch.rb
|