klaro-client 0.4.5 → 0.5.4

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: e05f779074b6f1eede95bf3ee70e883810b3b44a16ce69c30d625c3974fb16e9
4
- data.tar.gz: 552567fd91a496d359e1971ef4474488adebac93cf407083ed3d542d2141ab7c
3
+ metadata.gz: 861ca7e05a88b52d1a475a351a120f428d91ac21caacfbc06e12e5c6a9f84bc2
4
+ data.tar.gz: 20d95370861307e0d5534fb698af187cb41882914962baeb99c478a1049881b3
5
5
  SHA512:
6
- metadata.gz: 0d9a7d9c2fd276579a760f8f84b8e1e66e3263531511360cf19edc5418121220ae8e415b2aefb976bc774004881322670ae98a3d8be4a11a7d25a0bbcbd900e3
7
- data.tar.gz: f7697851a2961b60d247040b41a320829f6f7b353eb27b62d0f9a7447217fc96292190fe679b331eec394d5a10944fa26b47f0d652b3de53dbfdbd1472a092bb
6
+ metadata.gz: 28aee1dbfff5699f51493402a05c1bc7e973ea13912d8919b5719682e7cd904bffed37a72480b1179bb65df55f6ce47c7315440aa098971fb937b6f65c22d7be
7
+ data.tar.gz: 7a9fb6bb70ddac52bfcdb1c424f7287c6fbf86adb6f6635cdba1ad1ce20f787bd2dfe493d54d5daa8f0c46a81a53494dc06e70297d11a07fd9c780edbb332bcd
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)
@@ -2,18 +2,27 @@ 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)
15
+ end
16
+
17
+ def details
18
+ details = self[:details] || self[:specification]
19
+ @specification ||= MdText.new(details, :details)
11
20
  end
21
+ alias :specification :details
12
22
 
13
- def specification
14
- @specification ||= MdText.new(super, :details)
23
+ def linked_cards
24
+ @linked_cards ||= (self.linked || []).map{|s| Story.dress(s, @client) }
15
25
  end
16
- alias :details :specification
17
26
 
18
27
  def attachments
19
28
  @attachments || super.map{|a| Attachment.dress(a, @client) }
@@ -38,7 +47,8 @@ module Klaro
38
47
  url = attachment.url
39
48
  url += "?n=" + URI.encode_www_form_component(attachment.filename) unless url =~ /\?n=/
40
49
  path = handle_image(url, root_path, target_folder, client)
41
- attachment.merge(url => path)
50
+ attachment.url = path
51
+ attachment
42
52
  end
43
53
  self.class.dress(self.to_h.merge(
44
54
  attachments: as
@@ -2,8 +2,8 @@ module Klaro
2
2
  class Client
3
3
  module Version
4
4
  MAJOR = 0
5
- MINOR = 4
6
- TINY = 5
5
+ MINOR = 5
6
+ TINY = 4
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.5
4
+ version: 0.5.4
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-09 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