dina 3.1.2.0 → 3.1.3.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/components/agent_role.rb +2 -2
- data/lib/dina/components/determination.rb +1 -1
- data/lib/dina/components/georeference_assertion.rb +1 -1
- data/lib/dina/components/protocol_data.rb +3 -3
- data/lib/dina/components/shipment.rb +1 -1
- data/lib/dina/models/agent/person.rb +2 -2
- data/lib/dina/models/material_sample/collection.rb +1 -1
- data/lib/dina/models/material_sample/organism.rb +1 -0
- data/lib/dina/models/object_store/file.rb +0 -1
- data/lib/dina/models/object_store/file_connection.rb +41 -41
- data/lib/dina/search/search_connection.rb +0 -2
- data/lib/dina/version.rb +1 -1
- 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: 5324a63fa700654179acbbe8e7eae34989df24b614a36b60eebada527871062d
|
4
|
+
data.tar.gz: a3adbd6fedd3dbf69abac9fbf5687f5b39c851c7a36e0867911d4c8eca3114a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7975a2185a52911ea0875c6db3e0b2aa7642b5138376411c67d38800ef20d836eca7a7d420c83b07c870d38de4c7e56a67359daecf05b070f81e628244e4587
|
7
|
+
data.tar.gz: ad2419b9a087f07acd703b469b2befba7c2edc83ac9a22ac239d4f046cc8b06035a1ed63416cb5b09b2671127b82853842d0c3d5e4b18b963d42cac1a7effae9
|
@@ -10,12 +10,12 @@ module Dina
|
|
10
10
|
@roles = []
|
11
11
|
end
|
12
12
|
|
13
|
-
def add_agent(id)
|
13
|
+
def add_agent(id:)
|
14
14
|
raise PropertyValueInvalid, "Agent must be a UUID." if !id.is_uuid?
|
15
15
|
@agent << id
|
16
16
|
end
|
17
17
|
|
18
|
-
def add_role(role)
|
18
|
+
def add_role(role:)
|
19
19
|
@roles << role
|
20
20
|
end
|
21
21
|
|
@@ -53,7 +53,7 @@ module Dina
|
|
53
53
|
# Add a determiner as UUID to the array of determiner
|
54
54
|
#
|
55
55
|
# @param id [String] a UUID for a determiner
|
56
|
-
def add_determiner(id)
|
56
|
+
def add_determiner(id:)
|
57
57
|
raise PropertyValueInvalid, "Determiner must be a UUID." if !id.is_uuid?
|
58
58
|
@determiner << id
|
59
59
|
end
|
@@ -21,7 +21,7 @@ module Dina
|
|
21
21
|
# Add a georeferencedBy as UUID to the array
|
22
22
|
#
|
23
23
|
# @param id [String] a UUID for a georeferencedBy
|
24
|
-
def add_georeferencedBy(id)
|
24
|
+
def add_georeferencedBy(id:)
|
25
25
|
raise PropertyValueInvalid, "georeferencedBy must be a UUID." if !id.is_uuid?
|
26
26
|
@georeferencedBy << id
|
27
27
|
end
|
@@ -8,11 +8,11 @@ module Dina
|
|
8
8
|
@protocolDataElement = []
|
9
9
|
end
|
10
10
|
|
11
|
-
def add_data_element(
|
12
|
-
if !
|
11
|
+
def add_data_element(element:)
|
12
|
+
if !element.instance_of?(ProtocolDataElement)
|
13
13
|
raise PropertyValueInvalid, "Data Element must be a ProtocolDataElement."
|
14
14
|
end
|
15
|
-
@protocolDataElement <<
|
15
|
+
@protocolDataElement << element.to_hash
|
16
16
|
end
|
17
17
|
|
18
18
|
# Produce a hash with symbolized keys
|
@@ -31,7 +31,7 @@ module Dina
|
|
31
31
|
#
|
32
32
|
# @param email [String] an email address
|
33
33
|
# @return array [Array] an array of Person objects
|
34
|
-
def self.find_by_email(email)
|
34
|
+
def self.find_by_email(email:)
|
35
35
|
where("email": email).all
|
36
36
|
end
|
37
37
|
|
@@ -39,7 +39,7 @@ module Dina
|
|
39
39
|
#
|
40
40
|
# @param name [String] any portion of a person's name
|
41
41
|
# @return array [Array] an array of Person objects, ordered by relevance
|
42
|
-
def self.search_by_name(name)
|
42
|
+
def self.search_by_name(name:)
|
43
43
|
payload = {
|
44
44
|
query: {
|
45
45
|
multi_match: {
|
@@ -9,6 +9,7 @@ module Dina
|
|
9
9
|
property :remarks, type: :string
|
10
10
|
property :isTarget, type: :boolean
|
11
11
|
property :managedAttributes, type: :hash
|
12
|
+
property :dwcVernacularName, type: :string
|
12
13
|
property :determination, type: :array, default: []
|
13
14
|
property :createdBy, type: :string
|
14
15
|
property :createdOn, type: :time
|
@@ -1,50 +1,50 @@
|
|
1
1
|
require_rel '../base_model'
|
2
2
|
|
3
3
|
module Dina
|
4
|
+
class FileConnection
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
builder.adapter(*adapter_options)
|
15
|
-
end
|
16
|
-
yield(self) if block_given?
|
6
|
+
def initialize(options = {})
|
7
|
+
site = options.fetch(:site)
|
8
|
+
connection_options = options.slice(:proxy, :ssl, :request, :headers, :params)
|
9
|
+
adapter_options = Array(options.fetch(:adapter, Faraday.default_adapter))
|
10
|
+
|
11
|
+
@faraday = Faraday.new(site, connection_options) do |builder|
|
12
|
+
builder.request :multipart
|
13
|
+
builder.response :json
|
14
|
+
builder.adapter(*adapter_options)
|
17
15
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
response.body["meta"] = {}
|
39
|
-
response.body["errors"] = []
|
40
|
-
response.body["data"] = {
|
41
|
-
"id" => attributes["uuid"],
|
42
|
-
"type" => "file",
|
43
|
-
"relationships" => {},
|
44
|
-
"attributes" => attributes
|
45
|
-
}
|
46
|
-
response
|
16
|
+
yield(self) if block_given?
|
17
|
+
end
|
18
|
+
|
19
|
+
def run(request_method, path, params: nil, headers: {}, body: nil)
|
20
|
+
path = path + "/#{body[:data]["attributes"]["group"].downcase}"
|
21
|
+
if body[:data]["attributes"].key?("isDerivative")
|
22
|
+
path = path + "/derivative"
|
23
|
+
end
|
24
|
+
file_path = body[:data]["attributes"]["filePath"]
|
25
|
+
mime_type = body[:data]["attributes"]["dcFormat"]
|
26
|
+
file_name = body[:data]["attributes"]["fileName"]
|
27
|
+
|
28
|
+
body[:file] = Faraday::Multipart::FilePart.new(
|
29
|
+
file_path,
|
30
|
+
mime_type,
|
31
|
+
file_name
|
32
|
+
)
|
33
|
+
|
34
|
+
response = @faraday.run_request(request_method, path, body, headers) do |request|
|
35
|
+
request.params.update(params) if params
|
47
36
|
end
|
37
|
+
attributes = response.body.dup
|
38
|
+
response.body["meta"] = {}
|
39
|
+
response.body["errors"] = []
|
40
|
+
response.body["data"] = {
|
41
|
+
"id" => attributes["uuid"],
|
42
|
+
"type" => "file",
|
43
|
+
"relationships" => {},
|
44
|
+
"attributes" => attributes
|
45
|
+
}
|
46
|
+
response
|
48
47
|
end
|
49
48
|
|
49
|
+
end
|
50
50
|
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: 3.1.
|
4
|
+
version: 3.1.3.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-
|
12
|
+
date: 2024-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_api_client
|