dataverse 0.1.6 → 0.1.8

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: d8ef5203a84748e800df0c41f38bc7a40abe8a35a267f1833ea9aca35c98cfb7
4
- data.tar.gz: '09f4960997ffe4ba910c77c8778d9eb63ffe074274a548af9c7ab08490bd5c34'
3
+ metadata.gz: 49b1b7ca158eabe9bc66b2bd0e83a6e1da6aa0fe6984acef57119a477bc0252d
4
+ data.tar.gz: 426a3872a464ec3954b71b1c87851795be6ac219ef2f9777e38748f2c00b4914
5
5
  SHA512:
6
- metadata.gz: edfc8efc1f59bda8d1e4318df535321ca706bb3c7bd4ead6c361062f2ffb77e1b6c32cbd6232ddfa37236036e4a76621d399aea75eae9186789ecf0d441abcca
7
- data.tar.gz: '097b014d6a4f051a5d3d93d1be6f578006055e38066840db059983d77f725cbd1d4279d8546ae9bce9a184cead709a48da5da61c20cb0bf7c5c008a370865afa'
6
+ metadata.gz: a3bb597791841213b4c1b445e62b511f5de2226e55ade9b16134afa3d96b7963892e42d429397a938237bb02f596662ba757d0497981c7419cdb284e0ecc1c32
7
+ data.tar.gz: cd3bf30ffc312df8142d2c176c3ecc7caddafb9e6a47bdcff2a364236d7e2841de05d8d789ff87cbf97efe32021e541cd1418ea515e4665edba1feaa404457f3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dataverse (0.1.6)
4
+ dataverse (0.1.8)
5
5
  rest-client (~> 2.0)
6
6
 
7
7
  GEM
@@ -14,12 +14,12 @@ GEM
14
14
  unf (>= 0.0.5, < 1.0.0)
15
15
  dotenv (2.7.6)
16
16
  http-accept (1.7.0)
17
- http-cookie (1.0.4)
17
+ http-cookie (1.0.5)
18
18
  domain_name (~> 0.5)
19
19
  method_source (1.0.0)
20
20
  mime-types (3.4.1)
21
21
  mime-types-data (~> 3.2015)
22
- mime-types-data (3.2021.1115)
22
+ mime-types-data (3.2022.0105)
23
23
  netrc (0.11.0)
24
24
  pry (0.14.1)
25
25
  coderay (~> 1.1)
@@ -45,7 +45,7 @@ GEM
45
45
  rspec-support (3.10.3)
46
46
  unf (0.1.4)
47
47
  unf_ext
48
- unf_ext (0.0.8)
48
+ unf_ext (0.0.8.2)
49
49
 
50
50
  PLATFORMS
51
51
  ruby
@@ -60,4 +60,4 @@ DEPENDENCIES
60
60
  rspec (~> 3.0)
61
61
 
62
62
  BUNDLED WITH
63
- 2.2.31
63
+ 2.2.32
@@ -141,7 +141,7 @@ module Dataverse
141
141
  .merge('metadata' => metadata(version: version))
142
142
  .merge('files' => files(version: version))
143
143
  .tap do |h|
144
- h['license'] = {
144
+ h['license'] ||= {
145
145
  'name' => license_spdx(h),
146
146
  'label' => license_name(h),
147
147
  'uri' => license_url(h),
@@ -286,12 +286,14 @@ module Dataverse
286
286
 
287
287
  def process_data(data)
288
288
  return {} if data.nil? || data.empty?
289
+ return {} unless data.has_key?('latestVersion')
289
290
  version_data = data.delete('latestVersion')
290
291
  process_version_data(version_data)
291
292
  data
292
293
  end
293
294
 
294
295
  def process_version_data(data)
296
+ return nil unless data
295
297
  metadata = pack_metadata(data.delete('metadataBlocks'))
296
298
  files = pack_files(data.delete('files'))
297
299
  version = get_version_number(data)
@@ -318,7 +320,7 @@ module Dataverse
318
320
 
319
321
  def pack_metadata(metadata)
320
322
  data = {}
321
- metadata.each_value do |block|
323
+ (metadata || {}).each_value do |block|
322
324
  block['fields'].each do |field|
323
325
  data[field['typeName']] = field_to_value(field)
324
326
  end
@@ -83,7 +83,8 @@ module Dataverse
83
83
  when 'dataverse'
84
84
  result << Dataverse.id(x['id'])
85
85
  when 'dataset'
86
- result << Dataset.id(x['id'])
86
+ ds = Dataset.id(x['id'])
87
+ result << ds if ds.version
87
88
  else
88
89
  raise Error.new("Unsupported type: #{x['type']} (#{x['name']})")
89
90
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dataverse
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.8"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dataverse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-15 00:00:00.000000000 Z
11
+ date: 2022-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []
76
- rubygems_version: 3.2.15
76
+ rubygems_version: 3.1.6
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: Dataverse API.