dina 0.5.8.0 → 0.5.9.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: 20d2d7fda55f26506af8e5dd5816b24ef98de6e953eaa641401b3477792d5d77
4
- data.tar.gz: 9320f715b7a0bf19b0ab109c6983ba224d376e0fc5944d85d36ecd566e928777
3
+ metadata.gz: f95a0329ac306f75e3076a3f193da193d0722ff3677415f6301925509ed77d46
4
+ data.tar.gz: 00ff890a78d22da1e6d48a664293802fe67ec1e3cd9e943c7b8816a6a422e964
5
5
  SHA512:
6
- metadata.gz: 50efcc1f8be5988f7fcb31419dab52dbe77810f26157413bcd40c38b09b72985751af4b6250189562277f35c023203fbad5339adfe63882537c7a14d5112cb2a
7
- data.tar.gz: b0ddd982984ee09680c7fa1dce3c59d230d51f394b0e05aa8bbf743f89bbb6f974189001f3660d7e3d1d32107ddf1a270f6baa97d9c79f18c88f39927ca32efd
6
+ metadata.gz: f1709d2a17af2ef4ecf9c99718c708d64759ee4449d8a524159fea8a4ca7c24be3fca262a33da7eeae938766f215378000c194354cbb8f5859fbf18106c29e66
7
+ data.tar.gz: 65610e9edab365148c8f390cb91c45cfb004135dc7e620734e710ba893afe12427e6efaa34c28c270cfd658935f5465ac535b0d0d4aa90c595300eb403ca552c
@@ -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,7 +3,7 @@ module Dina
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 5
6
- PATCH = 8
6
+ PATCH = 9
7
7
  BUILD = 0
8
8
 
9
9
  def self.version
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.0
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