onlyoffice-docs_integration_sdk 0.1.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 (31) hide show
  1. checksums.yaml +7 -0
  2. data/lib/onlyoffice/docs_integration_sdk/document_editor/config.rb +1479 -0
  3. data/lib/onlyoffice/docs_integration_sdk/document_editor/config_test.rb +1713 -0
  4. data/lib/onlyoffice/docs_integration_sdk/document_editor.rb +29 -0
  5. data/lib/onlyoffice/docs_integration_sdk/document_server/client/command.rb +417 -0
  6. data/lib/onlyoffice/docs_integration_sdk/document_server/client/command_test.rb +672 -0
  7. data/lib/onlyoffice/docs_integration_sdk/document_server/client/conversion.rb +477 -0
  8. data/lib/onlyoffice/docs_integration_sdk/document_server/client/conversion_test.rb +682 -0
  9. data/lib/onlyoffice/docs_integration_sdk/document_server/client/healthcheck.rb +101 -0
  10. data/lib/onlyoffice/docs_integration_sdk/document_server/client/healthcheck_test.rb +209 -0
  11. data/lib/onlyoffice/docs_integration_sdk/document_server/client/jwt.rb +116 -0
  12. data/lib/onlyoffice/docs_integration_sdk/document_server/client/jwt_test.rb +70 -0
  13. data/lib/onlyoffice/docs_integration_sdk/document_server/client/response.rb +73 -0
  14. data/lib/onlyoffice/docs_integration_sdk/document_server/client/response_test.rb +49 -0
  15. data/lib/onlyoffice/docs_integration_sdk/document_server/client/service.rb +44 -0
  16. data/lib/onlyoffice/docs_integration_sdk/document_server/client/ua.rb +31 -0
  17. data/lib/onlyoffice/docs_integration_sdk/document_server/client/ua_test.rb +35 -0
  18. data/lib/onlyoffice/docs_integration_sdk/document_server/client.rb +321 -0
  19. data/lib/onlyoffice/docs_integration_sdk/document_server/client_test.rb +1259 -0
  20. data/lib/onlyoffice/docs_integration_sdk/document_server.rb +29 -0
  21. data/lib/onlyoffice/docs_integration_sdk/document_storage/callback.rb +276 -0
  22. data/lib/onlyoffice/docs_integration_sdk/document_storage/callback_test.rb +291 -0
  23. data/lib/onlyoffice/docs_integration_sdk/document_storage.rb +29 -0
  24. data/lib/onlyoffice/docs_integration_sdk/jwt.rb +448 -0
  25. data/lib/onlyoffice/docs_integration_sdk/jwt_test.rb +598 -0
  26. data/lib/onlyoffice/docs_integration_sdk/test_test.rb +113 -0
  27. data/lib/onlyoffice/docs_integration_sdk/version.rb +26 -0
  28. data/lib/onlyoffice/docs_integration_sdk/version_test.rb +33 -0
  29. data/lib/onlyoffice/docs_integration_sdk.rb +31 -0
  30. data/lib/onlyoffice.rb +21 -0
  31. metadata +283 -0
@@ -0,0 +1,101 @@
1
+ #
2
+ # (c) Copyright Ascensio System SIA 2025
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ # typed: false
18
+ # frozen_string_literal: true
19
+
20
+ require "sorbet-runtime"
21
+ require_relative "response"
22
+ require_relative "service"
23
+
24
+ module Onlyoffice
25
+ module DocsIntegrationSdk
26
+ module DocumentServer
27
+ class Client
28
+ # HealthcheckServing is an interface that describes the methods that
29
+ # must be implemented to be considered a healthcheck service.
30
+ #
31
+ # @since 0.1.0
32
+ module HealthcheckServing
33
+ extend T::Sig
34
+ extend T::Helpers
35
+ interface!
36
+
37
+ sig {abstract.returns(Response)}
38
+ def do; end
39
+ end
40
+
41
+ # HealthcheckService is an implementation of the {HealthcheckServing}
42
+ # interface.
43
+ #
44
+ # @since 0.1.0
45
+ class HealthcheckService < Service
46
+ include HealthcheckServing
47
+
48
+ # Error is an enum that represents the possible errors that can occur
49
+ # when using the healthcheck service.
50
+ #
51
+ # @since 0.1.0
52
+ class Error < T::Enum
53
+ extend T::Sig
54
+
55
+ enums do
56
+ # @since 0.1.0
57
+ Failed = new(-1)
58
+ end
59
+
60
+ # description returns the human-readable description of the error.
61
+ #
62
+ # @since 0.1.0
63
+ sig {returns(String)}
64
+ def description
65
+ case self
66
+ when Failed
67
+ "Healthcheck failed"
68
+ else
69
+ # :nocov:
70
+ # unreachable
71
+ # :nocov:
72
+ end
73
+ end
74
+ end
75
+
76
+ # do makes a healthcheck request to the Document Server.
77
+ #
78
+ # @return A response
79
+ # @since 0.1.0
80
+ sig {override.returns(Response)}
81
+ def do
82
+ c, res = @client.get("healthcheck")
83
+ if res.error
84
+ return res
85
+ end
86
+
87
+ if !c.is_a?(TrueClass)
88
+ res = Response.new(
89
+ request: res.request,
90
+ response: res.response,
91
+ error: Error::Failed,
92
+ )
93
+ end
94
+
95
+ res
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,209 @@
1
+ #
2
+ # (c) Copyright Ascensio System SIA 2025
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ # typed: true
18
+ # frozen_string_literal: true
19
+
20
+ require "test/unit"
21
+ require_relative "../../jwt"
22
+ require_relative "../../test_test"
23
+ require_relative "../client_test"
24
+ require_relative "healthcheck"
25
+
26
+ module Onlyoffice
27
+ module DocsIntegrationSdk
28
+ module DocumentServer
29
+ class Client
30
+ class HealthcheckService
31
+ class ErrorTest < ::Test::Unit::TestCase
32
+ extend T::Sig
33
+ include Test::DescriptiveEnumMarshalling
34
+
35
+ sig {override.returns(T::Array[[Integer, String, Error]])}
36
+ def cases
37
+ [
38
+ [
39
+ -1,
40
+ "Healthcheck failed",
41
+ Error::Failed,
42
+ ]
43
+ ]
44
+ end
45
+ end
46
+ end
47
+
48
+ class HealthcheckServiceTest < ::Test::Unit::TestCase
49
+ extend T::Sig
50
+ include Test::DocumentServer::Client
51
+
52
+ def test_do_does
53
+ t = self
54
+
55
+ m = "GET"
56
+ u = T.cast(URI.parse("http://localhost:8080/"), URI::HTTP)
57
+ p = T.cast(URI.join(u.to_s, "healthcheck"), URI::HTTP)
58
+ h = T.let(Net::HTTP.new(u.hostname, u.port), Net::HTTP)
59
+
60
+ h.define_singleton_method(:request) do |req, body = nil, &block|
61
+ t.check_request_basics(m, p, req)
62
+ t.check_request_headers(m, u, req)
63
+ t.assert_nil(req.body)
64
+ t.assert_nil(body)
65
+ t.assert_nil(block)
66
+ t.create_ok("true")
67
+ end
68
+
69
+ c = Client.new(base_uri: u, http: h)
70
+
71
+ res = c.healthcheck.do
72
+ assert_nil(res.error)
73
+
74
+ assert_equal("true", res.response.body)
75
+ end
76
+
77
+ def test_do_does_with_the_subpath
78
+ t = self
79
+
80
+ m = "GET"
81
+ u = T.cast(URI.parse("http://localhost:8080/sub/"), URI::HTTP)
82
+ p = T.cast(URI.join(u.to_s, "healthcheck"), URI::HTTP)
83
+ h = T.let(Net::HTTP.new(u.hostname, u.port), Net::HTTP)
84
+
85
+ h.define_singleton_method(:request) do |req, body = nil, &block|
86
+ t.check_request_basics(m, p, req)
87
+ t.check_request_headers(m, u, req)
88
+ t.assert_nil(req.body)
89
+ t.assert_nil(body)
90
+ t.assert_nil(block)
91
+ t.create_ok("true")
92
+ end
93
+
94
+ c = Client.new(base_uri: u, http: h)
95
+
96
+ res = c.healthcheck.do
97
+ assert_nil(res.error)
98
+
99
+ assert_equal("true", res.response.body)
100
+ end
101
+
102
+ def test_do_does_with_the_user_agent
103
+ t = self
104
+
105
+ m = "GET"
106
+ u = T.cast(URI.parse("http://localhost:8080/"), URI::HTTP)
107
+ p = T.cast(URI.join(u.to_s, "healthcheck"), URI::HTTP)
108
+ h = T.let(Net::HTTP.new(u.hostname, u.port), Net::HTTP)
109
+
110
+ h.define_singleton_method(:request) do |req, body = nil, &block|
111
+ t.check_request_basics(m, p, req)
112
+ t.check_request_headers_with_custom_user_agent(m, u, "my-agent", req)
113
+ t.assert_nil(req.body)
114
+ t.assert_nil(body)
115
+ t.assert_nil(block)
116
+ t.create_ok("true")
117
+ end
118
+
119
+ c = Client.new(base_uri: u, http: h, user_agent: "my-agent")
120
+
121
+ res = c.healthcheck.do
122
+ assert_nil(res.error)
123
+
124
+ assert_equal("true", res.response.body)
125
+ end
126
+
127
+ def test_do_does_with_the_jwt
128
+ t = self
129
+
130
+ w = DocsIntegrationSdk::Jwt.new(secret: "***")
131
+ m = "GET"
132
+ u = T.cast(URI.parse("http://localhost:8080/"), URI::HTTP)
133
+ p = T.cast(URI.join(u.to_s, "healthcheck"), URI::HTTP)
134
+ h = T.let(Net::HTTP.new(u.hostname, u.port), Net::HTTP)
135
+
136
+ h.define_singleton_method(:request) do |req, body = nil, &block|
137
+ t.check_request_basics(m, p, req)
138
+ t.check_request_headers(m, u, req)
139
+ t.assert_nil(req.body)
140
+ t.assert_nil(body)
141
+ t.assert_nil(block)
142
+ t.create_ok("true")
143
+ end
144
+
145
+ j = Jwt.new(jwt: w)
146
+ c = Client.new(base_uri: u, http: h).with_jwt(j)
147
+
148
+ res = c.healthcheck.do
149
+ assert_nil(res.error)
150
+
151
+ assert_equal("true", res.response.body)
152
+ end
153
+
154
+ def test_do_returns_an_error_if_the_response_body_is_invalid_json
155
+ t = self
156
+
157
+ m = "GET"
158
+ u = T.cast(URI.parse("http://localhost:8080/"), URI::HTTP)
159
+ p = T.cast(URI.join(u.to_s, "healthcheck"), URI::HTTP)
160
+ h = T.let(Net::HTTP.new(u.hostname, u.port), Net::HTTP)
161
+
162
+ h.define_singleton_method(:request) do |req, body = nil, &block|
163
+ t.check_request_basics(m, p, req)
164
+ t.check_request_headers(m, u, req)
165
+ t.assert_nil(req.body)
166
+ t.assert_nil(body)
167
+ t.assert_nil(block)
168
+ t.create_ok("}")
169
+ end
170
+
171
+ c = Client.new(base_uri: u, http: h)
172
+
173
+ res = c.healthcheck.do
174
+
175
+ err = T.cast(res.error, JSON::ParserError)
176
+ assert_equal("unexpected token at '}'", err.message)
177
+
178
+ assert_equal("}", res.response.body)
179
+ end
180
+
181
+ def test_do_returns_an_error_if_the_doing_fails
182
+ t = self
183
+
184
+ m = "GET"
185
+ u = T.cast(URI.parse("http://localhost:8080/"), URI::HTTP)
186
+ p = T.cast(URI.join(u.to_s, "healthcheck"), URI::HTTP)
187
+ h = T.let(Net::HTTP.new(u.hostname, u.port), Net::HTTP)
188
+
189
+ h.define_singleton_method(:request) do |req, body = nil, &block|
190
+ t.check_request_basics(m, p, req)
191
+ t.check_request_headers(m, u, req)
192
+ t.assert_nil(req.body)
193
+ t.assert_nil(body)
194
+ t.assert_nil(block)
195
+ t.create_ok("false")
196
+ end
197
+
198
+ c = Client.new(base_uri: u, http: h)
199
+
200
+ res = c.healthcheck.do
201
+ assert_equal(HealthcheckService::Error::Failed, res.error)
202
+
203
+ assert_equal("false", res.response.body)
204
+ end
205
+ end
206
+ end
207
+ end
208
+ end
209
+ end
@@ -0,0 +1,116 @@
1
+ #
2
+ # (c) Copyright Ascensio System SIA 2025
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ # typed: strict
18
+ # frozen_string_literal: true
19
+
20
+ require "sorbet-runtime"
21
+ require_relative "../../jwt"
22
+
23
+ module Onlyoffice
24
+ module DocsIntegrationSdk
25
+ module DocumentServer
26
+ class Client
27
+ # Jwt is a class that represents the JWT token configuration for the
28
+ # Document Server client.
29
+ #
30
+ # @since 0.1.0
31
+ class Jwt
32
+ extend T::Sig
33
+
34
+ # Location is an enum that represents the location of the JWT token in
35
+ # the request.
36
+ #
37
+ # @since 0.1.0
38
+ class Location < T::Enum
39
+ enums do
40
+ # Header is the location of the JWT token in the request header.
41
+ #
42
+ # @since 0.1.0
43
+ Header = new("header")
44
+
45
+ # Body is the location of the JWT token in the request body.
46
+ #
47
+ # @since 0.1.0
48
+ Body = new("body")
49
+ end
50
+ end
51
+
52
+ # jwt is the JWT token encoding configuration.
53
+ #
54
+ # @since 0.1.0
55
+ sig {returns(JwtEncoding)}
56
+ attr_reader :jwt
57
+
58
+ # locations is the list of locations of the JWT token in the request.
59
+ #
60
+ # @since 0.1.0
61
+ sig {returns(T::Array[Location])}
62
+ attr_reader :locations
63
+
64
+ # header is the header name of the JWT token in the request.
65
+ #
66
+ # @example
67
+ # req[jwt.header] = "#{jwt.schema} #{jwt.jwt.encode_header(payload)}"
68
+ #
69
+ # @since 0.1.0
70
+ sig {returns(String)}
71
+ attr_reader :header
72
+
73
+ # schema is the schema of the JWT token in the request.
74
+ #
75
+ # @example
76
+ # req[jwt.header] = "#{jwt.schema} #{jwt.jwt.encode_header(payload)}"
77
+ #
78
+ # @since 0.1.0
79
+ sig {returns(String)}
80
+ attr_reader :schema
81
+
82
+ # initialize initializes a new Jwt instance. It makes a shallow copy
83
+ # of the locations list.
84
+ #
85
+ # @param jwt
86
+ # The JWT token encoding configuration.
87
+ # @param locations
88
+ # The list of locations of the JWT token in the request.
89
+ # @param header
90
+ # The header name of the JWT token in the request.
91
+ # @param schema
92
+ # The schema of the JWT token in the request.
93
+ sig do
94
+ params(
95
+ jwt: JwtEncoding,
96
+ locations: T::Array[Location],
97
+ header: String,
98
+ schema: String,
99
+ ).void
100
+ end
101
+ def initialize(
102
+ jwt:,
103
+ locations: [Location::Header, Location::Body],
104
+ header: "Authorization",
105
+ schema: "Bearer"
106
+ )
107
+ @jwt = jwt
108
+ @locations = T.let(locations.clone, T::Array[Location])
109
+ @header = header
110
+ @schema = schema
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,70 @@
1
+ #
2
+ # (c) Copyright Ascensio System SIA 2025
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ # typed: true
18
+ # frozen_string_literal: true
19
+
20
+ require "test/unit"
21
+ require_relative "../../test_test"
22
+ require_relative "jwt"
23
+
24
+ module Onlyoffice
25
+ module DocsIntegrationSdk
26
+ module DocumentServer
27
+ class Client
28
+ class Jwt
29
+ class LocationTest < ::Test::Unit::TestCase
30
+ extend T::Sig
31
+ include Test::BasicEnumMarshalling
32
+
33
+ sig {override.returns(T::Array[[String, Location]])}
34
+ def cases
35
+ [
36
+ ["header", Location::Header],
37
+ ["body", Location::Body],
38
+ ]
39
+ end
40
+ end
41
+ end
42
+
43
+ class JwtTest < ::Test::Unit::TestCase
44
+ def test_initialize_initializes_with_default_values
45
+ w = DocsIntegrationSdk::Jwt.new(secret: "***")
46
+ j = Jwt.new(jwt: w)
47
+ assert_equal(w, j.jwt)
48
+ assert_equal([Jwt::Location::Header, Jwt::Location::Body], j.locations)
49
+ assert_equal("Authorization", j.header)
50
+ assert_equal("Bearer", j.schema)
51
+ end
52
+
53
+ def test_initialize_initializes_with_custom_values
54
+ w = DocsIntegrationSdk::Jwt.new(secret: "***")
55
+ j = Jwt.new(
56
+ jwt: w,
57
+ locations: [Jwt::Location::Body],
58
+ header: "X-Auth",
59
+ schema: "Token"
60
+ )
61
+ assert_equal(w, j.jwt)
62
+ assert_equal([Jwt::Location::Body], j.locations)
63
+ assert_equal("X-Auth", j.header)
64
+ assert_equal("Token", j.schema)
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,73 @@
1
+ #
2
+ # (c) Copyright Ascensio System SIA 2025
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ # typed: strict
18
+ # frozen_string_literal: true
19
+
20
+ require "net/http"
21
+ require "sorbet-runtime"
22
+
23
+ module Onlyoffice
24
+ module DocsIntegrationSdk
25
+ module DocumentServer
26
+ class Client
27
+ # Response is a class that represents the response from the Document
28
+ # Server.
29
+ #
30
+ # @since 0.1.0
31
+ class Response
32
+ extend T::Sig
33
+
34
+ # request is the request that was sent to the Document Server.
35
+ #
36
+ # @since 0.1.0
37
+ sig {returns(Net::HTTPRequest)}
38
+ attr_reader :request
39
+
40
+ # response is the response from the Document Server.
41
+ #
42
+ # @since 0.1.0
43
+ sig {returns(Net::HTTPResponse)}
44
+ attr_reader :response
45
+
46
+ # error is the error that occurred when sending the request.
47
+ #
48
+ # @since 0.1.0
49
+ sig {returns(T.nilable(Object))}
50
+ attr_reader :error
51
+
52
+ # initialize initializes a new Response instance.
53
+ #
54
+ # @param request The request that was sent to the Document Server.
55
+ # @param response The response from the Document Server.
56
+ # @param error The error that occurred when sending the request.
57
+ sig do
58
+ params(
59
+ request: Net::HTTPRequest,
60
+ response: Net::HTTPResponse,
61
+ error: T.nilable(Object),
62
+ ).void
63
+ end
64
+ def initialize(request:, response:, error: nil)
65
+ @request = request
66
+ @response = response
67
+ @error = error
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,49 @@
1
+ #
2
+ # (c) Copyright Ascensio System SIA 2025
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ # typed: true
18
+ # frozen_string_literal: true
19
+
20
+ require "test/unit"
21
+ require_relative "response"
22
+
23
+ module Onlyoffice
24
+ module DocsIntegrationSdk
25
+ module DocumentServer
26
+ class Client
27
+ class ResponseTest < ::Test::Unit::TestCase
28
+ def test_initialize_initializes_with_default_values
29
+ req = Net::HTTP::Get.new("http://localhost:8080/")
30
+ res = Net::HTTPResponse.new("1.1", "200", "OK")
31
+ r = Response.new(request: req, response: res)
32
+ assert_equal(req, r.request)
33
+ assert_equal(res, r.response)
34
+ assert_nil(r.error)
35
+ end
36
+
37
+ def test_initialize_initializes_with_custom_values
38
+ req = Net::HTTP::Get.new("http://localhost:8080/")
39
+ res = Net::HTTPResponse.new("1.1", "200", "OK")
40
+ r = Response.new(request: req, response: res, error: "error")
41
+ assert_equal(req, r.request)
42
+ assert_equal(res, r.response)
43
+ assert_equal("error", r.error)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,44 @@
1
+ #
2
+ # (c) Copyright Ascensio System SIA 2025
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ # typed: strict
18
+ # frozen_string_literal: true
19
+
20
+ require "sorbet-runtime"
21
+
22
+ module Onlyoffice
23
+ module DocsIntegrationSdk
24
+ module DocumentServer
25
+ class Client
26
+ # Service is a base class for all services.
27
+ #
28
+ # @since 0.1.0
29
+ class Service
30
+ extend T::Sig
31
+ extend T::Helpers
32
+ abstract!
33
+
34
+ # @param client The client instance.
35
+ # @since 0.1.0
36
+ sig {overridable.params(client: Client).void}
37
+ def initialize(client:)
38
+ @client = client
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,31 @@
1
+ #
2
+ # (c) Copyright Ascensio System SIA 2025
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ # typed: strict
18
+ # frozen_string_literal: true
19
+
20
+ require "sorbet-runtime"
21
+ require_relative "../../version"
22
+
23
+ module Onlyoffice
24
+ module DocsIntegrationSdk
25
+ module DocumentServer
26
+ class Client
27
+ USER_AGENT = T.let("com.onlyoffice.docs-integration-sdk-ruby #{VERSION}", String)
28
+ end
29
+ end
30
+ end
31
+ end