swift-storage 0.0.7 → 0.0.8

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: d5027a353bfd4e6c5f9bd533401681f0e899d32a
4
- data.tar.gz: 3b2a7028a827f3908a1bc1a301e396913f640c14
3
+ metadata.gz: 48dc8b6b27a0f5b16dd2e4e7cac42a82e37df57a
4
+ data.tar.gz: 3c8502e2018f7fdefe1d2a1966f96f68e2ec5ad6
5
5
  SHA512:
6
- metadata.gz: 53063a6a6e977de46d0d6958710ac4a663f6279f8690fdfff969295cc3177d4f22335b1fd93fc7e39fced859fd53dce871249fbb8795d3cf340e5867f00849c4
7
- data.tar.gz: f8078ed653efd3dea9e803ce1244db130b11e97a9d8ff80c696ab9d09c87738c689b785c0a6c5d7100de404f18a5b9980c56fb00bdd6beeee1085aefb8b041ac
6
+ metadata.gz: 7aebfa7fe5e7a14d70ea68faa435d3002ca8d6bc17112ae808dcdd38c756c0d8ef4c4a9d48a4aa2b369a3ad6c28c15a22cf3d4b3f8a6e78f1000a96dde867d57
7
+ data.tar.gz: af225f4c2807e0582aa1a13d5fcb451f8e271dd83ecb91789d8ad622ec39c8c76bc9335fa907f12c3fa2a90b44d174310cbd550341b07a0a31bc696906dc7e39
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  This file is written in reverse chronological order, newer releases will
4
4
  appear at the top.
5
5
 
6
+ ## 0.0.8
7
+
8
+ * Check token expiration
9
+ [#9](https://github.com/memoways/swift-ruby/pull/9)
10
+ @ArmandPredicSis
11
+
6
12
  ## 0.0.7
7
13
 
8
14
  * URL encoding of special characters
@@ -11,6 +11,7 @@ module SwiftStorage
11
11
 
12
12
  JSON.parse(res.body).tap do |body|
13
13
  @auth_token = body['access']['token']['id']
14
+ @expires = body['access']['token']['expires']
14
15
  storage_endpoint(body['access']['serviceCatalog']) do |endpoint|
15
16
  self.storage_url = endpoint['publicURL']
16
17
  @storage_token = endpoint['id']
@@ -20,7 +21,7 @@ module SwiftStorage
20
21
  end
21
22
 
22
23
  def authenticated?
23
- !!(self.storage_url && auth_token)
24
+ !!(self.storage_url && auth_token && expires && Time.now.utc < Time.parse(expires).utc)
24
25
  end
25
26
 
26
27
  private
@@ -14,6 +14,7 @@ class SwiftStorage::Service
14
14
  :storage_url,
15
15
  :auth_token,
16
16
  :auth_at,
17
+ :expires,
17
18
  :storage_token,
18
19
  :storage_scheme,
19
20
  :storage_host,
@@ -1,3 +1,3 @@
1
1
  module SwiftStorage
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -49,7 +49,8 @@ RSpec.describe 'Auth' do
49
49
  {
50
50
  'access' => {
51
51
  'token' => {
52
- 'id' => 'auth_token'
52
+ 'id' => 'auth_token',
53
+ 'expires' => 'expires'
53
54
  },
54
55
  'serviceCatalog' => [
55
56
  {
@@ -82,6 +83,11 @@ RSpec.describe 'Auth' do
82
83
  expect(subject.auth_token).to eq('auth_token')
83
84
  end
84
85
 
86
+ it 'sets the expires at' do
87
+ subject.authenticate!
88
+ expect(subject.expires).to eq('expires')
89
+ end
90
+
85
91
  context 'when there is an object-store' do
86
92
  it 'sets the storage url' do
87
93
  subject.authenticate!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swift-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Goy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-01 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  version: '0'
181
181
  requirements: []
182
182
  rubyforge_project:
183
- rubygems_version: 2.4.5
183
+ rubygems_version: 2.4.5.1
184
184
  signing_key:
185
185
  specification_version: 4
186
186
  summary: Swift storage client.
@@ -191,3 +191,4 @@ test_files:
191
191
  - spec/swift/container_spec.rb
192
192
  - spec/swift/object_spec.rb
193
193
  - spec/swift/temp_url_spec.rb
194
+ has_rdoc: