dina 0.5.3.0 → 0.5.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2219751eeaf3e31b3b3206c5ca7b87a9e724662c3ed64c0781f8c35668b365cf
|
4
|
+
data.tar.gz: c951a685a472e4486a8847d1a2bf415e4ff39c540e80b9b4e50da72d073e69c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fe97ac48169a94af0b4b4d8dc5fe380b9b7aca9ac9abf656b915c428df20949f5b2bd034b681b9e23ac2e44d10635a7c64a5c947348a0f7f9f0bd6d79f5f882
|
7
|
+
data.tar.gz: 131b8bab4675a4bffec2aa7f22a2b52ef495914ad6f4203cf73866736c16ddceba2142a26e8135f3d5ad161d8618f2a151087ab73658d24799b1043fa2c399b2
|
@@ -46,6 +46,10 @@ module Dina
|
|
46
46
|
#
|
47
47
|
# @return [String] the Bearer token
|
48
48
|
def self.header
|
49
|
+
if ::File.zero?(@token_store_file)
|
50
|
+
create_empty_token
|
51
|
+
end
|
52
|
+
|
49
53
|
if access_token.nil? || refresh_token.nil?
|
50
54
|
set_token
|
51
55
|
end
|
@@ -119,6 +123,16 @@ module Dina
|
|
119
123
|
JSON.parse(::File.read(@token_store_file), symbolize_names: true)
|
120
124
|
end
|
121
125
|
|
126
|
+
def create_empty_token
|
127
|
+
data_hash = {}
|
128
|
+
data_hash[@server_name.to_sym] = {
|
129
|
+
access_token: nil,
|
130
|
+
refresh_token: nil,
|
131
|
+
auth_expiry: nil
|
132
|
+
}
|
133
|
+
::File.write(@token_store_file, JSON.dump(data_hash))
|
134
|
+
end
|
135
|
+
|
122
136
|
def save_token(access_token:, refresh_token:, auth_expiry:)
|
123
137
|
data_hash = JSON.parse(::File.read(@token_store_file), symbolize_names: true) rescue {}
|
124
138
|
data_hash[@server_name.to_sym] = {
|
@@ -28,10 +28,18 @@ module Dina
|
|
28
28
|
"collection"
|
29
29
|
end
|
30
30
|
|
31
|
+
# Finds a Collection object by name
|
32
|
+
#
|
33
|
+
# @param email [String] a name
|
34
|
+
# @return object [Object] a Collection object
|
31
35
|
def self.find_by_name(name)
|
32
36
|
where(name: name).all.first
|
33
37
|
end
|
34
38
|
|
39
|
+
# Finds a Collection object by code
|
40
|
+
#
|
41
|
+
# @param code [String] a code
|
42
|
+
# @return object [Object] a Collection object
|
35
43
|
def self.find_by_code(code)
|
36
44
|
where(code: code).all.first
|
37
45
|
end
|
@@ -15,16 +15,20 @@ module Dina
|
|
15
15
|
def initialize
|
16
16
|
end
|
17
17
|
|
18
|
+
def endpoint
|
19
|
+
Dina::Authentication.endpoint_url
|
20
|
+
end
|
21
|
+
|
18
22
|
def endpoint_path
|
19
23
|
"objectstore-api/"
|
20
24
|
end
|
21
25
|
|
22
26
|
def table_name
|
23
|
-
"file/#{@group}"
|
27
|
+
"file/#{@group.downcase}"
|
24
28
|
end
|
25
29
|
|
26
30
|
def url
|
27
|
-
|
31
|
+
endpoint + "/" + endpoint_path + table_name
|
28
32
|
end
|
29
33
|
|
30
34
|
def file
|
@@ -30,7 +30,7 @@ module Dina
|
|
30
30
|
begin
|
31
31
|
response = RestClient::Request.execute(
|
32
32
|
method: method,
|
33
|
-
url: endpoint + endpoint_path + "?" + params.to_query,
|
33
|
+
url: endpoint + "/" + endpoint_path + "?" + params.to_query,
|
34
34
|
payload: payload.to_json,
|
35
35
|
headers: {
|
36
36
|
accept: 'application/json',
|
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.5.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-
|
11
|
+
date: 2022-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_api_client
|