gds-api-adapters 49.6.0 → 49.7.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 +4 -4
- data/lib/gds_api/link_checker_api.rb +31 -0
- data/lib/gds_api/test_helpers/link_checker_api.rb +17 -0
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b762aee9a8820eb15af6a93d1f6a76613db0e4c2
|
4
|
+
data.tar.gz: 402b49ea6cb48c0210e5dfd9083dbef52d8b61ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d834d43099a1e1225f96e304b3472ba4721ec4a854d494e73b8809533ecff807748da8ddb5678ccbdf2af618de8f2af278533e7603743a8c052cd457ec6bc2bd
|
7
|
+
data.tar.gz: f616e60ae73667a4551bd1afde5e2e7762116d908260e8040092d7a9eac261a841d686ffbd2358a2689774115f337ce3a32378173fded93214052309cf5d6671
|
@@ -89,6 +89,37 @@ class GdsApi::LinkCheckerApi < GdsApi::Base
|
|
89
89
|
)
|
90
90
|
end
|
91
91
|
|
92
|
+
# Update or create a set of links to be monitored for a resource.
|
93
|
+
#
|
94
|
+
# Makes a +POST+ request to the link checker api to create a resource monitor.
|
95
|
+
#
|
96
|
+
# @param links [Array] A list of URIs to monitor.
|
97
|
+
# @param reference [String] A unique id for the resource being monitored
|
98
|
+
# @param app [String] The name of the service the call originated e.g. 'whitehall'
|
99
|
+
# @return [MonitorReport] A +SimpleDelegator+ of the +GdsApi::Response+ which
|
100
|
+
# responds to:
|
101
|
+
# :id the ID of the created resource monitor
|
102
|
+
#
|
103
|
+
# @raise [HTTPErrorResponse] if the request returns an error
|
104
|
+
|
105
|
+
def upsert_resource_monitor(links, app, reference)
|
106
|
+
payload = {
|
107
|
+
links: links,
|
108
|
+
app: app,
|
109
|
+
reference: reference
|
110
|
+
}
|
111
|
+
|
112
|
+
response = post_json("#{endpoint}/monitor", payload)
|
113
|
+
|
114
|
+
MonitorReport.new(response.to_hash)
|
115
|
+
end
|
116
|
+
|
117
|
+
class MonitorReport < SimpleDelegator
|
118
|
+
def id
|
119
|
+
self["id"]
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
92
123
|
class LinkReport < SimpleDelegator
|
93
124
|
def uri
|
94
125
|
self["uri"]
|
@@ -72,6 +72,23 @@ module GdsApi
|
|
72
72
|
headers: { "Content-Type" => "application/json" }
|
73
73
|
)
|
74
74
|
end
|
75
|
+
|
76
|
+
def link_checker_api_upsert_resource_monitor(app:, reference:, links:)
|
77
|
+
response_body = { id: 1 }.to_json
|
78
|
+
|
79
|
+
request_body = {
|
80
|
+
links: links,
|
81
|
+
app: app,
|
82
|
+
reference: reference
|
83
|
+
}.to_json
|
84
|
+
|
85
|
+
stub_request(:post, "#{LINK_CHECKER_API_ENDPOINT}/monitor")
|
86
|
+
.with(body: request_body)
|
87
|
+
.to_return(
|
88
|
+
body: response_body,
|
89
|
+
headers: { "Content-Type" => "application/json" }
|
90
|
+
)
|
91
|
+
end
|
75
92
|
end
|
76
93
|
end
|
77
94
|
end
|
data/lib/gds_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 49.
|
4
|
+
version: 49.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Stewart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|