crowdin-api 1.1.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test-and-lint.yml +1 -1
  3. data/.gitignore +2 -2
  4. data/.rubocop_todo.yml +114 -42
  5. data/README.md +26 -13
  6. data/bin/crowdin-console +5 -5
  7. data/crowdin-api.gemspec +1 -2
  8. data/lib/crowdin-api/api_resources/dictionaries.rb +32 -0
  9. data/lib/crowdin-api/api_resources/distributions.rb +92 -0
  10. data/lib/crowdin-api/api_resources/glossaries.rb +199 -0
  11. data/lib/crowdin-api/api_resources/labels.rb +98 -0
  12. data/lib/crowdin-api/api_resources/languages.rb +61 -0
  13. data/lib/crowdin-api/api_resources/machine_translation_engines.rb +79 -0
  14. data/lib/crowdin-api/api_resources/projects.rb +124 -0
  15. data/lib/crowdin-api/api_resources/reports.rb +120 -0
  16. data/lib/crowdin-api/api_resources/screenshots.rb +172 -0
  17. data/lib/crowdin-api/{api-resources → api_resources}/source_files.rb +68 -130
  18. data/lib/crowdin-api/{api-resources → api_resources}/source_strings.rb +19 -24
  19. data/lib/crowdin-api/api_resources/storages.rb +54 -0
  20. data/lib/crowdin-api/api_resources/string_comments.rb +68 -0
  21. data/lib/crowdin-api/api_resources/string_translations.rb +193 -0
  22. data/lib/crowdin-api/api_resources/tasks.rb +102 -0
  23. data/lib/crowdin-api/api_resources/teams.rb +135 -0
  24. data/lib/crowdin-api/api_resources/translation_memory.rb +131 -0
  25. data/lib/crowdin-api/{api-resources → api_resources}/translation_status.rb +24 -30
  26. data/lib/crowdin-api/{api-resources → api_resources}/translations.rb +41 -59
  27. data/lib/crowdin-api/api_resources/users.rb +161 -0
  28. data/lib/crowdin-api/api_resources/vendors.rb +21 -0
  29. data/lib/crowdin-api/api_resources/webhooks.rb +68 -0
  30. data/lib/crowdin-api/api_resources/workflows.rb +59 -0
  31. data/lib/crowdin-api/client/client.rb +72 -50
  32. data/lib/crowdin-api/client/configuration.rb +16 -12
  33. data/lib/crowdin-api/client/version.rb +1 -1
  34. data/lib/crowdin-api/core/errors.rb +2 -1
  35. data/lib/crowdin-api/core/{api_errors_raiser.rb → errors_raisers.rb} +21 -11
  36. data/lib/crowdin-api/core/request.rb +53 -88
  37. data/lib/crowdin-api/core/send_request.rb +67 -0
  38. data/lib/crowdin-api.rb +20 -11
  39. data/spec/api_resources/dictionaries_spec.rb +23 -0
  40. data/spec/api_resources/distributions_spec.rb +71 -0
  41. data/spec/api_resources/glossaries_spec.rb +167 -0
  42. data/spec/api_resources/labels_spec.rb +71 -0
  43. data/spec/api_resources/languages_spec.rb +51 -0
  44. data/spec/api_resources/machine_translation_engines_spec.rb +63 -0
  45. data/spec/api_resources/projects_spec.rb +215 -0
  46. data/spec/api_resources/reports_spec.rb +95 -0
  47. data/spec/api_resources/screenshots_spec.rb +134 -0
  48. data/spec/api_resources/source_files_spec.rb +13 -0
  49. data/spec/api_resources/source_strings_spec.rb +51 -0
  50. data/spec/api_resources/storages_spec.rb +13 -0
  51. data/spec/api_resources/string_comments_spec.rb +13 -0
  52. data/spec/api_resources/string_translations_spec.rb +13 -0
  53. data/spec/api_resources/tasks_spec.rb +79 -0
  54. data/spec/api_resources/teams_spec.rb +13 -0
  55. data/spec/api_resources/translation_memory_spec.rb +13 -0
  56. data/spec/api_resources/translation_status_spec.rb +15 -0
  57. data/spec/api_resources/translations_spec.rb +107 -0
  58. data/spec/api_resources/users_spec.rb +117 -0
  59. data/spec/api_resources/vendors_spec.rb +13 -0
  60. data/spec/api_resources/webhooks_spec.rb +51 -0
  61. data/spec/api_resources/workflows_spec.rb +41 -0
  62. data/spec/spec_helper.rb +20 -2
  63. data/spec/unit/client_spec.rb +85 -0
  64. metadata +65 -28
  65. data/bin/setup +0 -6
  66. data/lib/crowdin-api/api-resources/languages.rb +0 -81
  67. data/lib/crowdin-api/api-resources/projects.rb +0 -134
  68. data/lib/crowdin-api/api-resources/storages.rb +0 -102
  69. data/lib/crowdin-api/api-resources/workflows.rb +0 -59
  70. data/spec/core/config-instance_spec.rb +0 -72
  71. data/spec/crowdin-api_spec.rb +0 -7
@@ -1,72 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe 'Config instance' do
4
- before do
5
- @crowdin = Crowdin::Client.new do |config|
6
- config.api_token = 'api_token'
7
- config.project_id = 1
8
- end
9
- end
10
-
11
- it 'show have a #project_id' do
12
- expect(@crowdin.config.project_id).to_not be_nil
13
- end
14
-
15
- it 'should have a #api_token' do
16
- expect(@crowdin.config.api_token).to_not be_nil
17
- end
18
-
19
- it '#target_api_url should equal /api/v2 by default' do
20
- expect(@crowdin.config.target_api_url).to eq('/api/v2')
21
- end
22
-
23
- describe '#logger_enabled?' do
24
- it 'should be false by default' do
25
- expect(@crowdin.config.logger_enabled?).to be_falsey
26
- end
27
-
28
- it 'should equal specified argument' do
29
- @crowdin = Crowdin::Client.new do |config|
30
- config.enable_logger = true
31
- end
32
-
33
- expect(@crowdin.config.logger_enabled?).to be_truthy
34
- end
35
- end
36
-
37
- describe '#enterprise_mode?' do
38
- it 'should be false by default' do
39
- expect(@crowdin.config.enterprise_mode?).to be_falsey
40
- end
41
-
42
- it 'should equal specified arguments' do
43
- @crowdin = Crowdin::Client.new do |config|
44
- config.organization_domain = 'organization_domain'
45
- end
46
-
47
- expect(@crowdin.config.enterprise_mode?).to be_truthy
48
- end
49
- end
50
-
51
- describe '#base_url' do
52
- it 'should equal https://api.crowdin.com by default' do
53
- expect(@crowdin.config.base_url).to eq('https://api.crowdin.com')
54
- end
55
-
56
- it 'should equal specified organization domain' do
57
- @crowdin = Crowdin::Client.new do |config|
58
- config.organization_domain = 'organization_domain'
59
- end
60
-
61
- expect(@crowdin.config.base_url).to eq('https://organization_domain.api.crowdin.com')
62
- end
63
-
64
- it 'should equal full specified organization domain when user specify full url (with .com)' do
65
- @crowdin = Crowdin::Client.new do |config|
66
- config.organization_domain = 'organization_domain.com'
67
- end
68
-
69
- expect(@crowdin.config.base_url).to eq('organization_domain.com')
70
- end
71
- end
72
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Crowdin::Client do
4
- it 'should have a version' do
5
- expect(Crowdin::Client::VERSION).to_not be_nil
6
- end
7
- end