dina 3.1.1.0 → 3.1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1d097058a7482fdd3790d63a02f789084c7e3738bf4c1ef9087629eb7e51d0b
4
- data.tar.gz: 388a7c4a2d078f6cf02b00ae7897c5dd5b7368a5fcd3e87923c00131a77cbfe5
3
+ metadata.gz: 5324a63fa700654179acbbe8e7eae34989df24b614a36b60eebada527871062d
4
+ data.tar.gz: a3adbd6fedd3dbf69abac9fbf5687f5b39c851c7a36e0867911d4c8eca3114a1
5
5
  SHA512:
6
- metadata.gz: 002eee0061dc36f6bd91458e5341eb4e492cae8c75b46eb6b77f8c303902a7c845b20f8b8cbb646390b43ffae9cb9a5a5236dc01a89e50eacc84f72405f9a3c2
7
- data.tar.gz: f3becc80ee064e41890976e0937414e381071202dd971aca122b1c1ef5c3b26a82ff75875cd07675e0eb86b9ff3b721c2715e809410aadd175277d66a1049801
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
@@ -1,5 +1,5 @@
1
1
  module Dina
2
- class GeographicSource
2
+ class GeographicPlaceNameSourceDetail
3
3
  attr_accessor :sourceUrl
4
4
  attr_accessor :customGeographicPlace
5
5
  attr_accessor :selectedGeographicPlace
@@ -0,0 +1,24 @@
1
+ module Dina
2
+ class GeographicThesaurus
3
+ attr_accessor :source
4
+ attr_accessor :subjectId
5
+ attr_accessor :preferredTerm
6
+ attr_accessor :preferredParent
7
+ attr_accessor :additionalParents
8
+
9
+ def initialize(params = {})
10
+ params.each do |key, value|
11
+ setter = "#{key}="
12
+ send(setter, value) if respond_to?(setter.to_sym, false)
13
+ end
14
+ end
15
+
16
+ def to_hash
17
+ hash = {}
18
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
19
+ hash.deep_symbolize_keys
20
+ end
21
+
22
+ end
23
+ end
24
+
@@ -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(data_element)
12
- if !data_element.instance_of?(ProtocolDataElement)
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 << data_element.to_hash
15
+ @protocolDataElement << element.to_hash
16
16
  end
17
17
 
18
18
  # Produce a hash with symbolized keys
@@ -15,7 +15,7 @@ module Dina
15
15
  @address = {}
16
16
  end
17
17
 
18
- def add_address(address)
18
+ def add_address(address:)
19
19
  if !address.instance_of?(Address)
20
20
  raise PropertyValueInvalid, "Address must be of type Address."
21
21
  end
@@ -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: {
@@ -36,6 +36,7 @@ module Dina
36
36
  property :tags, type: :array, default: []
37
37
  property :geographicPlaceNameSource, type: :string
38
38
  property :geographicPlaceNameSourceDetail, type: :hash, default: {}
39
+ property :geographicThesaurus, type: :hash
39
40
  property :managedAttributes, type: :hash
40
41
  property :geoReferenceAssertions, type: :array, default: []
41
42
  property :eventGeom, type: :string
@@ -40,7 +40,7 @@ module Dina
40
40
  #
41
41
  # @param code [String] a code
42
42
  # @return object [Object] a Collection object
43
- def self.find_by_code(code)
43
+ def self.find_by_code(code:)
44
44
  where(code: code).all
45
45
  end
46
46
 
@@ -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
@@ -2,7 +2,6 @@ require_rel '../base_model'
2
2
  require_rel 'file_connection'
3
3
 
4
4
  module Dina
5
-
6
5
  class File < BaseModel
7
6
  self.connection_class = FileConnection
8
7
 
@@ -1,50 +1,50 @@
1
1
  require_rel '../base_model'
2
2
 
3
3
  module Dina
4
+ class FileConnection
4
5
 
5
- class FileConnection
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)
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
- 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
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
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
@@ -1,7 +1,6 @@
1
1
  require_rel '../models/base_model'
2
2
 
3
3
  module Dina
4
-
5
4
  class SearchConnection
6
5
 
7
6
  attr_reader :faraday
@@ -69,5 +68,4 @@ module Dina
69
68
  end
70
69
 
71
70
  end
72
-
73
71
  end
data/lib/dina/version.rb CHANGED
@@ -3,7 +3,7 @@ module Dina
3
3
 
4
4
  MAJOR = 3
5
5
  MINOR = 1
6
- PATCH = 1
6
+ PATCH = 3
7
7
  BUILD = 0
8
8
 
9
9
  def self.version
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.1.0
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-09-17 00:00:00.000000000 Z
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
@@ -155,7 +155,8 @@ files:
155
155
  - lib/dina/components/address.rb
156
156
  - lib/dina/components/agent_role.rb
157
157
  - lib/dina/components/determination.rb
158
- - lib/dina/components/geographic_source.rb
158
+ - lib/dina/components/geographic_place_name_source_detail.rb
159
+ - lib/dina/components/geographic_thesaurus.rb
159
160
  - lib/dina/components/georeference_assertion.rb
160
161
  - lib/dina/components/protocol_data.rb
161
162
  - lib/dina/components/protocol_data_element.rb