klaro-client 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/klaro/client.rb +4 -0
- data/lib/klaro/client/request_handler.rb +17 -7
- data/lib/klaro/client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aff7c0b9a6e72271bf8ee2cba3f1e26e7756ed2c8bf04281dd7e77543ab2dc69
|
4
|
+
data.tar.gz: e7465eb2440bfb672ea28e3b28a0230574645e340df369f52b5b312689ac5cfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbe36e8a3f91eefb31cb1024e2f7232f972d781d3127cba53e11c72b8b73638c27ad624506d24e49ae214c8167e981a595104b7b46b3ddb31f65d7570253b14c
|
7
|
+
data.tar.gz: 89383833c59d6923706040ec8641252beee2822bb7d7b1451b3d22497eb16e61562aee044d06ad08af40da24b0890d7b281d398a764b7e489b02712e11d99d01
|
data/lib/klaro/client.rb
CHANGED
@@ -6,8 +6,9 @@ module Klaro
|
|
6
6
|
attr_reader :base_url, :token
|
7
7
|
|
8
8
|
def initialize(url)
|
9
|
-
@base_url = url
|
9
|
+
@base_url = url.gsub(/\/api\/?$/, "")
|
10
10
|
@token = nil
|
11
|
+
@subdomain = nil
|
11
12
|
end
|
12
13
|
|
13
14
|
def authenticated?
|
@@ -19,6 +20,11 @@ module Klaro
|
|
19
20
|
self
|
20
21
|
end
|
21
22
|
|
23
|
+
def with_project(subdomain)
|
24
|
+
@subdomain = subdomain
|
25
|
+
self
|
26
|
+
end
|
27
|
+
|
22
28
|
def authenticate(user, password)
|
23
29
|
@token = get_token Http
|
24
30
|
.headers({
|
@@ -65,12 +71,16 @@ module Klaro
|
|
65
71
|
end
|
66
72
|
|
67
73
|
def http
|
68
|
-
Http.headers(
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
+
Http.headers(http_headers)
|
75
|
+
end
|
76
|
+
|
77
|
+
def http_headers
|
78
|
+
hs = {
|
79
|
+
"Authorization" => @token,
|
80
|
+
"Content-Type" => "application/json"
|
81
|
+
}
|
82
|
+
hs['Klaro-Project-Subdomain'] = @subdomain if @subdomain
|
83
|
+
hs
|
74
84
|
end
|
75
85
|
|
76
86
|
def info(msg)
|
data/lib/klaro/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klaro-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- enspirit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|