swift-storage 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/swift_storage/auth/v2_0.rb +2 -1
- data/lib/swift_storage/service.rb +1 -0
- data/lib/swift_storage/version.rb +1 -1
- data/spec/swift/auth_spec.rb +7 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48dc8b6b27a0f5b16dd2e4e7cac42a82e37df57a
|
4
|
+
data.tar.gz: 3c8502e2018f7fdefe1d2a1966f96f68e2ec5ad6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/spec/swift/auth_spec.rb
CHANGED
@@ -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.
|
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-
|
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:
|