dor-fetcher 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/dor-fetcher.rb +15 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzQwNDg5YWQyMWEzODU2ZTE2NzlkOTAxMGM2NmJkZjg3ZGQ1YmY0Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTNjYWQzZmY2NTQyMzUxZjM0ZjMxMTY5NmYyZjFiODcwNzBhZjdiOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjNhYjg3YzlmNmU5MzM2ZjRjOWYxYTIyYzUzMmU4N2VkNTZjNTNlYjk1YzA2
|
10
|
+
OWY1N2RlMmM0NThlYjNlNzVjMjUyY2JhZDBjMmUzZjlkOTZkYzkyZGUzMDI4
|
11
|
+
MTY1ODUyOGQxNDY4YjEzODdlMTAyYTE2ZWQ4MDhjOWM5ZDY1OWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Nzg3ZmI3MTJkMjJhZmM0YWI1NDgzM2FmOGVlYjlmYjJjNzA0ZGE0ZjRkNGQy
|
14
|
+
ZTIzMGI0YjFiN2NlOTFiMDFhNWIzMDE4YThlMjlhODRjM2YwNmFiOTgyNGE1
|
15
|
+
Nzg4NDZmNTM2Y2NkYTU4ZDljZWZjZTgyZjRlMWE1NDVhY2FlNzQ=
|
data/lib/dor-fetcher.rb
CHANGED
@@ -10,13 +10,26 @@ module DorFetcher
|
|
10
10
|
@@default_service_url = 'http://127.0.0.1:3000'
|
11
11
|
|
12
12
|
#Create a new instance of DorFetcher::Client
|
13
|
-
#@param options [Hash] Currently supports
|
14
|
-
|
13
|
+
#@param options [Hash] Currently supports :service_url and :skip_heartbeat.
|
14
|
+
#:service_url is the base url for API queries. Defaults to http://127.0.0.1:3000
|
15
|
+
#:skip_heartbeat will tell the init to skip querying the :service_url and seeing if the API is responsive
|
15
16
|
#@example
|
16
17
|
# df = DorFetcher::Client.new({:service_url='http://SERVICEURL'})
|
17
18
|
def initialize options = {}
|
18
19
|
#TODO: Check for a well formed URL and a 200 from the destination before just accepting this
|
19
20
|
@service_url = options[:service_url] || @@default_service_url
|
21
|
+
|
22
|
+
if not options[:skip_heartbeat]
|
23
|
+
raise "DorFetcher::Client Error! No response from #{@service_url}" if not self.is_alive
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
#Check to see if the dor-fetcher-service is responding to requests, this is a basic heart beat checker
|
28
|
+
#@return [Boolean] True for a service that responds, False for a service that does not.
|
29
|
+
def is_alive
|
30
|
+
resp = Net::HTTP.get_response(URI.parse(@service_url))
|
31
|
+
#Since dor-fetcher-service uses the is_alive gem, the main page should simply have okay on it
|
32
|
+
return "ok".eql?(resp.body)
|
20
33
|
end
|
21
34
|
|
22
35
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-fetcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carrick Rogers
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-11-
|
13
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|