dina 3.3.4.0 → 3.3.5.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: 20bd3e6463a23ad5a3409cfacfc2b5a26378acab88d8f2326e4251134a45099b
4
- data.tar.gz: a8649b54ea6c29d3784ad494ac90b0c9332b504b4fb17d403ba07d2a6f9e97e8
3
+ metadata.gz: 40974ccc22f630f761b1df813bb15ed0afa2ae53f7a589c0dd264cfb30b3bd9c
4
+ data.tar.gz: 2b8fec89f74211d0797831c0a4c20d6683331697648cb0b172f77f926ff6abac
5
5
  SHA512:
6
- metadata.gz: f53c778ab6e081ee6ba961385531e73c1644c6671ba14901fcf8b358ca94d0b61e2eb84f57a85250f12ab914e9321c65ff94f870e3f150eba978e26ce7cf3014
7
- data.tar.gz: 3557c8f33b7077c91546f4f4e8e5374f90967c884a6a93131210d6c9652cef75262f564cca316fac30334174952d28c6a626c7ef882f923ab82e7308a16520d3
6
+ metadata.gz: 39646e6b949fd93af882d42de82eef38b7471a2a7e8826ef6ce71ebbd85a986fae1d37ec23548425dc92cbbbaac581622205b9d733567963ec3dc9c106f682df
7
+ data.tar.gz: 8fefe11dca7a890e0f56e175700b41c19f109e6fbf340bcd802445aba1396c694a379c422c32dda427ca01b976a5f8d8554ec5ad5552644526f8187815a17e7e
@@ -8,6 +8,7 @@ module Dina
8
8
  self.parser = FileParser
9
9
 
10
10
  custom_endpoint :download, on: :collection, request_method: :get
11
+ custom_endpoint :info, on: :collection, request_method: :get
11
12
 
12
13
  property :id, type: :string, default: SecureRandom.uuid_v7
13
14
  property :group, type: :string
@@ -17,6 +17,7 @@ module Dina
17
17
  end
18
18
 
19
19
  def run(request_method, path, params: nil, headers: {}, body: nil)
20
+
20
21
  if request_method == :get && path == "file/download"
21
22
  path = "file" + "/#{params[:group].downcase}/#{params[:fileIdentifier]}"
22
23
  if params[:isDerivative]
@@ -26,6 +27,14 @@ module Dina
26
27
  response = @faraday.run_request(request_method, path, body, headers) do |request|
27
28
  end
28
29
  response
30
+ elsif request_method == :get && path == "file/info"
31
+ path = "file-info" + "/#{params[:group].downcase}/#{params[:fileIdentifier]}#{params[:fileExtension]}"
32
+ if params[:isDerivative]
33
+ path = "file-info" + "/#{params[:group].downcase}/derivative/#{params[:fileIdentifier]}#{params[:fileExtension]}"
34
+ end
35
+ response = @faraday.run_request(request_method, path, body, headers) do |request|
36
+ end
37
+ response
29
38
  else
30
39
  path = path + "/#{body[:data]["attributes"]["group"].downcase}"
31
40
  if body[:data]["attributes"].key?("isDerivative")
@@ -44,15 +53,13 @@ module Dina
44
53
  response = @faraday.run_request(request_method, path, body, headers) do |request|
45
54
  request.params.update(params) if params
46
55
  end
47
- attributes = response.body.dup
48
- response.body["meta"] = {}
56
+
57
+ body = response.body.dup
58
+ response.body["meta"] = body["meta"]
49
59
  response.body["errors"] = []
50
- response.body["data"] = {
51
- "id" => attributes["uuid"],
52
- "type" => "file",
53
- "relationships" => {},
54
- "attributes" => attributes
55
- }
60
+ response.body["data"] = body["data"]
61
+ response.body["data"]["type"] = "file"
62
+
56
63
  response
57
64
  end
58
65
  end
data/lib/dina/version.rb CHANGED
@@ -3,7 +3,7 @@ module Dina
3
3
 
4
4
  MAJOR = 3
5
5
  MINOR = 3
6
- PATCH = 4
6
+ PATCH = 5
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.3.4.0
4
+ version: 3.3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David P. Shorthouse