arvados 0.1.20140812091227 → 0.1.20140812101132

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/arvados.rb +13 -7
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c6ce242e75a8a7f3aadac18be9789f07b1a4af9
4
- data.tar.gz: 5412a9cc3bfe2a93dd766c67852e65879d4d9dfe
3
+ metadata.gz: b37978dafb1cdd898c967c329fad09ccb6f57ef6
4
+ data.tar.gz: 8686d4fb2237999c743a805ef4fb0137a7014a37
5
5
  SHA512:
6
- metadata.gz: 142ae61b26e21e78f70f0081e53839788d451bcc05fefaeb2009acacb12ca628228d43e4ede640624ec2316eac471743d2f5ece7f08647abdec7fc522925d68c
7
- data.tar.gz: ac35615d40b37a29c3c7196b0f3449f2147c8df1dd85ad1860e912bc0d1a0ee71dde76652cabb5e092aea3687cd7eaec363b1887e868cf30278833e6724bdebd
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
- return @discovery_documents["#{api}:#{version}"] ||=
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 '~/.cache/arvados/discovery_uri.json'
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 => self.discovery_uri(api, version),
119
+ :uri => discovery_uri,
118
120
  :authenticated => false)
119
- FileUtils.makedirs(File.dirname cached_doc)
120
- File.open(cached_doc, 'w') do |f|
121
- f.puts response.body
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.20140812091227
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 ed1580a38c1aae0910cef83605622a41d927fba3
89
+ description: This is the Arvados SDK gem, git revision 57ee96926d2d3d315ece3b2cbfb20d0fe01ab912
90
90
  email: gem-dev@curoverse.com
91
91
  executables: []
92
92
  extensions: []