klaro-client 0.4.4 → 0.5.3

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: '08aa3f977345513aca8d374ebe5e837d580bd95cf75da1bf555bd170858f3401'
4
- data.tar.gz: 4ce2e6929c252660a35c13aa317ac8de7a4c715d4bf5b717119b61bb32a6929f
3
+ metadata.gz: f20df5ac528c8af7480b9b108e1ecc0e6e173b6dac506d7d2236407f8ecc2f90
4
+ data.tar.gz: ebd98f26c88b52072c9c4428a3b40c38aa006cce30f2a65570288fb8def60334
5
5
  SHA512:
6
- metadata.gz: 01a6d53e1763a1b8e37b3777ab56bc2edd24cc28b4d6de447df8af75bc8c513bc45a9c7d9832e6fe942eff82d712b5aefad258a1035035b9f0d5e60a5e0f70cf
7
- data.tar.gz: 27f1f1183ec289d2b2ae2b4ae6cfc0a1a14d7f42d1f31c7ee9a123291c4d320e11eee2c9d078019ddf1de65649636a180d3368695e8269c4ab5ebd9bd8925e92
6
+ metadata.gz: 9e069f401a3c7181d956ccd8fed1135f2512275bbfd0e1f6322851c41c2171b3f5944485dbba5fc3326dd616ced29fa25debfc8a214dcb5e54d2d61be18b874e
7
+ data.tar.gz: 32069d79b9ab8e4979172f0ebdfcf4c1947aa600e374340aab8fc1139aa0aae1055f102bf4dae130ed70da93534b37a8d1c6da90465386af216f9adb0ff21474
data/lib/klaro/client.rb CHANGED
@@ -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)
@@ -15,6 +15,10 @@ module Klaro
15
15
  end
16
16
  alias :details :specification
17
17
 
18
+ def linked_cards
19
+ @linked_cards ||= (self.linked || []).map{|s| Story.dress(s, @client) }
20
+ end
21
+
18
22
  def attachments
19
23
  @attachments || super.map{|a| Attachment.dress(a, @client) }
20
24
  end
@@ -38,7 +42,8 @@ module Klaro
38
42
  url = attachment.url
39
43
  url += "?n=" + URI.encode_www_form_component(attachment.filename) unless url =~ /\?n=/
40
44
  path = handle_image(url, root_path, target_folder, client)
41
- attachment.merge(url => path)
45
+ attachment.url = path
46
+ attachment
42
47
  end
43
48
  self.class.dress(self.to_h.merge(
44
49
  attachments: as
@@ -33,7 +33,7 @@ module Klaro
33
33
  end
34
34
 
35
35
  def to_html
36
- @renderer.render(to_s).strip
36
+ @renderer.render(to_s).strip.gsub(/<a href/, '<a target="_blank" href')
37
37
  end
38
38
 
39
39
  end # class MdText
@@ -2,8 +2,8 @@ module Klaro
2
2
  class Client
3
3
  module Version
4
4
  MAJOR = 0
5
- MINOR = 4
6
- TINY = 4
5
+ MINOR = 5
6
+ TINY = 3
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.4.4
4
+ version: 0.5.3
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-15 00:00:00.000000000 Z
11
+ date: 2021-05-07 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,8 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
148
  - !ruby/object:Gem::Version
156
149
  version: '0'
157
150
  requirements: []
158
- rubyforge_project:
159
- rubygems_version: 2.7.6
151
+ rubygems_version: 3.0.8
160
152
  signing_key:
161
153
  specification_version: 4
162
154
  summary: Klaro Client
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.3.0