dina 2.3.0.0 → 3.0.0.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/models/agent/identifier.rb +1 -1
- data/lib/dina/models/agent/organization.rb +6 -6
- data/lib/dina/models/attachment.rb +4 -4
- data/lib/dina/models/base_model.rb +7 -1
- data/lib/dina/models/material_sample/collecting_event.rb +2 -2
- data/lib/dina/models/material_sample/collection.rb +2 -2
- data/lib/dina/models/material_sample/collection_method.rb +0 -2
- data/lib/dina/models/material_sample/material_sample.rb +7 -7
- data/lib/dina/models/object_store/derivative.rb +2 -2
- data/lib/dina/models/object_store/file.rb +3 -3
- data/lib/dina/models/object_store/file_connection.rb +3 -2
- data/lib/dina/models/object_store/object_store.rb +2 -2
- data/lib/dina/models/sequence/pcr_primer.rb +1 -1
- data/lib/dina/models/storage/storage_unit.rb +1 -1
- data/lib/dina/search/search.rb +0 -1
- data/lib/dina/search/search_autocomplete.rb +0 -1
- data/lib/dina/search/search_connection.rb +2 -2
- data/lib/dina/search/search_count.rb +0 -1
- data/lib/dina/search/search_mapping.rb +0 -1
- data/lib/dina/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3174b82c140553bb33e4c0e2e51045aeb2348cf45641b5e16e9985f10e7bbe78
|
4
|
+
data.tar.gz: 665cfdca10f68aeb174b6b9e2d9a8b8d82eee62f46c2b566d1536325ec39dd1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c766bb416f305c286121edcdcef8bc36eaa2e0b25c8070a9aa48f59cca9ee95f671ab731ef566718c4980714cb813672b20c20f56db3229d082809acad5f32b
|
7
|
+
data.tar.gz: e109627e4b8b7e95e660db7fd469d89c29a9ec428973921144c2bccb2bae1ca3358a0ca586c3af082192261b388f249799e262f52bdf6f00b1008756d2fe4ec6
|
@@ -8,7 +8,7 @@ module Dina
|
|
8
8
|
property :createdBy, type: :string
|
9
9
|
property :createdOn, type: :time
|
10
10
|
|
11
|
-
belongs_to :person,
|
11
|
+
belongs_to :person, class_name: "Person", shallow_path: true
|
12
12
|
|
13
13
|
validates_presence_of :namespace, message: "namespace is required"
|
14
14
|
validates_presence_of :value, message: "value is required"
|
@@ -8,8 +8,8 @@ module Dina
|
|
8
8
|
property :createdBy, type: :string
|
9
9
|
property :createdOn, type: :time
|
10
10
|
|
11
|
-
validates :
|
12
|
-
validates :
|
11
|
+
validates :englishName, presence: true, on: :create
|
12
|
+
validates :frenchName, presence: true, on: :create
|
13
13
|
|
14
14
|
def self.endpoint_path
|
15
15
|
"agent-api/"
|
@@ -19,21 +19,21 @@ module Dina
|
|
19
19
|
"organization"
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def englishName=(name)
|
23
23
|
names.delete_if{|o| o[:languageCode] == "EN"}
|
24
24
|
names << { languageCode: "EN", name: name }
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def englishName
|
28
28
|
names.select{|o| o[:languageCode] == "EN"}.first[:name]
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
31
|
+
def frenchName=(name)
|
32
32
|
names.delete_if{|o| o[:languageCode] == "FR"}
|
33
33
|
names << { languageCode: "FR", name: name }
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def frenchName
|
37
37
|
names.select{|o| o[:languageCode] == "FR"}.first[:name]
|
38
38
|
end
|
39
39
|
|
@@ -4,10 +4,10 @@ module Dina
|
|
4
4
|
class Attachment < BaseModel
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid_v7
|
6
6
|
|
7
|
-
belongs_to :
|
8
|
-
belongs_to :
|
9
|
-
belongs_to :project,
|
10
|
-
belongs_to :transaction,
|
7
|
+
belongs_to :materialSample, class_name: "MaterialSample", shallow_path: true
|
8
|
+
belongs_to :collectingEvent, class_name: "CollectingEvent", shallow_path: true
|
9
|
+
belongs_to :project, class_name: "Project", shallow_path: true
|
10
|
+
belongs_to :transaction, class_name: "Transaction", shallow_path: true
|
11
11
|
|
12
12
|
def self.endpoint_path
|
13
13
|
"collection-api/"
|
@@ -4,9 +4,15 @@ module Dina
|
|
4
4
|
|
5
5
|
self.raise_on_blank_find_param = true
|
6
6
|
self.add_defaults_to_changes = true
|
7
|
-
self.json_key_format = :camelized_key
|
8
7
|
self.paginator = JsonApiClient::Paginating::NestedParamPaginator
|
9
8
|
|
9
|
+
resolve_custom_type "collection-method", "Dina::CollectionMethod"
|
10
|
+
resolve_custom_type "collecting-event", "Dina::CollectingEvent"
|
11
|
+
resolve_custom_type "preparation-type", "Dina::PreparationType"
|
12
|
+
resolve_custom_type "preparation-method", "Dina::PreparationMethod"
|
13
|
+
resolve_custom_type "material-sample", "Dina::MaterialSample"
|
14
|
+
resolve_custom_type "storage-unit", "Dina::StorageUnit"
|
15
|
+
|
10
16
|
before_create :on_before_create
|
11
17
|
before_save :on_before_save
|
12
18
|
|
@@ -43,11 +43,11 @@ module Dina
|
|
43
43
|
property :createdBy, type: :string
|
44
44
|
property :createdOn, type: :time
|
45
45
|
|
46
|
+
has_one :protocol, class_name: "Protocol"
|
47
|
+
has_one :collectionMethod, class_name: "CollectionMethod"
|
46
48
|
has_many :collectors, class_name: "Person"
|
47
49
|
has_many :attachment, class_name: "Attachment"
|
48
50
|
|
49
|
-
has_one :collection_method, class_name: "CollectionMethod"
|
50
|
-
|
51
51
|
validates_presence_of :group, message: "group is required"
|
52
52
|
|
53
53
|
before_save :on_before_save
|
@@ -15,8 +15,8 @@ module Dina
|
|
15
15
|
property :createdBy, type: :string
|
16
16
|
property :createdOn, type: :time
|
17
17
|
|
18
|
-
belongs_to :institution,
|
19
|
-
has_one :
|
18
|
+
belongs_to :institution, class_name: "Institution", shallow_path: true
|
19
|
+
has_one :parentCollection, class_name: "Collection"
|
20
20
|
|
21
21
|
validates_presence_of :group, message: "group is required"
|
22
22
|
|
@@ -41,13 +41,13 @@ module Dina
|
|
41
41
|
property :allowDuplicateName, type: :boolean
|
42
42
|
|
43
43
|
has_one :collection, class_name: "Collection"
|
44
|
-
has_one :
|
45
|
-
has_one :
|
46
|
-
has_one :
|
47
|
-
has_one :
|
48
|
-
has_one :
|
49
|
-
has_one :
|
50
|
-
has_many :
|
44
|
+
has_one :collectingEvent, class_name: "CollectingEvent"
|
45
|
+
has_one :preparationType, class_name: "PreparationType"
|
46
|
+
has_one :preparationMethod, class_name: "PreparationMethod"
|
47
|
+
has_one :parentMaterialSample, class_name: "MaterialSample"
|
48
|
+
has_one :preparationProtocol, class_name: "Protocol"
|
49
|
+
has_one :storageUnit, class_name: "StorageUnit"
|
50
|
+
has_many :preparedBy, class_name: "Person"
|
51
51
|
has_many :attachment, class_name: "Attachment"
|
52
52
|
has_many :projects, class_name: "Project"
|
53
53
|
has_many :assemblages, class_name: "Assemblage"
|
@@ -13,7 +13,7 @@ module Dina
|
|
13
13
|
property :derivativeType, type: :string
|
14
14
|
property :publiclyReleasable, type: :boolean, default: true
|
15
15
|
|
16
|
-
has_one :
|
16
|
+
has_one :acDerivedFrom, class_name: "ObjectStore"
|
17
17
|
|
18
18
|
validates_presence_of :bucket, message: "bucket is required"
|
19
19
|
validates_presence_of :dcFormat, message: "dcFormat is required"
|
@@ -33,7 +33,7 @@ module Dina
|
|
33
33
|
|
34
34
|
def on_before_save
|
35
35
|
if self.as_json_api["relationships"].nil? || !self.as_json_api["relationships"].has_key?("acDerivedFrom")
|
36
|
-
raise ObjectInvalid, "#{self.class} is invalid.
|
36
|
+
raise ObjectInvalid, "#{self.class} is invalid. acDerivedFrom relationship is required"
|
37
37
|
end
|
38
38
|
super
|
39
39
|
end
|
@@ -4,14 +4,14 @@ require_rel 'file_connection'
|
|
4
4
|
module Dina
|
5
5
|
|
6
6
|
class File < BaseModel
|
7
|
+
self.connection_class = FileConnection
|
8
|
+
|
7
9
|
property :id, type: :string, default: SecureRandom.uuid_v7
|
8
10
|
property :group, type: :string
|
9
11
|
property :filePath, type: :string
|
10
12
|
property :fileName, type: :string
|
11
13
|
property :dcFormat, type: :string
|
12
|
-
property :
|
13
|
-
|
14
|
-
self.connection_class = FileConnection
|
14
|
+
property :isDerivative, type: :boolean
|
15
15
|
|
16
16
|
validates_presence_of :group, message: "group is required"
|
17
17
|
validates_presence_of :filePath, message: "filePath is required"
|
@@ -10,6 +10,7 @@ module Dina
|
|
10
10
|
|
11
11
|
@faraday = Faraday.new(site, connection_options) do |builder|
|
12
12
|
builder.request :multipart
|
13
|
+
builder.response :json
|
13
14
|
builder.adapter(*adapter_options)
|
14
15
|
end
|
15
16
|
yield(self) if block_given?
|
@@ -17,7 +18,7 @@ module Dina
|
|
17
18
|
|
18
19
|
def run(request_method, path, params: nil, headers: {}, body: nil)
|
19
20
|
path = path + "/#{body[:data]["attributes"]["group"].downcase}"
|
20
|
-
if body[:data]["attributes"].key?("
|
21
|
+
if body[:data]["attributes"].key?("isDerivative")
|
21
22
|
path = path + "/derivative"
|
22
23
|
end
|
23
24
|
file_path = body[:data]["attributes"]["filePath"]
|
@@ -33,7 +34,7 @@ module Dina
|
|
33
34
|
response = @faraday.run_request(request_method, path, body, headers) do |request|
|
34
35
|
request.params.update(params) if params
|
35
36
|
end
|
36
|
-
attributes =
|
37
|
+
attributes = response.body.dup
|
37
38
|
response.body["meta"] = {}
|
38
39
|
response.body["errors"] = []
|
39
40
|
response.body["data"] = {
|
@@ -29,8 +29,8 @@ module Dina
|
|
29
29
|
property :orientation, type: :integer
|
30
30
|
property :resourceExternalURL, type: :string
|
31
31
|
|
32
|
-
has_one :
|
33
|
-
has_one :
|
32
|
+
has_one :acMetadataCreator, class_name: "Person"
|
33
|
+
has_one :dcCreator, class_name: "Person"
|
34
34
|
has_many :derivatives, class_name: "Derivative"
|
35
35
|
|
36
36
|
validates_presence_of :group, message: "group is required"
|
@@ -30,7 +30,7 @@ module Dina
|
|
30
30
|
property :createdBy, type: :string
|
31
31
|
property :createdOn, type: :time
|
32
32
|
|
33
|
-
has_one :region
|
33
|
+
has_one :region, class_name: "Region"
|
34
34
|
|
35
35
|
validates_presence_of :group, message: "group is required"
|
36
36
|
validates_presence_of :name, message: "name is required"
|
@@ -11,7 +11,7 @@ module Dina
|
|
11
11
|
property :createdBy, type: :string
|
12
12
|
property :createdOn, type: :time
|
13
13
|
|
14
|
-
has_one :storage_unit_type
|
14
|
+
has_one :storage_unit_type, class_name: "StorageUnitType"
|
15
15
|
has_one :parent_storage_unit, class_name: "StorageUnit"
|
16
16
|
|
17
17
|
validates_presence_of :group, message: "group is required"
|
data/lib/dina/search/search.rb
CHANGED
@@ -13,6 +13,7 @@ module Dina
|
|
13
13
|
|
14
14
|
@faraday = Faraday.new(site, connection_options) do |builder|
|
15
15
|
builder.request :json
|
16
|
+
builder.response :json
|
16
17
|
builder.adapter(*adapter_options)
|
17
18
|
end
|
18
19
|
yield(self) if block_given?
|
@@ -47,7 +48,7 @@ module Dina
|
|
47
48
|
request.body = payload
|
48
49
|
end
|
49
50
|
|
50
|
-
attributes =
|
51
|
+
attributes = response.body.dup
|
51
52
|
meta = {}
|
52
53
|
if attributes.has_key?("hits")
|
53
54
|
#TODO: does not work with SearchAutoComplete because response is different from Search
|
@@ -65,7 +66,6 @@ module Dina
|
|
65
66
|
|
66
67
|
def use(middleware, *args, &block)
|
67
68
|
return if faraday.builder.locked?
|
68
|
-
faraday.builder.insert_before(Middleware::ParseJson, middleware, *args, &block)
|
69
69
|
end
|
70
70
|
|
71
71
|
end
|
data/lib/dina/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David P. Shorthouse
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-05-
|
12
|
+
date: 2024-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_api_client
|