publishing_platform_api_adapters 0.2.0 → 0.4.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d5184264eb9e2b1bb5c025980563ad23348940805a21fae7f1f43018f1e1b19
|
4
|
+
data.tar.gz: b2c57528a81f4e8dc7b5e615ac1c596f6a2035d04f1a47926ac28bd234035e6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9de58b5a14da0ee00752bf7cb940f97d9ef9bcb1301a12e380bae23ad50e6ccef56e66387cd89e197d047c92de576676623d9a970ed9475638e66c8d6a10252
|
7
|
+
data.tar.gz: 268df30f6a6806f315d92fe1fc00a8a46c4c52b75b505988756b460b5bf2a00912656113c855ef987cea611f9187e0ca2be7154c44e75ee17db63f6bbc301e63
|
@@ -35,16 +35,11 @@ class PublishingPlatformApi::PublishingApi < PublishingPlatformApi::Base
|
|
35
35
|
# on the public site.
|
36
36
|
#
|
37
37
|
# @param content_id [UUID]
|
38
|
-
# @param update_type [String] Either 'major', 'minor' or 'republish'
|
39
38
|
# @param options [Hash]
|
40
|
-
def publish(content_id,
|
41
|
-
params = {
|
42
|
-
update_type:,
|
43
|
-
}
|
44
|
-
|
39
|
+
def publish(content_id, options = {})
|
45
40
|
optional_keys = %i[previous_version]
|
46
41
|
|
47
|
-
params = merge_optional_keys(
|
42
|
+
params = merge_optional_keys({}, options, optional_keys)
|
48
43
|
|
49
44
|
post_json(publish_url(content_id), params)
|
50
45
|
end
|
@@ -107,6 +102,61 @@ class PublishingPlatformApi::PublishingApi < PublishingPlatformApi::Base
|
|
107
102
|
post_json(discard_url(content_id), params)
|
108
103
|
end
|
109
104
|
|
105
|
+
# Get the link set for the given content_id.
|
106
|
+
#
|
107
|
+
# Given a Content ID, it fetchs the existing link set and their version.
|
108
|
+
#
|
109
|
+
# @param content_id [String]
|
110
|
+
#
|
111
|
+
# @return [PublishingPlatformApi::Response] A response containing `links` and `version`.
|
112
|
+
#
|
113
|
+
# @example
|
114
|
+
#
|
115
|
+
# publishing_api.get_links("a-content-id")
|
116
|
+
# # => {
|
117
|
+
# "content_id" => "a-content-id",
|
118
|
+
# "links" => [
|
119
|
+
# "organisation" => "organisation-content-id",
|
120
|
+
# "document_collection" => "document-collection-content-id"
|
121
|
+
# ],
|
122
|
+
# "version" => 17
|
123
|
+
# }
|
124
|
+
def get_links(content_id)
|
125
|
+
get_json(links_url(content_id))
|
126
|
+
end
|
127
|
+
|
128
|
+
# Get expanded links
|
129
|
+
#
|
130
|
+
# Return the expanded links of the item.
|
131
|
+
#
|
132
|
+
# @param content_id [UUID]
|
133
|
+
# @param with_drafts [Bool] Whether links to draft-only editions are returned, defaulting to `true`.
|
134
|
+
# @param generate [Bool] Whether to require publishing-api to generate the expanded links, which may be slow. Defaults to `false`.
|
135
|
+
#
|
136
|
+
# @example
|
137
|
+
#
|
138
|
+
# publishing_api.get_expanded_links("8157589b-65e2-4df6-92ba-2c91d80006c0", with_drafts: false).to_h
|
139
|
+
#
|
140
|
+
# #=> {
|
141
|
+
# "generated" => "2017-08-01T10:42:49Z",
|
142
|
+
# "expanded_links" => {
|
143
|
+
# "organisations" => [
|
144
|
+
# {
|
145
|
+
# "content_id" => "21aa83a2-a47f-4189-a252-b02f8c322012",
|
146
|
+
# ... (and more attributes)
|
147
|
+
# }
|
148
|
+
# ]
|
149
|
+
# }
|
150
|
+
# }
|
151
|
+
def get_expanded_links(content_id, with_drafts: true, generate: false)
|
152
|
+
params = {}
|
153
|
+
params[:with_drafts] = "false" unless with_drafts
|
154
|
+
params[:generate] = "true" if generate
|
155
|
+
query = query_string(params)
|
156
|
+
validate_content_id(content_id)
|
157
|
+
get_json("#{endpoint}/expanded-links/#{content_id}#{query}")
|
158
|
+
end
|
159
|
+
|
110
160
|
# Patch the links of a content item
|
111
161
|
#
|
112
162
|
# @param content_id [UUID]
|
@@ -157,6 +207,15 @@ class PublishingPlatformApi::PublishingApi < PublishingPlatformApi::Base
|
|
157
207
|
get_json("#{endpoint}/content#{query}")
|
158
208
|
end
|
159
209
|
|
210
|
+
# FIXME: Add documentation
|
211
|
+
def get_linkables(document_type: nil)
|
212
|
+
if document_type.nil?
|
213
|
+
raise ArgumentError, "Please provide a `document_type`"
|
214
|
+
end
|
215
|
+
|
216
|
+
get_json("#{endpoint}/linkables?document_type=#{document_type}")
|
217
|
+
end
|
218
|
+
|
160
219
|
# Reserves a path for a publishing application
|
161
220
|
#
|
162
221
|
# Returns success or failure only.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: publishing_platform_api_adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Publishing Platform
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|