arvados 0.1.20140812091227 → 0.1.20140812101132
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arvados.rb +13 -7
- 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: b37978dafb1cdd898c967c329fad09ccb6f57ef6
|
4
|
+
data.tar.gz: 8686d4fb2237999c743a805ef4fb0137a7014a37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31f4f97986124fd655f20989255111283b5361567dcf0031ca4dad367658b0a1f15fb88c73def06e5f760470cb801edce682bbad8ef982aabc22da89d97e84a9
|
7
|
+
data.tar.gz: ff1674d188cd176da086928a5054af4f3636ff85049ff8a7764bd7db713a5a0e94b71df06e6d0d745555f07f11b331e24fa695cbb9ffe74c2e113f03bb0eb119
|
data/lib/arvados.rb
CHANGED
@@ -108,17 +108,23 @@ class Arvados
|
|
108
108
|
class Google::APIClient
|
109
109
|
def discovery_document(api, version)
|
110
110
|
api = api.to_s
|
111
|
-
|
111
|
+
discovery_uri = self.discovery_uri(api, version)
|
112
|
+
discovery_uri_hash = Digest::MD5.hexdigest(discovery_uri)
|
113
|
+
return @discovery_documents[discovery_uri_hash] ||=
|
112
114
|
begin
|
113
115
|
# fetch new API discovery doc if stale
|
114
|
-
cached_doc = File.expand_path
|
115
|
-
if not File.exist?(cached_doc) or (Time.now - File.mtime(cached_doc)) > 86400
|
116
|
+
cached_doc = File.expand_path "~/.cache/arvados/discovery-#{discovery_uri_hash}.json" rescue nil
|
117
|
+
if cached_doc.nil? or not File.exist?(cached_doc) or (Time.now - File.mtime(cached_doc)) > 86400
|
116
118
|
response = self.execute!(:http_method => :get,
|
117
|
-
:uri =>
|
119
|
+
:uri => discovery_uri,
|
118
120
|
:authenticated => false)
|
119
|
-
|
120
|
-
|
121
|
-
|
121
|
+
begin
|
122
|
+
FileUtils.makedirs(File.dirname cached_doc)
|
123
|
+
File.open(cached_doc, 'w') do |f|
|
124
|
+
f.puts response.body
|
125
|
+
end
|
126
|
+
rescue
|
127
|
+
return JSON.load response.body
|
122
128
|
end
|
123
129
|
end
|
124
130
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arvados
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.20140812101132
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arvados Authors
|
@@ -86,7 +86,7 @@ dependencies:
|
|
86
86
|
- - "<"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: 1.0.0
|
89
|
-
description: This is the Arvados SDK gem, git revision
|
89
|
+
description: This is the Arvados SDK gem, git revision 57ee96926d2d3d315ece3b2cbfb20d0fe01ab912
|
90
90
|
email: gem-dev@curoverse.com
|
91
91
|
executables: []
|
92
92
|
extensions: []
|