sdr-client 0.28.3 → 0.32.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: 0cb04dd251d4bdc856e935f8f6ff157054973e51e703eac5cfec621d3ea9906c
4
- data.tar.gz: cc254f2105f3499a6a219e93ce51dcdde7f9c05d8fcd729c6b3c04ad58141012
3
+ metadata.gz: ab735da1159debb159fee1765bf30b81ca739175dd77322c82a6c742b4264a80
4
+ data.tar.gz: 8abdd10178c83921df47ef09ef19c75fb982585644c2d039e656b93b3a8ba2b9
5
5
  SHA512:
6
- metadata.gz: faa0bd4e365b80ce47f8860af6a6f24f0581428662a9ded8ea6b78523aa09b73a3bcebb5aff33e998152ab8b8e1d81d9883ddee53cf162a7bdbc047596437a76
7
- data.tar.gz: afb9f79a157929f83ba886f679c0eaa11965d3e60b9aa730f29edcdcb552e18c7d76d55e064ff3cdced78cf05f5df704b5d87b019607424e7263ee1e7bbb98cf
6
+ metadata.gz: 30117e4a96a0e0119932e999b5255b529afdd7770cab2b26654359913b31385168bebe4540e40d630eaf78844ed3fa35a465e922894c8f8cc2b776288c281113
7
+ data.tar.gz: 7c7ba5b910f5bca9cc455f6d1e0e3af22aac2713bd9bc56c5b06af328eccaf9edc113d1759a9af6e43048352e45fa137e6b4799912476eb125d181922a97b136
@@ -0,0 +1,35 @@
1
+ version: 2.1
2
+
3
+ jobs:
4
+ build:
5
+ docker:
6
+ - image: circleci/ruby:2.7.1
7
+ environment:
8
+ CC_TEST_REPORTER_ID: 859fcfe88b00c026d15dce30e838e2299face8088b49fe62bc3a02d1507ce3d5
9
+ RAILS_ENV: test
10
+ steps:
11
+ - checkout
12
+ - run:
13
+ name: Install Bundler
14
+ command: gem install bundler
15
+ - run:
16
+ name: Which bundler?
17
+ command: bundle -v
18
+ - run:
19
+ name: Bundle Install
20
+ command: bundle check || bundle install
21
+ - run:
22
+ name: Lint using rubocop
23
+ command: bundle exec rubocop
24
+ - run:
25
+ name: Setup Code Climate test-reporter
26
+ command: |
27
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
28
+ chmod +x ./cc-test-reporter
29
+ ./cc-test-reporter before-build
30
+ - run:
31
+ name: rspec
32
+ command: bundle exec rspec
33
+ - run:
34
+ name: upload test coverage report to Code Climate
35
+ command: ./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $?
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-06-24 17:02:25 -0700 using RuboCop version 0.79.0.
3
+ # on 2020-09-08 13:16:08 -0500 using RuboCop version 0.79.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -21,9 +21,9 @@ Style/IfUnlessModifier:
21
21
  Exclude:
22
22
  - 'exe/sdr'
23
23
 
24
- # Offense count: 187
24
+ # Offense count: 188
25
25
  # Cop supports --auto-correct.
26
26
  # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
27
27
  # URISchemes: http, https
28
28
  Layout/LineLength:
29
- Max: 1228
29
+ Max: 1230
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://travis-ci.org/sul-dlss/sdr-client.svg?branch=master)](https://travis-ci.org/sul-dlss/sdr-client)
1
+ [![CircleCI](https://circleci.com/gh/sul-dlss/sdr-client.svg?style=svg)](https://circleci.com/gh/sul-dlss/sdr-client)
2
2
  [![Maintainability](https://api.codeclimate.com/v1/badges/1210855d46d4f424bf30/maintainability)](https://codeclimate.com/github/sul-dlss/sdr-client/maintainability)
3
3
  [![Test Coverage](https://api.codeclimate.com/v1/badges/1210855d46d4f424bf30/test_coverage)](https://codeclimate.com/github/sul-dlss/sdr-client/test_coverage)
4
4
  [![Gem Version](https://badge.fury.io/rb/sdr-client.svg)](https://badge.fury.io/rb/sdr-client)
@@ -5,6 +5,7 @@ require 'faraday'
5
5
  require 'active_support'
6
6
  require 'active_support/core_ext/object/json'
7
7
  require 'active_support/core_ext/hash/indifferent_access'
8
+ require 'active_support/core_ext/file/atomic'
8
9
  require 'cocina/models'
9
10
 
10
11
  require 'sdr_client/version'
@@ -9,21 +9,16 @@ module SdrClient
9
9
  def self.write(body)
10
10
  json = JSON.parse(body)
11
11
  Dir.mkdir(credentials_path, 0o700) unless Dir.exist?(credentials_path)
12
- File.open(credentials_file, 'w', 0o600) do |file|
13
- file.flock(File::LOCK_EX)
12
+ File.atomic_write(credentials_file) do |file|
14
13
  file.write(json.fetch('token'))
15
- file.flush
16
14
  end
15
+ File.chmod(0o600, credentials_file)
17
16
  end
18
17
 
19
18
  def self.read
20
19
  raise NoCredentialsError unless ::File.exist?(credentials_file)
21
20
 
22
- creds = nil
23
- File.open(credentials_file, 'r') do |file|
24
- file.flock(File::LOCK_EX)
25
- creds = file.readlines(chomp: true).first
26
- end
21
+ creds = IO.readlines(credentials_file, chomp: true).first if ::File.exist?(credentials_file)
27
22
  raise NoCredentialsError if creds.nil?
28
23
 
29
24
  creds
@@ -104,7 +104,7 @@ module SdrClient
104
104
 
105
105
  def structural
106
106
  {}.tap do |json|
107
- json[:isMemberOf] = collection if collection
107
+ json[:isMemberOf] = [collection] if collection
108
108
  json[:contains] = file_sets.map(&:as_json) unless file_sets.empty?
109
109
  json[:hasMemberOrders] = [{ viewingDirection: viewing_direction }] if viewing_direction
110
110
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '0.28.3'
4
+ VERSION = '0.32.0'
5
5
  end
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ['lib']
29
29
 
30
30
  spec.add_dependency 'activesupport'
31
- spec.add_dependency 'cocina-models', '~> 0.33.0'
31
+ spec.add_dependency 'cocina-models', '~> 0.39.0'
32
32
  spec.add_dependency 'dry-monads'
33
33
  spec.add_dependency 'faraday', '>= 0.16'
34
34
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdr-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.3
4
+ version: 0.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-25 00:00:00.000000000 Z
11
+ date: 2020-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.33.0
33
+ version: 0.39.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.33.0
40
+ version: 0.39.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dry-monads
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -173,12 +173,12 @@ executables:
173
173
  extensions: []
174
174
  extra_rdoc_files: []
175
175
  files:
176
+ - ".circleci/config.yml"
176
177
  - ".github/pull_request_template.md"
177
178
  - ".gitignore"
178
179
  - ".rspec"
179
180
  - ".rubocop.yml"
180
181
  - ".rubocop_todo.yml"
181
- - ".travis.yml"
182
182
  - Gemfile
183
183
  - LICENSE
184
184
  - README.md
@@ -219,7 +219,7 @@ metadata:
219
219
  homepage_uri: https://github.com/sul-dlss/sdr-client
220
220
  source_code_uri: https://github.com/sul-dlss/sdr-client
221
221
  changelog_uri: https://github.com/sul-dlss/sdr-client/releases
222
- post_install_message:
222
+ post_install_message:
223
223
  rdoc_options: []
224
224
  require_paths:
225
225
  - lib
@@ -234,8 +234,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  - !ruby/object:Gem::Version
235
235
  version: '0'
236
236
  requirements: []
237
- rubygems_version: 3.0.3
238
- signing_key:
237
+ rubygems_version: 3.1.2
238
+ signing_key:
239
239
  specification_version: 4
240
240
  summary: The CLI for https://github.com/sul-dlss/sdr-api
241
241
  test_files: []
@@ -1,20 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.4
7
- before_install: gem install bundler -v 2.1.2
8
-
9
- before_script:
10
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
11
- - chmod +x ./cc-test-reporter
12
- - ./cc-test-reporter before-build
13
- after_script:
14
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
15
-
16
- env:
17
- global:
18
- - CC_TEST_REPORTER_ID=859fcfe88b00c026d15dce30e838e2299face8088b49fe62bc3a02d1507ce3d5
19
- notifications:
20
- email: false