async-vikunja 1.0.0

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.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +362 -0
  3. data/lib/async/vikunja/admin.rb +97 -0
  4. data/lib/async/vikunja/assignees.rb +20 -0
  5. data/lib/async/vikunja/attachments.rb +51 -0
  6. data/lib/async/vikunja/auth.rb +52 -0
  7. data/lib/async/vikunja/bots.rb +43 -0
  8. data/lib/async/vikunja/buckets.rb +51 -0
  9. data/lib/async/vikunja/client.rb +76 -0
  10. data/lib/async/vikunja/comments.rb +31 -0
  11. data/lib/async/vikunja/error.rb +52 -0
  12. data/lib/async/vikunja/escape.rb +9 -0
  13. data/lib/async/vikunja/filters.rb +39 -0
  14. data/lib/async/vikunja/labels.rb +71 -0
  15. data/lib/async/vikunja/migration.rb +89 -0
  16. data/lib/async/vikunja/notifications.rb +45 -0
  17. data/lib/async/vikunja/page.rb +112 -0
  18. data/lib/async/vikunja/projects.rb +133 -0
  19. data/lib/async/vikunja/reactions.rb +19 -0
  20. data/lib/async/vikunja/redacted.rb +37 -0
  21. data/lib/async/vikunja/representation.rb +73 -0
  22. data/lib/async/vikunja/service.rb +137 -0
  23. data/lib/async/vikunja/sessions.rb +29 -0
  24. data/lib/async/vikunja/settings.rb +67 -0
  25. data/lib/async/vikunja/sharing.rb +131 -0
  26. data/lib/async/vikunja/submit.rb +97 -0
  27. data/lib/async/vikunja/subscriptions.rb +21 -0
  28. data/lib/async/vikunja/tasks.rb +207 -0
  29. data/lib/async/vikunja/teams.rb +85 -0
  30. data/lib/async/vikunja/time_entries.rb +55 -0
  31. data/lib/async/vikunja/tokens.rb +59 -0
  32. data/lib/async/vikunja/users.rb +107 -0
  33. data/lib/async/vikunja/version.rb +10 -0
  34. data/lib/async/vikunja/views.rb +75 -0
  35. data/lib/async/vikunja/webhooks.rb +55 -0
  36. data/lib/async/vikunja/wrapper.rb +75 -0
  37. data/lib/async/vikunja.rb +2 -0
  38. data/license.md +21 -0
  39. metadata +105 -0
@@ -0,0 +1,75 @@
1
+ require "async/rest/wrapper/json"
2
+ require "protocol/http/body/buffered"
3
+
4
+ module Async
5
+ module Vikunja
6
+ class Wrapper < Async::REST::Wrapper::JSON
7
+ JSON_SUFFIX = "json"
8
+
9
+ def response_for(resource, request) = resource.call(request)
10
+
11
+ def parser_for(response)
12
+ content_type = response.headers["content-type"]
13
+
14
+ if content_type&.include?(JSON_SUFFIX)
15
+ Async::REST::Wrapper::JSON::Parser
16
+ end
17
+ end
18
+ end
19
+
20
+ class MergePatch < Wrapper
21
+ MERGE_PATCH_JSON = "application/merge-patch+json"
22
+
23
+ def prepare_request(request, payload)
24
+ request.headers["accept"] ||= self.content_type
25
+
26
+ if payload
27
+ request.headers["content-type"] = MERGE_PATCH_JSON
28
+ request.body = ::Protocol::HTTP::Body::Buffered.new([::JSON.dump(payload)])
29
+ end
30
+ end
31
+ end
32
+
33
+ class Multipart < Wrapper
34
+ MULTIPART_FORM_DATA = "multipart/form-data"
35
+
36
+ BOUNDARY = "async-vikunja-boundary"
37
+
38
+ OCTET_STREAM = "application/octet-stream"
39
+
40
+ CRLF = "\r\n"
41
+
42
+ def prepare_request(request, payload)
43
+ request.headers["accept"] ||= self.content_type
44
+
45
+ if payload
46
+ request.headers["content-type"] = MULTIPART_FORM_DATA + "; boundary=" + BOUNDARY
47
+ request.body = ::Protocol::HTTP::Body::Buffered.new([self.encode(payload)])
48
+ end
49
+ end
50
+
51
+ def encode(parts)
52
+ String.new.tap do |encoded|
53
+ Array(parts).each do |part|
54
+ encoded << "--" + BOUNDARY + CRLF
55
+ encoded << "content-disposition: form-data; " + self.disposition_of(part) + CRLF
56
+ encoded << "content-type: " + (part[:content_type] || OCTET_STREAM) + CRLF
57
+ encoded << CRLF
58
+ encoded << part.fetch(:body).to_s
59
+ encoded << CRLF
60
+ end
61
+
62
+ encoded << "--" + BOUNDARY + "--" + CRLF
63
+ end
64
+ end
65
+
66
+ def disposition_of(part)
67
+ ("name=" + part.fetch(:name).to_s.inspect).tap do |disposition|
68
+ if part[:filename]
69
+ disposition << "; filename=" + part[:filename].to_s.inspect
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,2 @@
1
+ require_relative "vikunja/client"
2
+ require_relative "vikunja/version"
data/license.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright, 2026, by Nathan Kidd.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: async-vikunja
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Nathan Kidd
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-01 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: async-rest
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '0.20'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '0.20'
26
+ - !ruby/object:Gem::Dependency
27
+ name: gem_kit
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '0.2'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.2'
40
+ email:
41
+ - nathankidd@hey.com
42
+ executables: []
43
+ extensions: []
44
+ extra_rdoc_files: []
45
+ files:
46
+ - README.md
47
+ - lib/async/vikunja.rb
48
+ - lib/async/vikunja/admin.rb
49
+ - lib/async/vikunja/assignees.rb
50
+ - lib/async/vikunja/attachments.rb
51
+ - lib/async/vikunja/auth.rb
52
+ - lib/async/vikunja/bots.rb
53
+ - lib/async/vikunja/buckets.rb
54
+ - lib/async/vikunja/client.rb
55
+ - lib/async/vikunja/comments.rb
56
+ - lib/async/vikunja/error.rb
57
+ - lib/async/vikunja/escape.rb
58
+ - lib/async/vikunja/filters.rb
59
+ - lib/async/vikunja/labels.rb
60
+ - lib/async/vikunja/migration.rb
61
+ - lib/async/vikunja/notifications.rb
62
+ - lib/async/vikunja/page.rb
63
+ - lib/async/vikunja/projects.rb
64
+ - lib/async/vikunja/reactions.rb
65
+ - lib/async/vikunja/redacted.rb
66
+ - lib/async/vikunja/representation.rb
67
+ - lib/async/vikunja/service.rb
68
+ - lib/async/vikunja/sessions.rb
69
+ - lib/async/vikunja/settings.rb
70
+ - lib/async/vikunja/sharing.rb
71
+ - lib/async/vikunja/submit.rb
72
+ - lib/async/vikunja/subscriptions.rb
73
+ - lib/async/vikunja/tasks.rb
74
+ - lib/async/vikunja/teams.rb
75
+ - lib/async/vikunja/time_entries.rb
76
+ - lib/async/vikunja/tokens.rb
77
+ - lib/async/vikunja/users.rb
78
+ - lib/async/vikunja/version.rb
79
+ - lib/async/vikunja/views.rb
80
+ - lib/async/vikunja/webhooks.rb
81
+ - lib/async/vikunja/wrapper.rb
82
+ - license.md
83
+ homepage: https://github.com/n-at-han-k/async-vikunja
84
+ licenses:
85
+ - MIT
86
+ metadata:
87
+ source_code_uri: https://github.com/n-at-han-k/async-vikunja
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '3.3'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubygems_version: 3.7.2
103
+ specification_version: 4
104
+ summary: An asynchronous Ruby client for the Vikunja API.
105
+ test_files: []