dina 0.5.7.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: 4999fc970acb56ad2c4dcacb27124741d65c91b9dc00f13267b6da0f756ee3a9
4
- data.tar.gz: 461e2ca77f1b4f4e7a675e42fc5f81008e967222211fb7ea4b0aa8435f869700
3
+ metadata.gz: f95a0329ac306f75e3076a3f193da193d0722ff3677415f6301925509ed77d46
4
+ data.tar.gz: 00ff890a78d22da1e6d48a664293802fe67ec1e3cd9e943c7b8816a6a422e964
5
5
  SHA512:
6
- metadata.gz: 2b3573481c0cfffd4fca4f32f8ff521ad357e7eb63598fc3d6ce77441d3a154c1b69bb382ef8473a0ce5525c8268042e4fd936bd203bc7970c720da320aba1b6
7
- data.tar.gz: eabb87d0e292a17a4cd1769757c5de8e0862e3fc23aaeb81dcb1d3d5613f211e5937d42eddef28098872e195d8814431de9b33771e972ac6e5ab0a58e42ab84b
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
@@ -1,5 +1,13 @@
1
1
  module Dina
2
- class BaseSearch
2
+ class BaseSearch < BaseModel
3
+
4
+ def self.verify_ssl
5
+ begin
6
+ connection_options[:ssl][:verify]
7
+ rescue
8
+ true
9
+ end
10
+ end
3
11
 
4
12
  def self.endpoint
5
13
  Dina::Authentication.endpoint_url
@@ -36,7 +44,8 @@ module Dina
36
44
  accept: 'application/json',
37
45
  content_type: 'application/json',
38
46
  authorization: Dina::Authentication.header
39
- }
47
+ },
48
+ verify_ssl: verify_ssl
40
49
  )
41
50
  JSON.parse(response, symbolize_names: true)
42
51
  rescue RestClient::ExceptionWithResponse => e
data/lib/dina/version.rb CHANGED
@@ -3,7 +3,7 @@ module Dina
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 5
6
- PATCH = 7
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.7.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-15 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