klaro-client 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b7b19ab7905f35aa15fb577103003b7b6ff544925653cd81107d40b11ecdcc5
4
- data.tar.gz: cb069e6663aaf958431d2423151fb63b6cfb7029ce6a02c15e32c9c54dca10dd
3
+ metadata.gz: aff7c0b9a6e72271bf8ee2cba3f1e26e7756ed2c8bf04281dd7e77543ab2dc69
4
+ data.tar.gz: e7465eb2440bfb672ea28e3b28a0230574645e340df369f52b5b312689ac5cfe
5
5
  SHA512:
6
- metadata.gz: e8b9f60a516f7c591bd131515b716c110c9f82c3bdc179120b2be60409df05a3d48f982c70c6bcd63f84795261b8999bb4e6eded377c888f235f32c36c80c453
7
- data.tar.gz: 3ff5d8819721a23b2be719baac8013dbbcbeccb0fa256754540b2729c83acc78a6c5f0a2198b98257804a3b2745f9328a59f5bb041bf61a3ad2392444c6e4a3c
6
+ metadata.gz: bbe36e8a3f91eefb31cb1024e2f7232f972d781d3127cba53e11c72b8b73638c27ad624506d24e49ae214c8167e981a595104b7b46b3ddb31f65d7570253b14c
7
+ data.tar.gz: 89383833c59d6923706040ec8641252beee2822bb7d7b1451b3d22497eb16e61562aee044d06ad08af40da24b0890d7b281d398a764b7e489b02712e11d99d01
@@ -19,6 +19,10 @@ module Klaro
19
19
  request.with_token(*args, &bl)
20
20
  end
21
21
 
22
+ def with_project(*args, &bl)
23
+ request.with_project(*args, &bl)
24
+ end
25
+
22
26
  def login(*args, &bl)
23
27
  request.authenticate(*args, &bl)
24
28
  end
@@ -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
- "Authorization" => @token,
71
- "Content-Type" => "application/json"
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)
@@ -3,7 +3,7 @@ module Klaro
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 5
6
- TINY = 0
6
+ TINY = 1
7
7
  end
8
8
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
9
9
  end # class Client
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.0
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-04-22 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv