purl_fetcher-client 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/purl_fetcher/client/mods.rb +38 -0
- data/lib/purl_fetcher/client/release_tags.rb +1 -1
- data/lib/purl_fetcher/client/version.rb +1 -1
- data/lib/purl_fetcher/client.rb +11 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b237518aad8cb3c8c617c36191a1e2b5fd81e7792e035ca920ca589c4d6de5f
|
4
|
+
data.tar.gz: e81b7dbf9684ab37db18a4169edcd76a0d7a9914f5514472933985caeafa5cfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9585d2dada61a2353d584e07ad0adbe6b977b45bd638bcd12d0b0c0ecf22654828b0daf955a012d4ddc44e97c2085e1a11aee67b08f6f27ef7a805ddc3645851
|
7
|
+
data.tar.gz: 3fe290818961d4dcadc5486079e63edc568a35e96f4b5a6cfebfaa8b94099361a3bb68369046ef24dd46b502bc6b0c9ddda08c581a7576ced156f6410b9833c6
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PurlFetcher
|
4
|
+
class Client
|
5
|
+
# Create a MODS represenation of Cocina JSON
|
6
|
+
class Mods
|
7
|
+
# @param [Cocina::Models::Dro] cocina the Cocina JSON representation of the object
|
8
|
+
def self.create(cocina:)
|
9
|
+
new(cocina:).create
|
10
|
+
end
|
11
|
+
|
12
|
+
# @param [Cocina::Models::Dro] cocina the Cocina JSON representation of the object
|
13
|
+
def initialize(cocina:)
|
14
|
+
@cocina = cocina
|
15
|
+
end
|
16
|
+
|
17
|
+
def create
|
18
|
+
response = client.post(path:, body:)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_reader :cocina
|
24
|
+
|
25
|
+
def body
|
26
|
+
cocina.to_json
|
27
|
+
end
|
28
|
+
|
29
|
+
def client
|
30
|
+
Client.instance
|
31
|
+
end
|
32
|
+
|
33
|
+
def path
|
34
|
+
"/v1/mods"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/purl_fetcher/client.rb
CHANGED
@@ -6,6 +6,7 @@ require "logger"
|
|
6
6
|
|
7
7
|
require "purl_fetcher/client/version"
|
8
8
|
require "purl_fetcher/client/reader"
|
9
|
+
require "purl_fetcher/client/mods"
|
9
10
|
require "purl_fetcher/client/upload_files"
|
10
11
|
require "purl_fetcher/client/direct_upload_request"
|
11
12
|
require "purl_fetcher/client/direct_upload_response"
|
@@ -87,7 +88,8 @@ module PurlFetcher
|
|
87
88
|
def connection
|
88
89
|
Faraday.new(
|
89
90
|
url: config.url,
|
90
|
-
headers: default_headers
|
91
|
+
headers: default_headers,
|
92
|
+
request: default_request_options
|
91
93
|
) do |conn|
|
92
94
|
conn.response :json
|
93
95
|
end
|
@@ -101,6 +103,14 @@ module PurlFetcher
|
|
101
103
|
}.compact
|
102
104
|
end
|
103
105
|
|
106
|
+
def default_request_options
|
107
|
+
# To allow transfer of large files.
|
108
|
+
{
|
109
|
+
read_timeout: 900,
|
110
|
+
timeout: 900
|
111
|
+
}
|
112
|
+
end
|
113
|
+
|
104
114
|
def auth_header
|
105
115
|
"Bearer #{config.token}" if config.token
|
106
116
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: purl_fetcher-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- lib/purl_fetcher/client/direct_upload_request.rb
|
130
130
|
- lib/purl_fetcher/client/direct_upload_response.rb
|
131
131
|
- lib/purl_fetcher/client/legacy_publish.rb
|
132
|
+
- lib/purl_fetcher/client/mods.rb
|
132
133
|
- lib/purl_fetcher/client/reader.rb
|
133
134
|
- lib/purl_fetcher/client/release_tags.rb
|
134
135
|
- lib/purl_fetcher/client/unpublish.rb
|
@@ -153,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
154
|
- !ruby/object:Gem::Version
|
154
155
|
version: '0'
|
155
156
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
157
|
+
rubygems_version: 3.5.10
|
157
158
|
signing_key:
|
158
159
|
specification_version: 4
|
159
160
|
summary: Traject-compatible reader implementation for streaming data from purl-fetcher
|