gds-api-adapters 49.6.0 → 49.7.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
  SHA1:
3
- metadata.gz: 45e263a103cf5ffe12a351f0cae320b20a9af8e6
4
- data.tar.gz: fab91a8f49f54748db72e70f507471f5fbb478b3
3
+ metadata.gz: b762aee9a8820eb15af6a93d1f6a76613db0e4c2
4
+ data.tar.gz: 402b49ea6cb48c0210e5dfd9083dbef52d8b61ca
5
5
  SHA512:
6
- metadata.gz: 2a1b1dec1cc3d235a700a1ab3d5ba3126158778a2d8a254ad1d341ae643e60fc6f2465db30e7dc99cb61048f77d23d0348bab212ac70e630ec31d5e06dddeffd
7
- data.tar.gz: b0341f37a593d2a474e91b30a0b584465ff7ceb9e3e546d2820b9edbcd5967ba48898c325387aada461c346ef75e141adfc9157cf6746e057342d8fdd97a749e
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
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '49.6.0'.freeze
2
+ VERSION = '49.7.0'.freeze
3
3
  end
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.6.0
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-10-18 00:00:00.000000000 Z
11
+ date: 2017-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek