ruby-lokalise-api 7.1.1 → 8.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ruby_lokalise_api/base_client.rb +2 -34
  3. data/lib/ruby_lokalise_api/client.rb +2 -31
  4. data/lib/ruby_lokalise_api/collections/base.rb +97 -70
  5. data/lib/ruby_lokalise_api/collections/branches.rb +11 -0
  6. data/lib/ruby_lokalise_api/collections/contributors.rb +10 -0
  7. data/lib/ruby_lokalise_api/collections/custom_translation_statuses.rb +10 -0
  8. data/lib/ruby_lokalise_api/collections/files.rb +10 -0
  9. data/lib/ruby_lokalise_api/collections/key_comments.rb +11 -0
  10. data/lib/ruby_lokalise_api/collections/keys.rb +10 -0
  11. data/lib/ruby_lokalise_api/collections/orders.rb +10 -0
  12. data/lib/ruby_lokalise_api/collections/payment_cards.rb +10 -0
  13. data/lib/ruby_lokalise_api/collections/project_comments.rb +12 -0
  14. data/lib/ruby_lokalise_api/collections/project_languages.rb +11 -0
  15. data/lib/ruby_lokalise_api/collections/projects.rb +10 -0
  16. data/lib/ruby_lokalise_api/collections/queued_processes.rb +11 -0
  17. data/lib/ruby_lokalise_api/collections/screenshots.rb +10 -0
  18. data/lib/ruby_lokalise_api/collections/segments.rb +10 -0
  19. data/lib/ruby_lokalise_api/collections/snapshots.rb +10 -0
  20. data/lib/ruby_lokalise_api/collections/system_languages.rb +11 -0
  21. data/lib/ruby_lokalise_api/collections/tasks.rb +10 -0
  22. data/lib/ruby_lokalise_api/collections/team_user_groups.rb +11 -0
  23. data/lib/ruby_lokalise_api/collections/team_users.rb +10 -0
  24. data/lib/ruby_lokalise_api/collections/teams.rb +10 -0
  25. data/lib/ruby_lokalise_api/collections/translation_providers.rb +10 -0
  26. data/lib/ruby_lokalise_api/collections/translations.rb +10 -0
  27. data/lib/ruby_lokalise_api/collections/webhooks.rb +10 -0
  28. data/lib/ruby_lokalise_api/concerns/attrs_loadable.rb +31 -0
  29. data/lib/ruby_lokalise_api/concerns/hash_accessible.rb +16 -0
  30. data/lib/ruby_lokalise_api/concerns/unsupportable.rb +16 -0
  31. data/lib/ruby_lokalise_api/connection.rb +18 -9
  32. data/lib/ruby_lokalise_api/data/collection_attributes.yml +52 -0
  33. data/lib/ruby_lokalise_api/data/{attributes.yml → resource_attributes.yml} +64 -6
  34. data/lib/ruby_lokalise_api/endpoints/base_endpoint.rb +66 -0
  35. data/lib/ruby_lokalise_api/endpoints/branches_endpoint.rb +16 -0
  36. data/lib/ruby_lokalise_api/endpoints/contributors_endpoint.rb +16 -0
  37. data/lib/ruby_lokalise_api/endpoints/custom_translation_statuses_endpoint.rb +16 -0
  38. data/lib/ruby_lokalise_api/endpoints/files_endpoint.rb +16 -0
  39. data/lib/ruby_lokalise_api/endpoints/jwts_endpoint.rb +15 -0
  40. data/lib/ruby_lokalise_api/endpoints/key_comments_endpoint.rb +17 -0
  41. data/lib/ruby_lokalise_api/endpoints/keys_endpoint.rb +16 -0
  42. data/lib/ruby_lokalise_api/endpoints/main_endpoint.rb +25 -0
  43. data/lib/ruby_lokalise_api/endpoints/oauth2/oauth2_endpoint.rb +33 -0
  44. data/lib/ruby_lokalise_api/endpoints/orders_endpoint.rb +16 -0
  45. data/lib/ruby_lokalise_api/endpoints/payment_cards_endpoint.rb +15 -0
  46. data/lib/ruby_lokalise_api/endpoints/project_comments_endpoint.rb +15 -0
  47. data/lib/ruby_lokalise_api/endpoints/project_languages_endpoint.rb +16 -0
  48. data/lib/ruby_lokalise_api/endpoints/projects_endpoint.rb +15 -0
  49. data/lib/ruby_lokalise_api/endpoints/queued_processes_endpoint.rb +16 -0
  50. data/lib/ruby_lokalise_api/endpoints/screenshots_endpoint.rb +16 -0
  51. data/lib/ruby_lokalise_api/endpoints/segments_endpoint.rb +17 -0
  52. data/lib/ruby_lokalise_api/endpoints/snapshots_endpoint.rb +16 -0
  53. data/lib/ruby_lokalise_api/endpoints/system_languages_endpoint.rb +15 -0
  54. data/lib/ruby_lokalise_api/endpoints/tasks_endpoint.rb +16 -0
  55. data/lib/ruby_lokalise_api/endpoints/team_user_billing_details_endpoint.rb +15 -0
  56. data/lib/ruby_lokalise_api/endpoints/team_user_groups_endpoint.rb +16 -0
  57. data/lib/ruby_lokalise_api/endpoints/team_users_endpoint.rb +16 -0
  58. data/lib/ruby_lokalise_api/endpoints/teams_endpoint.rb +13 -0
  59. data/lib/ruby_lokalise_api/endpoints/translation_providers_endpoint.rb +16 -0
  60. data/lib/ruby_lokalise_api/endpoints/translations_endpoint.rb +16 -0
  61. data/lib/ruby_lokalise_api/endpoints/webhooks_endpoint.rb +16 -0
  62. data/lib/ruby_lokalise_api/error.rb +1 -0
  63. data/lib/ruby_lokalise_api/generics.rb +25 -0
  64. data/lib/ruby_lokalise_api/json_handler.rb +1 -2
  65. data/lib/ruby_lokalise_api/oauth2/auth.rb +33 -39
  66. data/lib/ruby_lokalise_api/oauth2_client.rb +3 -0
  67. data/lib/ruby_lokalise_api/request.rb +66 -18
  68. data/lib/ruby_lokalise_api/resources/base.rb +41 -181
  69. data/lib/ruby_lokalise_api/resources/branch.rb +2 -21
  70. data/lib/ruby_lokalise_api/resources/comment.rb +11 -0
  71. data/lib/ruby_lokalise_api/resources/contributor.rb +1 -9
  72. data/lib/ruby_lokalise_api/resources/custom_translation_status.rb +1 -13
  73. data/lib/ruby_lokalise_api/resources/file.rb +2 -16
  74. data/lib/ruby_lokalise_api/resources/jwt.rb +2 -5
  75. data/lib/ruby_lokalise_api/resources/key.rb +5 -8
  76. data/lib/ruby_lokalise_api/resources/oauth2_refreshed_token.rb +9 -0
  77. data/lib/ruby_lokalise_api/resources/oauth2_token.rb +9 -0
  78. data/lib/ruby_lokalise_api/resources/order.rb +2 -9
  79. data/lib/ruby_lokalise_api/resources/payment_card.rb +2 -8
  80. data/lib/ruby_lokalise_api/resources/project.rb +85 -16
  81. data/lib/ruby_lokalise_api/resources/project_language.rb +2 -10
  82. data/lib/ruby_lokalise_api/resources/queued_process.rb +3 -10
  83. data/lib/ruby_lokalise_api/resources/screenshot.rb +1 -9
  84. data/lib/ruby_lokalise_api/resources/segment.rb +2 -11
  85. data/lib/ruby_lokalise_api/resources/snapshot.rb +3 -18
  86. data/lib/ruby_lokalise_api/resources/system_language.rb +2 -1
  87. data/lib/ruby_lokalise_api/resources/task.rb +1 -9
  88. data/lib/ruby_lokalise_api/resources/team.rb +2 -0
  89. data/lib/ruby_lokalise_api/resources/team_user.rb +1 -9
  90. data/lib/ruby_lokalise_api/resources/team_user_billing_details.rb +10 -5
  91. data/lib/ruby_lokalise_api/resources/team_user_group.rb +6 -14
  92. data/lib/ruby_lokalise_api/resources/translation.rb +2 -9
  93. data/lib/ruby_lokalise_api/resources/translation_provider.rb +2 -9
  94. data/lib/ruby_lokalise_api/resources/webhook.rb +2 -16
  95. data/lib/ruby_lokalise_api/response.rb +50 -0
  96. data/lib/ruby_lokalise_api/rest/branches.rb +52 -27
  97. data/lib/ruby_lokalise_api/rest/comments.rb +48 -23
  98. data/lib/ruby_lokalise_api/rest/contributors.rb +47 -23
  99. data/lib/ruby_lokalise_api/rest/custom_translation_statuses.rb +60 -36
  100. data/lib/ruby_lokalise_api/rest/files.rb +43 -24
  101. data/lib/ruby_lokalise_api/rest/jwts.rb +21 -0
  102. data/lib/ruby_lokalise_api/rest/keys.rb +67 -34
  103. data/lib/ruby_lokalise_api/rest/languages.rb +57 -28
  104. data/lib/ruby_lokalise_api/rest/orders.rb +36 -14
  105. data/lib/ruby_lokalise_api/rest/payment_cards.rb +29 -12
  106. data/lib/ruby_lokalise_api/rest/projects.rb +55 -32
  107. data/lib/ruby_lokalise_api/rest/queued_processes.rb +21 -13
  108. data/lib/ruby_lokalise_api/rest/screenshots.rb +45 -20
  109. data/lib/ruby_lokalise_api/rest/segments.rb +31 -18
  110. data/lib/ruby_lokalise_api/rest/snapshots.rb +34 -14
  111. data/lib/ruby_lokalise_api/rest/tasks.rb +41 -19
  112. data/lib/ruby_lokalise_api/rest/team_user_billing_details.rb +33 -12
  113. data/lib/ruby_lokalise_api/rest/team_user_groups.rb +82 -50
  114. data/lib/ruby_lokalise_api/rest/team_users.rb +35 -18
  115. data/lib/ruby_lokalise_api/rest/teams.rb +10 -5
  116. data/lib/ruby_lokalise_api/rest/translation_providers.rb +24 -9
  117. data/lib/ruby_lokalise_api/rest/translations.rb +28 -15
  118. data/lib/ruby_lokalise_api/rest/webhooks.rb +54 -30
  119. data/lib/ruby_lokalise_api/rest.rb +31 -0
  120. data/lib/ruby_lokalise_api/utils/attributes.rb +37 -0
  121. data/lib/ruby_lokalise_api/utils/classes.rb +24 -0
  122. data/lib/ruby_lokalise_api/utils/keys.rb +29 -0
  123. data/lib/ruby_lokalise_api/utils/loaders.rb +24 -0
  124. data/lib/ruby_lokalise_api/utils/strings.rb +20 -0
  125. data/lib/ruby_lokalise_api/version.rb +1 -1
  126. data/lib/ruby_lokalise_api.rb +6 -2
  127. data/ruby-lokalise-api.gemspec +2 -2
  128. metadata +76 -41
  129. data/lib/ruby_lokalise_api/base_request.rb +0 -73
  130. data/lib/ruby_lokalise_api/collections/branch.rb +0 -15
  131. data/lib/ruby_lokalise_api/collections/contributor.rb +0 -13
  132. data/lib/ruby_lokalise_api/collections/custom_translation_status.rb +0 -15
  133. data/lib/ruby_lokalise_api/collections/file.rb +0 -13
  134. data/lib/ruby_lokalise_api/collections/key.rb +0 -20
  135. data/lib/ruby_lokalise_api/collections/key_comment.rb +0 -14
  136. data/lib/ruby_lokalise_api/collections/order.rb +0 -13
  137. data/lib/ruby_lokalise_api/collections/payment_card.rb +0 -13
  138. data/lib/ruby_lokalise_api/collections/project.rb +0 -13
  139. data/lib/ruby_lokalise_api/collections/project_comment.rb +0 -13
  140. data/lib/ruby_lokalise_api/collections/project_language.rb +0 -13
  141. data/lib/ruby_lokalise_api/collections/queued_process.rb +0 -15
  142. data/lib/ruby_lokalise_api/collections/screenshot.rb +0 -13
  143. data/lib/ruby_lokalise_api/collections/segment.rb +0 -15
  144. data/lib/ruby_lokalise_api/collections/snapshot.rb +0 -13
  145. data/lib/ruby_lokalise_api/collections/system_language.rb +0 -13
  146. data/lib/ruby_lokalise_api/collections/task.rb +0 -13
  147. data/lib/ruby_lokalise_api/collections/team.rb +0 -13
  148. data/lib/ruby_lokalise_api/collections/team_user.rb +0 -13
  149. data/lib/ruby_lokalise_api/collections/team_user_group.rb +0 -15
  150. data/lib/ruby_lokalise_api/collections/translation.rb +0 -13
  151. data/lib/ruby_lokalise_api/collections/translation_provider.rb +0 -13
  152. data/lib/ruby_lokalise_api/collections/webhook.rb +0 -13
  153. data/lib/ruby_lokalise_api/oauth2/refresh.rb +0 -16
  154. data/lib/ruby_lokalise_api/oauth2/token.rb +0 -16
  155. data/lib/ruby_lokalise_api/resources/key_comment.rb +0 -19
  156. data/lib/ruby_lokalise_api/resources/project_comment.rb +0 -10
  157. data/lib/ruby_lokalise_api/rest/jwt.rb +0 -15
  158. data/lib/ruby_lokalise_api/utils/attribute_helpers.rb +0 -86
  159. data/lib/ruby_lokalise_api/utils/endpoint_helpers.rb +0 -14
  160. data/lib/ruby_lokalise_api/utils/string_utils.rb +0 -33
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyLokaliseApi
4
+ module Utils
5
+ module Loaders
6
+ private
7
+
8
+ def endpoint(name:, client: self, params: {})
9
+ klass = RubyLokaliseApi.const_get "Endpoints::#{name}Endpoint"
10
+ klass.new client, params
11
+ end
12
+
13
+ def resource(name, data)
14
+ klass = RubyLokaliseApi.const_get "Resources::#{name}"
15
+ klass.new data
16
+ end
17
+
18
+ def collection(name, data)
19
+ klass = RubyLokaliseApi.const_get "Collections::#{name}"
20
+ klass.new data
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyLokaliseApi
4
+ module Utils
5
+ module Strings
6
+ refine String do
7
+ # Initial code taken from Facets gem by Rubyworks
8
+ # https://github.com/rubyworks/facets/blob/master/lib/core/facets/string/snakecase.rb
9
+ def snakecase
10
+ gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
11
+ gsub(/([a-z\d])([A-Z])/, '\1_\2').
12
+ tr('-', '_').
13
+ gsub(/\s/, '_').
14
+ gsub(/__+/, '_').
15
+ downcase
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyLokaliseApi
4
- VERSION = '7.1.1'
4
+ VERSION = '8.0.0.rc1'
5
5
  end
@@ -4,15 +4,19 @@ require 'zeitwerk'
4
4
  require 'faraday'
5
5
  require 'faraday/gzip'
6
6
  require 'yaml'
7
- require 'addressable'
7
+ require 'addressable/template'
8
8
 
9
9
  loader = Zeitwerk::Loader.for_gem
10
10
  loader.inflector.inflect(
11
11
  'oauth2' => 'OAuth2',
12
- 'oauth2_client' => 'OAuth2Client'
12
+ 'oauth2_client' => 'OAuth2Client',
13
+ 'oauth2_endpoint' => 'OAuth2Endpoint',
14
+ 'oauth2_token' => 'OAuth2Token',
15
+ 'oauth2_refreshed_token' => 'OAuth2RefreshedToken'
13
16
  )
14
17
  loader.setup
15
18
 
19
+ # Official Ruby client for Lokalise APIv2
16
20
  module RubyLokaliseApi
17
21
  class << self
18
22
  # Initializes a new Client object
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.required_ruby_version = '>= 2.7'
16
16
 
17
17
  spec.files = Dir['README.md', 'LICENSE',
18
- 'CHANGELOG.md', 'lib/**/*.rb', 'lib/ruby_lokalise_api/data/attributes.yml',
18
+ 'CHANGELOG.md', 'lib/**/*.rb', 'lib/ruby_lokalise_api/data/*.yml',
19
19
  'ruby-lokalise-api.gemspec', '.github/*.md',
20
20
  'Gemfile', 'Rakefile']
21
21
  spec.extra_rdoc_files = ['README.md']
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency 'rubocop-rake', '~> 0.6'
37
37
  spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
38
38
  spec.add_development_dependency 'simplecov', '~> 0.21'
39
- spec.add_development_dependency 'vcr', '~> 6.0'
39
+ spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
40
40
  spec.add_development_dependency 'webmock', '~> 3.14'
41
41
  spec.metadata = {
42
42
  'rubygems_mfa_required' => 'true'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lokalise-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.1
4
+ version: 8.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Krukowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-03 00:00:00.000000000 Z
11
+ date: 2023-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -213,19 +213,19 @@ dependencies:
213
213
  - !ruby/object:Gem::Version
214
214
  version: '0.21'
215
215
  - !ruby/object:Gem::Dependency
216
- name: vcr
216
+ name: simplecov-lcov
217
217
  requirement: !ruby/object:Gem::Requirement
218
218
  requirements:
219
219
  - - "~>"
220
220
  - !ruby/object:Gem::Version
221
- version: '6.0'
221
+ version: '0.8'
222
222
  type: :development
223
223
  prerelease: false
224
224
  version_requirements: !ruby/object:Gem::Requirement
225
225
  requirements:
226
226
  - - "~>"
227
227
  - !ruby/object:Gem::Version
228
- version: '6.0'
228
+ version: '0.8'
229
229
  - !ruby/object:Gem::Dependency
230
230
  name: webmock
231
231
  requirement: !ruby/object:Gem::Requirement
@@ -259,53 +259,84 @@ files:
259
259
  - Rakefile
260
260
  - lib/ruby_lokalise_api.rb
261
261
  - lib/ruby_lokalise_api/base_client.rb
262
- - lib/ruby_lokalise_api/base_request.rb
263
262
  - lib/ruby_lokalise_api/client.rb
264
263
  - lib/ruby_lokalise_api/collections/base.rb
265
- - lib/ruby_lokalise_api/collections/branch.rb
266
- - lib/ruby_lokalise_api/collections/contributor.rb
267
- - lib/ruby_lokalise_api/collections/custom_translation_status.rb
268
- - lib/ruby_lokalise_api/collections/file.rb
269
- - lib/ruby_lokalise_api/collections/key.rb
270
- - lib/ruby_lokalise_api/collections/key_comment.rb
271
- - lib/ruby_lokalise_api/collections/order.rb
272
- - lib/ruby_lokalise_api/collections/payment_card.rb
273
- - lib/ruby_lokalise_api/collections/project.rb
274
- - lib/ruby_lokalise_api/collections/project_comment.rb
275
- - lib/ruby_lokalise_api/collections/project_language.rb
276
- - lib/ruby_lokalise_api/collections/queued_process.rb
277
- - lib/ruby_lokalise_api/collections/screenshot.rb
278
- - lib/ruby_lokalise_api/collections/segment.rb
279
- - lib/ruby_lokalise_api/collections/snapshot.rb
280
- - lib/ruby_lokalise_api/collections/system_language.rb
281
- - lib/ruby_lokalise_api/collections/task.rb
282
- - lib/ruby_lokalise_api/collections/team.rb
283
- - lib/ruby_lokalise_api/collections/team_user.rb
284
- - lib/ruby_lokalise_api/collections/team_user_group.rb
285
- - lib/ruby_lokalise_api/collections/translation.rb
286
- - lib/ruby_lokalise_api/collections/translation_provider.rb
287
- - lib/ruby_lokalise_api/collections/webhook.rb
264
+ - lib/ruby_lokalise_api/collections/branches.rb
265
+ - lib/ruby_lokalise_api/collections/contributors.rb
266
+ - lib/ruby_lokalise_api/collections/custom_translation_statuses.rb
267
+ - lib/ruby_lokalise_api/collections/files.rb
268
+ - lib/ruby_lokalise_api/collections/key_comments.rb
269
+ - lib/ruby_lokalise_api/collections/keys.rb
270
+ - lib/ruby_lokalise_api/collections/orders.rb
271
+ - lib/ruby_lokalise_api/collections/payment_cards.rb
272
+ - lib/ruby_lokalise_api/collections/project_comments.rb
273
+ - lib/ruby_lokalise_api/collections/project_languages.rb
274
+ - lib/ruby_lokalise_api/collections/projects.rb
275
+ - lib/ruby_lokalise_api/collections/queued_processes.rb
276
+ - lib/ruby_lokalise_api/collections/screenshots.rb
277
+ - lib/ruby_lokalise_api/collections/segments.rb
278
+ - lib/ruby_lokalise_api/collections/snapshots.rb
279
+ - lib/ruby_lokalise_api/collections/system_languages.rb
280
+ - lib/ruby_lokalise_api/collections/tasks.rb
281
+ - lib/ruby_lokalise_api/collections/team_user_groups.rb
282
+ - lib/ruby_lokalise_api/collections/team_users.rb
283
+ - lib/ruby_lokalise_api/collections/teams.rb
284
+ - lib/ruby_lokalise_api/collections/translation_providers.rb
285
+ - lib/ruby_lokalise_api/collections/translations.rb
286
+ - lib/ruby_lokalise_api/collections/webhooks.rb
287
+ - lib/ruby_lokalise_api/concerns/attrs_loadable.rb
288
+ - lib/ruby_lokalise_api/concerns/hash_accessible.rb
289
+ - lib/ruby_lokalise_api/concerns/unsupportable.rb
288
290
  - lib/ruby_lokalise_api/connection.rb
289
- - lib/ruby_lokalise_api/data/attributes.yml
291
+ - lib/ruby_lokalise_api/data/collection_attributes.yml
292
+ - lib/ruby_lokalise_api/data/resource_attributes.yml
293
+ - lib/ruby_lokalise_api/endpoints/base_endpoint.rb
294
+ - lib/ruby_lokalise_api/endpoints/branches_endpoint.rb
295
+ - lib/ruby_lokalise_api/endpoints/contributors_endpoint.rb
296
+ - lib/ruby_lokalise_api/endpoints/custom_translation_statuses_endpoint.rb
297
+ - lib/ruby_lokalise_api/endpoints/files_endpoint.rb
298
+ - lib/ruby_lokalise_api/endpoints/jwts_endpoint.rb
299
+ - lib/ruby_lokalise_api/endpoints/key_comments_endpoint.rb
300
+ - lib/ruby_lokalise_api/endpoints/keys_endpoint.rb
301
+ - lib/ruby_lokalise_api/endpoints/main_endpoint.rb
302
+ - lib/ruby_lokalise_api/endpoints/oauth2/oauth2_endpoint.rb
303
+ - lib/ruby_lokalise_api/endpoints/orders_endpoint.rb
304
+ - lib/ruby_lokalise_api/endpoints/payment_cards_endpoint.rb
305
+ - lib/ruby_lokalise_api/endpoints/project_comments_endpoint.rb
306
+ - lib/ruby_lokalise_api/endpoints/project_languages_endpoint.rb
307
+ - lib/ruby_lokalise_api/endpoints/projects_endpoint.rb
308
+ - lib/ruby_lokalise_api/endpoints/queued_processes_endpoint.rb
309
+ - lib/ruby_lokalise_api/endpoints/screenshots_endpoint.rb
310
+ - lib/ruby_lokalise_api/endpoints/segments_endpoint.rb
311
+ - lib/ruby_lokalise_api/endpoints/snapshots_endpoint.rb
312
+ - lib/ruby_lokalise_api/endpoints/system_languages_endpoint.rb
313
+ - lib/ruby_lokalise_api/endpoints/tasks_endpoint.rb
314
+ - lib/ruby_lokalise_api/endpoints/team_user_billing_details_endpoint.rb
315
+ - lib/ruby_lokalise_api/endpoints/team_user_groups_endpoint.rb
316
+ - lib/ruby_lokalise_api/endpoints/team_users_endpoint.rb
317
+ - lib/ruby_lokalise_api/endpoints/teams_endpoint.rb
318
+ - lib/ruby_lokalise_api/endpoints/translation_providers_endpoint.rb
319
+ - lib/ruby_lokalise_api/endpoints/translations_endpoint.rb
320
+ - lib/ruby_lokalise_api/endpoints/webhooks_endpoint.rb
290
321
  - lib/ruby_lokalise_api/error.rb
322
+ - lib/ruby_lokalise_api/generics.rb
291
323
  - lib/ruby_lokalise_api/json_handler.rb
292
324
  - lib/ruby_lokalise_api/oauth2/auth.rb
293
- - lib/ruby_lokalise_api/oauth2/refresh.rb
294
- - lib/ruby_lokalise_api/oauth2/token.rb
295
325
  - lib/ruby_lokalise_api/oauth2_client.rb
296
326
  - lib/ruby_lokalise_api/request.rb
297
327
  - lib/ruby_lokalise_api/resources/base.rb
298
328
  - lib/ruby_lokalise_api/resources/branch.rb
329
+ - lib/ruby_lokalise_api/resources/comment.rb
299
330
  - lib/ruby_lokalise_api/resources/contributor.rb
300
331
  - lib/ruby_lokalise_api/resources/custom_translation_status.rb
301
332
  - lib/ruby_lokalise_api/resources/file.rb
302
333
  - lib/ruby_lokalise_api/resources/jwt.rb
303
334
  - lib/ruby_lokalise_api/resources/key.rb
304
- - lib/ruby_lokalise_api/resources/key_comment.rb
335
+ - lib/ruby_lokalise_api/resources/oauth2_refreshed_token.rb
336
+ - lib/ruby_lokalise_api/resources/oauth2_token.rb
305
337
  - lib/ruby_lokalise_api/resources/order.rb
306
338
  - lib/ruby_lokalise_api/resources/payment_card.rb
307
339
  - lib/ruby_lokalise_api/resources/project.rb
308
- - lib/ruby_lokalise_api/resources/project_comment.rb
309
340
  - lib/ruby_lokalise_api/resources/project_language.rb
310
341
  - lib/ruby_lokalise_api/resources/queued_process.rb
311
342
  - lib/ruby_lokalise_api/resources/screenshot.rb
@@ -320,12 +351,14 @@ files:
320
351
  - lib/ruby_lokalise_api/resources/translation.rb
321
352
  - lib/ruby_lokalise_api/resources/translation_provider.rb
322
353
  - lib/ruby_lokalise_api/resources/webhook.rb
354
+ - lib/ruby_lokalise_api/response.rb
355
+ - lib/ruby_lokalise_api/rest.rb
323
356
  - lib/ruby_lokalise_api/rest/branches.rb
324
357
  - lib/ruby_lokalise_api/rest/comments.rb
325
358
  - lib/ruby_lokalise_api/rest/contributors.rb
326
359
  - lib/ruby_lokalise_api/rest/custom_translation_statuses.rb
327
360
  - lib/ruby_lokalise_api/rest/files.rb
328
- - lib/ruby_lokalise_api/rest/jwt.rb
361
+ - lib/ruby_lokalise_api/rest/jwts.rb
329
362
  - lib/ruby_lokalise_api/rest/keys.rb
330
363
  - lib/ruby_lokalise_api/rest/languages.rb
331
364
  - lib/ruby_lokalise_api/rest/orders.rb
@@ -343,9 +376,11 @@ files:
343
376
  - lib/ruby_lokalise_api/rest/translation_providers.rb
344
377
  - lib/ruby_lokalise_api/rest/translations.rb
345
378
  - lib/ruby_lokalise_api/rest/webhooks.rb
346
- - lib/ruby_lokalise_api/utils/attribute_helpers.rb
347
- - lib/ruby_lokalise_api/utils/endpoint_helpers.rb
348
- - lib/ruby_lokalise_api/utils/string_utils.rb
379
+ - lib/ruby_lokalise_api/utils/attributes.rb
380
+ - lib/ruby_lokalise_api/utils/classes.rb
381
+ - lib/ruby_lokalise_api/utils/keys.rb
382
+ - lib/ruby_lokalise_api/utils/loaders.rb
383
+ - lib/ruby_lokalise_api/utils/strings.rb
349
384
  - lib/ruby_lokalise_api/version.rb
350
385
  - ruby-lokalise-api.gemspec
351
386
  homepage: https://github.com/lokalise/ruby-lokalise-api
@@ -364,11 +399,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
364
399
  version: '2.7'
365
400
  required_rubygems_version: !ruby/object:Gem::Requirement
366
401
  requirements:
367
- - - ">="
402
+ - - ">"
368
403
  - !ruby/object:Gem::Version
369
- version: '0'
404
+ version: 1.3.1
370
405
  requirements: []
371
- rubygems_version: 3.4.2
406
+ rubygems_version: 3.4.15
372
407
  signing_key:
373
408
  specification_version: 4
374
409
  summary: Ruby interface to the Lokalise API
@@ -1,73 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module BaseRequest
5
- include RubyLokaliseApi::JsonHandler
6
- include RubyLokaliseApi::Connection
7
-
8
- def get(path, client, params = {})
9
- respond_with(
10
- connection(client).get(prepare(path), params),
11
- client
12
- )
13
- end
14
-
15
- def post(path, client, params = {})
16
- respond_with(
17
- connection(client).post(prepare(path), custom_dump(params)),
18
- client
19
- )
20
- end
21
-
22
- def put(path, client, params = {})
23
- respond_with(
24
- connection(client).put(prepare(path), custom_dump(params)),
25
- client
26
- )
27
- end
28
-
29
- def patch(path, client, params = {})
30
- respond_with(
31
- connection(client).patch(prepare(path), params.any? ? custom_dump(params) : nil),
32
- client
33
- )
34
- end
35
-
36
- def delete(path, client, params = {})
37
- respond_with(
38
- # Rubocop tries to replace `delete` with `gsub` but that's a different method here!
39
- # rubocop:disable Style/CollectionMethods
40
- connection(client).delete(prepare(path)) do |req|
41
- # rubocop:enable Style/CollectionMethods
42
- req.body = custom_dump params
43
- end,
44
- client
45
- )
46
- end
47
-
48
- private
49
-
50
- # Get rid of double slashes in the `path`, leading and trailing slash
51
- def prepare(path)
52
- path.delete_prefix('/').gsub(%r{//}, '/').gsub(%r{/+\z}, '')
53
- end
54
-
55
- def raise_on_error!(response, body)
56
- return unless !response.success? || (body.respond_to?(:has_key?) && body.key?('error'))
57
-
58
- respond_with_error(response.status, body)
59
- end
60
-
61
- def respond_with(response, _client)
62
- body = custom_load response.body
63
- raise_on_error! response, body
64
- body
65
- end
66
-
67
- def respond_with_error(code, body)
68
- raise(RubyLokaliseApi::Error, body['error'] || body) unless RubyLokaliseApi::Error::ERRORS.key? code
69
-
70
- raise RubyLokaliseApi::Error::ERRORS[code].from_response(body)
71
- end
72
- end
73
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class Branch < Base
6
- DATA_KEY_PLURAL = 'Branches'
7
-
8
- class << self
9
- def endpoint(project_id, *_args)
10
- path_from projects: [project_id, 'branches']
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class Contributor < Base
6
- class << self
7
- def endpoint(project_id, *_args)
8
- path_from projects: [project_id, 'contributors']
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class CustomTranslationStatus < Base
6
- DATA_KEY_PLURAL = 'CustomTranslationStatuses'
7
-
8
- class << self
9
- def endpoint(project_id, *_args)
10
- path_from projects: [project_id, 'custom_translation_statuses']
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class File < Base
6
- class << self
7
- def endpoint(project_id, *_args)
8
- path_from projects: [project_id, 'files']
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class Key < Base
6
- # Destroys all keys in the collection
7
- # @return [Hash]
8
- def destroy_all
9
- keys = collection.map(&:key_id)
10
- RubyLokaliseApi::Resources::Key.destroy @client, @path, keys: keys
11
- end
12
-
13
- class << self
14
- def endpoint(project_id, *_args)
15
- path_from projects: [project_id, 'keys']
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class KeyComment < Base
6
- class << self
7
- def endpoint(project_id, key_id, *_args)
8
- path_from projects: project_id,
9
- keys: [key_id, 'comments']
10
- end
11
- end
12
- end
13
- end
14
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class Order < Base
6
- class << self
7
- def endpoint(team_id, *_args)
8
- path_from teams: [team_id, 'orders']
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class PaymentCard < Base
6
- class << self
7
- def endpoint(*_args)
8
- path_from payment_cards: nil
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class Project < Base
6
- class << self
7
- def endpoint(*_args)
8
- path_from projects: nil
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class ProjectComment < Base
6
- class << self
7
- def endpoint(project_id, *_args)
8
- path_from projects: [project_id, 'comments']
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class ProjectLanguage < Base
6
- class << self
7
- def endpoint(project_id, *_args)
8
- path_from projects: [project_id, 'languages']
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class QueuedProcess < Base
6
- DATA_KEY_PLURAL = 'Processes'
7
-
8
- class << self
9
- def endpoint(project_id, *_args)
10
- path_from projects: [project_id, 'processes']
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class Screenshot < Base
6
- class << self
7
- def endpoint(project_id, *_args)
8
- path_from projects: [project_id, 'screenshots']
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class Segment < Base
6
- class << self
7
- def endpoint(project_id, key_id, lang_iso, *_args)
8
- path_from projects: project_id,
9
- keys: key_id,
10
- segments: lang_iso
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class Snapshot < Base
6
- class << self
7
- def endpoint(project_id, *_args)
8
- path_from projects: [project_id, 'snapshots']
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class SystemLanguage < Base
6
- class << self
7
- def endpoint(*_args)
8
- path_from system: 'languages'
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class Task < Base
6
- class << self
7
- def endpoint(project_id, *_args)
8
- path_from projects: [project_id, 'tasks']
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class Team < Base
6
- class << self
7
- def endpoint(*_args)
8
- path_from teams: nil
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyLokaliseApi
4
- module Collections
5
- class TeamUser < Base
6
- class << self
7
- def endpoint(team_id, *_args)
8
- path_from teams: [team_id, 'users']
9
- end
10
- end
11
- end
12
- end
13
- end