dina 2.2.1.0 → 3.0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5beeb74a613c5715f742969284aa5d1cf6a7c5777151d2af4fcffd3d1c37e3c2
4
- data.tar.gz: f81456dd861d5728a578bf711452ab1192cf528ad8e470eaed040727a30991b3
3
+ metadata.gz: 3174b82c140553bb33e4c0e2e51045aeb2348cf45641b5e16e9985f10e7bbe78
4
+ data.tar.gz: 665cfdca10f68aeb174b6b9e2d9a8b8d82eee62f46c2b566d1536325ec39dd1d
5
5
  SHA512:
6
- metadata.gz: 519009b941db36731617d6b096ce8c39db5f44382fbf12678ae841740e65e3e92b9c4689231a9aca2308e17366f41c6adf633a7e49dafd826ef9dc787f6de29c
7
- data.tar.gz: 867ecf699f70adf80a1a0408aa5437bdda291a08c89013896fbd7b928e9d1ecef6ba57527daf2c43a10d27a0898f36161f36f6e71241ce9ba47a120fadfcd391
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, shallow_path: true, class_name: "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 :english_name, presence: true, on: :create
12
- validates :french_name, presence: true, on: :create
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 english_name=(name)
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 english_name
27
+ def englishName
28
28
  names.select{|o| o[:languageCode] == "EN"}.first[:name]
29
29
  end
30
30
 
31
- def french_name=(name)
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 french_name
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 :material_sample, shallow_path: true, class_name: "MaterialSample"
8
- belongs_to :collecting_event, shallow_path: true, class_name: "CollectingEvent"
9
- belongs_to :project, shallow_path: true, class_name: "Project"
10
- belongs_to :transaction, shallow_path: true, class_name: "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, shallow_path: true, class_name: "Institution"
19
- has_one :parent_collection, class_name: "Collection"
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
 
@@ -9,8 +9,6 @@ module Dina
9
9
  property :createdBy, type: :string
10
10
  property :createdOn, type: :time
11
11
 
12
- belongs_to :collecting_event, class: "CollectingEvent", shallow_path: true
13
-
14
12
  validates_presence_of :group, message: "group is required"
15
13
 
16
14
  def self.endpoint_path
@@ -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 :collecting_event, class_name: "CollectingEvent"
45
- has_one :preparation_type, class_name: "PreparationType"
46
- has_one :preparation_method, class_name: "PreparationMethod"
47
- has_one :parent_material_sample, class_name: "MaterialSample"
48
- has_one :preparation_protocol, class_name: "Protocol"
49
- has_one :storage_unit, class_name: "StorageUnit"
50
- has_many :prepared_by, class_name: "Person"
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 :ac_derived_from, class_name: "ObjectStore"
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. ac_derived_from relationship is required"
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 :is_derivative, type: :boolean
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,7 +10,7 @@ module Dina
10
10
 
11
11
  @faraday = Faraday.new(site, connection_options) do |builder|
12
12
  builder.request :multipart
13
- builder.use ::JsonApiClient::Middleware::ParseJson
13
+ builder.response :json
14
14
  builder.adapter(*adapter_options)
15
15
  end
16
16
  yield(self) if block_given?
@@ -18,7 +18,7 @@ module Dina
18
18
 
19
19
  def run(request_method, path, params: nil, headers: {}, body: nil)
20
20
  path = path + "/#{body[:data]["attributes"]["group"].downcase}"
21
- if body[:data]["attributes"].key?("is_derivative")
21
+ if body[:data]["attributes"].key?("isDerivative")
22
22
  path = path + "/derivative"
23
23
  end
24
24
  file_path = body[:data]["attributes"]["filePath"]
@@ -29,8 +29,8 @@ module Dina
29
29
  property :orientation, type: :integer
30
30
  property :resourceExternalURL, type: :string
31
31
 
32
- has_one :ac_metadata_creator, class_name: "Person"
33
- has_one :dc_creator, class_name: "Person"
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"
@@ -3,7 +3,6 @@ require_rel 'search_connection'
3
3
 
4
4
  module Dina
5
5
  class Search < BaseModel
6
-
7
6
  self.connection_class = SearchConnection
8
7
 
9
8
  custom_endpoint :execute, on: :collection, request_method: :post
@@ -5,7 +5,6 @@ require_rel 'search_connection'
5
5
 
6
6
  module Dina
7
7
  class SearchAutoComplete < BaseModel
8
-
9
8
  self.connection_class = SearchConnection
10
9
 
11
10
  custom_endpoint :execute, on: :collection, request_method: :get
@@ -13,7 +13,7 @@ module Dina
13
13
 
14
14
  @faraday = Faraday.new(site, connection_options) do |builder|
15
15
  builder.request :json
16
- builder.use ::JsonApiClient::Middleware::ParseJson
16
+ builder.response :json
17
17
  builder.adapter(*adapter_options)
18
18
  end
19
19
  yield(self) if block_given?
@@ -66,7 +66,6 @@ module Dina
66
66
 
67
67
  def use(middleware, *args, &block)
68
68
  return if faraday.builder.locked?
69
- faraday.builder.insert_before(Middleware::ParseJson, middleware, *args, &block)
70
69
  end
71
70
 
72
71
  end
@@ -3,7 +3,6 @@ require_rel 'search_connection'
3
3
 
4
4
  module Dina
5
5
  class SearchCount < BaseModel
6
-
7
6
  self.connection_class = SearchConnection
8
7
 
9
8
  custom_endpoint :execute, on: :collection, request_method: :post
@@ -3,7 +3,6 @@ require_rel 'search_connection'
3
3
 
4
4
  module Dina
5
5
  class SearchMapping < BaseModel
6
-
7
6
  self.connection_class = SearchConnection
8
7
 
9
8
  custom_endpoint :execute, on: :collection, request_method: :get
data/lib/dina/version.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  module Dina
2
2
  class Version
3
3
 
4
- MAJOR = 2
5
- MINOR = 2
6
- PATCH = 1
4
+ MAJOR = 3
5
+ MINOR = 0
6
+ PATCH = 0
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: 2.2.1.0
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-27 00:00:00.000000000 Z
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
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.20'
20
+ version: '1.22'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.20'
27
+ version: '1.22'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: keycloak
30
30
  requirement: !ruby/object:Gem::Requirement