klaro-client 0.5.1 → 0.5.6

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
  SHA256:
3
- metadata.gz: aff7c0b9a6e72271bf8ee2cba3f1e26e7756ed2c8bf04281dd7e77543ab2dc69
4
- data.tar.gz: e7465eb2440bfb672ea28e3b28a0230574645e340df369f52b5b312689ac5cfe
3
+ metadata.gz: 3e82871ec2a932573304a87dd1b95d3c8cd0a3bcbbc3716f9e5cc078f2cebb50
4
+ data.tar.gz: b26f00ca41e2d1d0e1efa7b2cee647e085b58f5752c8661c978ed48994f5080d
5
5
  SHA512:
6
- metadata.gz: bbe36e8a3f91eefb31cb1024e2f7232f972d781d3127cba53e11c72b8b73638c27ad624506d24e49ae214c8167e981a595104b7b46b3ddb31f65d7570253b14c
7
- data.tar.gz: 89383833c59d6923706040ec8641252beee2822bb7d7b1451b3d22497eb16e61562aee044d06ad08af40da24b0890d7b281d398a764b7e489b02712e11d99d01
6
+ metadata.gz: cd41f3a9b4883e60b8aa21b4503f49b7007a7d4e89f7c7d9d90e2a2ae852ab73587290cd8258a2e886f3e90d5eacbcc0008636beadfa73fd7e4d8b6ea0bc1766
7
+ data.tar.gz: 726d3e81ead2cab64c9fcea8debfb4c63e52638ced761278f303a9ee0c67789e3a1311d0085113f7cc4e28074f882738e2687ccc266bb4a596d3da4b3479182e
@@ -9,6 +9,7 @@ module Klaro
9
9
  @base_url = url.gsub(/\/api\/?$/, "")
10
10
  @token = nil
11
11
  @subdomain = nil
12
+ @workspace = nil
12
13
  end
13
14
 
14
15
  def authenticated?
@@ -25,12 +26,15 @@ module Klaro
25
26
  self
26
27
  end
27
28
 
28
- def authenticate(user, password)
29
- @token = get_token Http
30
- .headers({
31
- 'Content-Type' => 'application/json'
32
- })
33
- .post("#{base_url}/api/auth/tokens/", payload(user, password))
29
+ def authenticate(user, password, workspace = nil)
30
+ @workspace = workspace
31
+ @token = get_token(
32
+ Http
33
+ .headers({
34
+ 'Content-Type' => 'application/json'
35
+ })
36
+ .post("#{base_url}/api/auth/tokens/", payload(user, password))
37
+ )
34
38
  end
35
39
 
36
40
  def get(endpoint, raw = false)
@@ -80,6 +84,7 @@ module Klaro
80
84
  "Content-Type" => "application/json"
81
85
  }
82
86
  hs['Klaro-Project-Subdomain'] = @subdomain if @subdomain
87
+ hs['X-Klaro-ViewAs'] = @workspace if @workspace
83
88
  hs
84
89
  end
85
90
 
@@ -2,18 +2,23 @@ module Klaro
2
2
  class Client
3
3
  class Story < Resource
4
4
 
5
+ def _title
6
+ self[:title] || self[:description]
7
+ end
8
+
5
9
  def title
6
- @title ||= MdText.new(self.description.split("\n").first, :summary)
10
+ @title ||= MdText.new(self._title.split("\n").first, :summary)
7
11
  end
8
12
 
9
13
  def summary
10
- @summary ||= MdText.new(self.description.split("\n")[1..-1].join("\n"), :summary)
14
+ @summary ||= MdText.new(self._title.split("\n")[1..-1].join("\n"), :summary)
11
15
  end
12
16
 
13
- def specification
14
- @specification ||= MdText.new(super, :details)
17
+ def details
18
+ details = self[:details] || self[:specification]
19
+ @specification ||= MdText.new(details, :details)
15
20
  end
16
- alias :details :specification
21
+ alias :specification :details
17
22
 
18
23
  def linked_cards
19
24
  @linked_cards ||= (self.linked || []).map{|s| Story.dress(s, @client) }
@@ -42,7 +47,8 @@ module Klaro
42
47
  url = attachment.url
43
48
  url += "?n=" + URI.encode_www_form_component(attachment.filename) unless url =~ /\?n=/
44
49
  path = handle_image(url, root_path, target_folder, client)
45
- attachment.merge(url => path)
50
+ attachment.url = path
51
+ attachment
46
52
  end
47
53
  self.class.dress(self.to_h.merge(
48
54
  attachments: as
@@ -3,7 +3,7 @@ module Klaro
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 5
6
- TINY = 1
6
+ TINY = 6
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.1
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - enspirit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-29 00:00:00.000000000 Z
11
+ date: 2021-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -44,20 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: '3.4'
47
+ version: 3.5.1
51
48
  type: :runtime
52
49
  prerelease: false
53
50
  version_requirements: !ruby/object:Gem::Requirement
54
51
  requirements:
55
52
  - - "~>"
56
53
  - !ruby/object:Gem::Version
57
- version: '3.0'
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: '3.4'
54
+ version: 3.5.1
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: i18n
63
57
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +116,6 @@ extra_rdoc_files: []
122
116
  files:
123
117
  - Gemfile
124
118
  - Rakefile
125
- - VERSION
126
119
  - lib/klaro/client.rb
127
120
  - lib/klaro/client/errors.rb
128
121
  - lib/klaro/client/request_handler.rb
@@ -155,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
148
  - !ruby/object:Gem::Version
156
149
  version: '0'
157
150
  requirements: []
158
- rubygems_version: 3.1.2
151
+ rubygems_version: 3.1.6
159
152
  signing_key:
160
153
  specification_version: 4
161
154
  summary: Klaro Client
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.3.0