concourse.rb 0.1.0.pre.6 → 0.3.0.pre.1
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/Gemfile.lock +1 -1
- data/lib/concourse.rb +1 -0
- data/lib/concourse/client.rb +0 -2
- data/lib/concourse/models.rb +6 -0
- data/lib/concourse/models/token.rb +32 -0
- data/lib/concourse/sub_clients/skymarshal_client.rb +7 -11
- data/lib/concourse/urls.rb +9 -3
- data/lib/concourse/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebf716759e328b59403cfd2b10d9c6a26c8b7c17ab373b226f6941e712076ddb
|
4
|
+
data.tar.gz: 7c8366afe14b256a551c8951e0687f3dcf3ec1487f915ef9f56129e99b68589d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02d9982cbe438aabb453c4c7979babc5ddb0f958687bd5c0379ef8de6da30d4922c047a11594e79ce00ad047ab982b3b7d50e50a58b4685f7bb21deba4e11b81
|
7
|
+
data.tar.gz: 418c7575d2816685ee5eca5d70585f44e9a35493d002683d59b3c25798f1c4efde9221014b556dfdc2f52ba860a797400d82bebe8700175e902de44a78151f4b
|
data/Gemfile.lock
CHANGED
data/lib/concourse.rb
CHANGED
data/lib/concourse/client.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Concourse
|
2
|
+
module Models
|
3
|
+
class Token
|
4
|
+
attr_reader :access_token, :token_type, :expires_at, :id_token
|
5
|
+
|
6
|
+
def initialize(parameters)
|
7
|
+
@access_token = parameters[:access_token]
|
8
|
+
@token_type = parameters[:token_type]
|
9
|
+
@expires_at = parameters[:expires_at]
|
10
|
+
@id_token = parameters[:id_token]
|
11
|
+
end
|
12
|
+
|
13
|
+
def ==(other)
|
14
|
+
other.class == self.class && other.state == state
|
15
|
+
end
|
16
|
+
|
17
|
+
def eql?(other)
|
18
|
+
self == other
|
19
|
+
end
|
20
|
+
|
21
|
+
def hash
|
22
|
+
state.hash
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
def state
|
28
|
+
[@access_token, @token_type, @expires_at, @id_token]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'semantic'
|
2
|
-
require '
|
2
|
+
require 'time'
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
require 'concourse/urls'
|
@@ -70,31 +70,27 @@ module Concourse
|
|
70
70
|
|
71
71
|
def token(token_response)
|
72
72
|
token_response_date = @version >= VERSION_6_1 ?
|
73
|
-
|
73
|
+
Time.parse(
|
74
74
|
token_response.headers[Concourse::HeaderNames.date]) :
|
75
75
|
nil
|
76
76
|
token_response_body =
|
77
77
|
JSON.parse(token_response.body, symbolize_names: true)
|
78
78
|
|
79
|
-
seconds_in_a_day = 60 * 60 * 24
|
80
|
-
|
81
79
|
@version >= VERSION_6_1 ?
|
82
|
-
|
80
|
+
Models::Token.new(
|
83
81
|
access_token: token_response_body[:access_token],
|
84
82
|
token_type: token_response_body[:token_type].downcase,
|
85
83
|
expires_at:
|
86
|
-
(token_response_date +
|
87
|
-
(token_response_body[:expires_in] /
|
88
|
-
seconds_in_a_day))
|
84
|
+
(token_response_date + token_response_body[:expires_in])
|
89
85
|
.iso8601,
|
90
86
|
id_token: token_response_body[:id_token]
|
91
|
-
|
92
|
-
|
87
|
+
) :
|
88
|
+
Models::Token.new(
|
93
89
|
access_token: token_response_body[:access_token],
|
94
90
|
token_type: token_response_body[:token_type].downcase,
|
95
91
|
expires_at: token_response_body[:expiry],
|
96
92
|
id_token: token_response_body[:access_token]
|
97
|
-
|
93
|
+
)
|
98
94
|
end
|
99
95
|
end
|
100
96
|
end
|
data/lib/concourse/urls.rb
CHANGED
@@ -1,19 +1,25 @@
|
|
1
1
|
module Concourse
|
2
2
|
module Urls
|
3
3
|
def self.api_url(concourse_url)
|
4
|
-
"#{concourse_url}/api/v1"
|
4
|
+
"#{base_url(concourse_url)}/api/v1"
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.sky_token_url(concourse_url)
|
8
|
-
"#{concourse_url}/sky/token"
|
8
|
+
"#{base_url(concourse_url)}/sky/token"
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.sky_issuer_token_url(concourse_url)
|
12
|
-
"#{concourse_url}/sky/issuer/token"
|
12
|
+
"#{base_url(concourse_url)}/sky/issuer/token"
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.info_url(concourse_url)
|
16
16
|
"#{api_url(concourse_url)}/info"
|
17
17
|
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def self.base_url(concourse_url)
|
22
|
+
concourse_url.chomp('/')
|
23
|
+
end
|
18
24
|
end
|
19
25
|
end
|
data/lib/concourse/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concourse.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby Clemson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -225,6 +225,8 @@ files:
|
|
225
225
|
- lib/concourse.rb
|
226
226
|
- lib/concourse/client.rb
|
227
227
|
- lib/concourse/headers.rb
|
228
|
+
- lib/concourse/models.rb
|
229
|
+
- lib/concourse/models/token.rb
|
228
230
|
- lib/concourse/sub_clients.rb
|
229
231
|
- lib/concourse/sub_clients/skymarshal_client.rb
|
230
232
|
- lib/concourse/urls.rb
|