dina 0.5.8.0 → 0.5.9.1

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: 20d2d7fda55f26506af8e5dd5816b24ef98de6e953eaa641401b3477792d5d77
4
- data.tar.gz: 9320f715b7a0bf19b0ab109c6983ba224d376e0fc5944d85d36ecd566e928777
3
+ metadata.gz: 7dce66cc9ad35b27eaf11fd314027b06def22bab64025b4ee79de9b3a8b22f1a
4
+ data.tar.gz: 6bf96dfc20327ca42e450c42e2dd8a0c1d5c2a025f09127a118077b3ff742968
5
5
  SHA512:
6
- metadata.gz: 50efcc1f8be5988f7fcb31419dab52dbe77810f26157413bcd40c38b09b72985751af4b6250189562277f35c023203fbad5339adfe63882537c7a14d5112cb2a
7
- data.tar.gz: b0ddd982984ee09680c7fa1dce3c59d230d51f394b0e05aa8bbf743f89bbb6f974189001f3660d7e3d1d32107ddf1a270f6baa97d9c79f18c88f39927ca32efd
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
- @descriptions = opts[:titles]
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: desc }
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, :id
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 initialize
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/#{@group.downcase}"
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
@@ -3,8 +3,8 @@ module Dina
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 5
6
- PATCH = 8
7
- BUILD = 0
6
+ PATCH = 9
7
+ BUILD = 1
8
8
 
9
9
  def self.version
10
10
  [MAJOR, MINOR, PATCH, BUILD].compact.join('.').freeze
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.8.0
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-20 00:00:00.000000000 Z
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