dina 0.5.8.0 → 0.5.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dina/casters/multilingual_title.rb +2 -2
- data/lib/dina/models/object_store/file.rb +16 -3
- 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: 7dce66cc9ad35b27eaf11fd314027b06def22bab64025b4ee79de9b3a8b22f1a
|
4
|
+
data.tar.gz: 6bf96dfc20327ca42e450c42e2dd8a0c1d5c2a025f09127a118077b3ff742968
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 476b81d9353c5c05f5f1c744cf4b00555bd7a9337ee6a2569689c270fdd280c521c696c84ab2df466350e52f502a6c728a920f958d55ce358b7e836266ae5439
|
7
|
+
data.tar.gz: fb0f7c3f96d1576c7a0c211d20640a429b51c6d69dab3c8a15d62a4ce1fa3231b2491d5410c134948e9355aaadda29f600bd94b6588a8a090779780eeb0430da
|
@@ -5,7 +5,7 @@ module Dina
|
|
5
5
|
def initialize(opts = {})
|
6
6
|
@titles = []
|
7
7
|
if opts[:titles]
|
8
|
-
@
|
8
|
+
@titles = opts[:titles]
|
9
9
|
end
|
10
10
|
if opts[:english]
|
11
11
|
self.english_title = opts[:english]
|
@@ -17,7 +17,7 @@ module Dina
|
|
17
17
|
|
18
18
|
def english_title=(title)
|
19
19
|
titles.delete_if{|o| o[:lang] == "en"}
|
20
|
-
titles << { lang: "en", title:
|
20
|
+
titles << { lang: "en", title: title }
|
21
21
|
end
|
22
22
|
|
23
23
|
def english_title
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Dina
|
2
2
|
class File < BaseModel
|
3
|
-
attr_accessor :file_path, :group, :is_derivative
|
3
|
+
attr_accessor :id, :file_path, :group, :is_derivative
|
4
4
|
|
5
5
|
def self.verify_ssl
|
6
6
|
begin
|
@@ -21,7 +21,17 @@ module Dina
|
|
21
21
|
)
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def self.create(attributes = {})
|
25
|
+
new(attributes).tap do |resource|
|
26
|
+
resource.save
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def initialize(attributes = {})
|
31
|
+
@id = attributes[:id] || SecureRandom.uuid
|
32
|
+
@group = attributes[:group] || nil
|
33
|
+
@is_derivative = attributes[:is_derivative] || false
|
34
|
+
@file_path = attributes[:file_path] || nil
|
25
35
|
end
|
26
36
|
|
27
37
|
def endpoint
|
@@ -33,7 +43,7 @@ module Dina
|
|
33
43
|
end
|
34
44
|
|
35
45
|
def table_name
|
36
|
-
"file/#{
|
46
|
+
"file/#{group.downcase}"
|
37
47
|
end
|
38
48
|
|
39
49
|
def url
|
@@ -64,6 +74,9 @@ module Dina
|
|
64
74
|
private
|
65
75
|
|
66
76
|
def validate_params
|
77
|
+
if id.nil? || !id.is_uuid?
|
78
|
+
raise ObjectInvalid, "#{self.class} is invalid. id is not a UUID."
|
79
|
+
end
|
67
80
|
if group.nil?
|
68
81
|
raise ObjectInvalid, "#{self.class} is invalid. group is required."
|
69
82
|
end
|
data/lib/dina/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David P. Shorthouse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_api_client
|