crowdin-api 0.5.0 → 1.1.1

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 (38) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/build-and-publish.yml +30 -0
  3. data/.github/workflows/test-and-lint.yml +31 -0
  4. data/.gitignore +12 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +5 -0
  7. data/.rubocop_todo.yml +139 -0
  8. data/CODE_OF_CONDUCT.md +128 -0
  9. data/CONTRIBUTING.md +71 -0
  10. data/Gemfile +5 -0
  11. data/LICENSE +1 -1
  12. data/README.md +114 -267
  13. data/Rakefile +19 -0
  14. data/bin/crowdin-console +54 -0
  15. data/bin/setup +6 -0
  16. data/crowdin-api.gemspec +33 -0
  17. data/lib/crowdin-api/api-resources/languages.rb +81 -0
  18. data/lib/crowdin-api/api-resources/projects.rb +134 -0
  19. data/lib/crowdin-api/api-resources/source_files.rb +303 -0
  20. data/lib/crowdin-api/api-resources/source_strings.rb +74 -0
  21. data/lib/crowdin-api/api-resources/storages.rb +102 -0
  22. data/lib/crowdin-api/api-resources/translation_status.rb +89 -0
  23. data/lib/crowdin-api/api-resources/translations.rb +162 -0
  24. data/lib/crowdin-api/api-resources/workflows.rb +59 -0
  25. data/lib/crowdin-api/client/client.rb +82 -0
  26. data/lib/crowdin-api/client/configuration.rb +44 -0
  27. data/lib/crowdin-api/client/version.rb +7 -0
  28. data/lib/crowdin-api/core/api_errors_raiser.rb +29 -0
  29. data/lib/crowdin-api/core/errors.rb +7 -0
  30. data/lib/crowdin-api/core/request.rb +118 -0
  31. data/lib/crowdin-api.rb +23 -126
  32. data/spec/core/config-instance_spec.rb +72 -0
  33. data/spec/crowdin-api_spec.rb +7 -0
  34. data/spec/spec_helper.rb +9 -0
  35. metadata +112 -40
  36. data/lib/crowdin-api/errors.rb +0 -23
  37. data/lib/crowdin-api/methods.rb +0 -427
  38. data/lib/crowdin-api/version.rb +0 -5
@@ -0,0 +1,72 @@
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
@@ -0,0 +1,7 @@
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
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+
6
+ require 'codecov'
7
+ SimpleCov.formatter = SimpleCov::Formatter::Codecov
8
+
9
+ require 'crowdin-api'
metadata CHANGED
@@ -1,135 +1,208 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crowdin-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Crowdin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-14 00:00:00.000000000 Z
11
+ date: 2022-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: open-uri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 0.2.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.1.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 0.2.0
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: rest-client
15
35
  requirement: !ruby/object:Gem::Requirement
16
36
  requirements:
17
- - - "~>"
37
+ - - ">="
18
38
  - !ruby/object:Gem::Version
19
- version: '2.0'
39
+ version: 2.0.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: 2.1.0
20
43
  type: :runtime
21
44
  prerelease: false
22
45
  version_requirements: !ruby/object:Gem::Requirement
23
46
  requirements:
24
- - - "~>"
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 2.0.0
50
+ - - "<"
25
51
  - !ruby/object:Gem::Version
26
- version: '2.0'
52
+ version: 2.1.0
27
53
  - !ruby/object:Gem::Dependency
28
- name: rspec
54
+ name: bundler
29
55
  requirement: !ruby/object:Gem::Requirement
30
56
  requirements:
31
57
  - - "~>"
32
58
  - !ruby/object:Gem::Version
33
- version: '3.4'
59
+ version: '2.2'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 2.2.32
34
63
  type: :development
35
64
  prerelease: false
36
65
  version_requirements: !ruby/object:Gem::Requirement
37
66
  requirements:
38
67
  - - "~>"
39
68
  - !ruby/object:Gem::Version
40
- version: '3.4'
69
+ version: '2.2'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 2.2.32
41
73
  - !ruby/object:Gem::Dependency
42
- name: webmock
74
+ name: codecov
43
75
  requirement: !ruby/object:Gem::Requirement
44
76
  requirements:
45
77
  - - "~>"
46
78
  - !ruby/object:Gem::Version
47
- version: '2.1'
79
+ version: 0.6.0
48
80
  type: :development
49
81
  prerelease: false
50
82
  version_requirements: !ruby/object:Gem::Requirement
51
83
  requirements:
52
84
  - - "~>"
53
85
  - !ruby/object:Gem::Version
54
- version: '2.1'
86
+ version: 0.6.0
55
87
  - !ruby/object:Gem::Dependency
56
- name: sinatra
88
+ name: rake
57
89
  requirement: !ruby/object:Gem::Requirement
58
90
  requirements:
59
91
  - - "~>"
60
92
  - !ruby/object:Gem::Version
61
- version: '1.4'
93
+ version: '13.0'
62
94
  - - ">="
63
95
  - !ruby/object:Gem::Version
64
- version: 1.4.7
96
+ version: 13.0.6
65
97
  type: :development
66
98
  prerelease: false
67
99
  version_requirements: !ruby/object:Gem::Requirement
68
100
  requirements:
69
101
  - - "~>"
70
102
  - !ruby/object:Gem::Version
71
- version: '1.4'
103
+ version: '13.0'
72
104
  - - ">="
73
105
  - !ruby/object:Gem::Version
74
- version: 1.4.7
106
+ version: 13.0.6
75
107
  - !ruby/object:Gem::Dependency
76
- name: bundler
108
+ name: rspec
77
109
  requirement: !ruby/object:Gem::Requirement
78
110
  requirements:
79
111
  - - "~>"
80
112
  - !ruby/object:Gem::Version
81
- version: '1.9'
113
+ version: '3.10'
82
114
  type: :development
83
115
  prerelease: false
84
116
  version_requirements: !ruby/object:Gem::Requirement
85
117
  requirements:
86
118
  - - "~>"
87
119
  - !ruby/object:Gem::Version
88
- version: '1.9'
120
+ version: '3.10'
89
121
  - !ruby/object:Gem::Dependency
90
- name: rake
122
+ name: rubocop
91
123
  requirement: !ruby/object:Gem::Requirement
92
124
  requirements:
93
125
  - - "~>"
94
126
  - !ruby/object:Gem::Version
95
- version: '10.0'
127
+ version: '1.23'
96
128
  type: :development
97
129
  prerelease: false
98
130
  version_requirements: !ruby/object:Gem::Requirement
99
131
  requirements:
100
132
  - - "~>"
101
133
  - !ruby/object:Gem::Version
102
- version: '10.0'
134
+ version: '1.23'
103
135
  - !ruby/object:Gem::Dependency
104
- name: pry
136
+ name: sinatra
105
137
  requirement: !ruby/object:Gem::Requirement
106
138
  requirements:
107
139
  - - "~>"
108
140
  - !ruby/object:Gem::Version
109
- version: 0.10.3
141
+ version: '2.1'
110
142
  type: :development
111
143
  prerelease: false
112
144
  version_requirements: !ruby/object:Gem::Requirement
113
145
  requirements:
114
146
  - - "~>"
115
147
  - !ruby/object:Gem::Version
116
- version: 0.10.3
117
- description: Ruby Client for the Crowdin API
148
+ version: '2.1'
149
+ - !ruby/object:Gem::Dependency
150
+ name: webmock
151
+ requirement: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - "~>"
154
+ - !ruby/object:Gem::Version
155
+ version: '3.14'
156
+ type: :development
157
+ prerelease: false
158
+ version_requirements: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - "~>"
161
+ - !ruby/object:Gem::Version
162
+ version: '3.14'
163
+ description: The Crowdin Ruby Client is used to interact with the Crowdin API from
164
+ Ruby
118
165
  email:
119
- - support@crowdin.net
120
- executables: []
166
+ - support@crowdin.com
167
+ executables:
168
+ - crowdin-console
121
169
  extensions: []
122
- extra_rdoc_files:
123
- - README.md
124
- - LICENSE
170
+ extra_rdoc_files: []
125
171
  files:
172
+ - ".github/workflows/build-and-publish.yml"
173
+ - ".github/workflows/test-and-lint.yml"
174
+ - ".gitignore"
175
+ - ".rspec"
176
+ - ".rubocop.yml"
177
+ - ".rubocop_todo.yml"
178
+ - CODE_OF_CONDUCT.md
179
+ - CONTRIBUTING.md
180
+ - Gemfile
126
181
  - LICENSE
127
182
  - README.md
183
+ - Rakefile
184
+ - bin/crowdin-console
185
+ - bin/setup
186
+ - crowdin-api.gemspec
128
187
  - lib/crowdin-api.rb
129
- - lib/crowdin-api/errors.rb
130
- - lib/crowdin-api/methods.rb
131
- - lib/crowdin-api/version.rb
132
- homepage: https://github.com/crowdin/crowdin-api/
188
+ - lib/crowdin-api/api-resources/languages.rb
189
+ - lib/crowdin-api/api-resources/projects.rb
190
+ - lib/crowdin-api/api-resources/source_files.rb
191
+ - lib/crowdin-api/api-resources/source_strings.rb
192
+ - lib/crowdin-api/api-resources/storages.rb
193
+ - lib/crowdin-api/api-resources/translation_status.rb
194
+ - lib/crowdin-api/api-resources/translations.rb
195
+ - lib/crowdin-api/api-resources/workflows.rb
196
+ - lib/crowdin-api/client/client.rb
197
+ - lib/crowdin-api/client/configuration.rb
198
+ - lib/crowdin-api/client/version.rb
199
+ - lib/crowdin-api/core/api_errors_raiser.rb
200
+ - lib/crowdin-api/core/errors.rb
201
+ - lib/crowdin-api/core/request.rb
202
+ - spec/core/config-instance_spec.rb
203
+ - spec/crowdin-api_spec.rb
204
+ - spec/spec_helper.rb
205
+ homepage: https://github.com/crowdin/crowdin-api-client-ruby
133
206
  licenses:
134
207
  - MIT
135
208
  metadata: {}
@@ -141,16 +214,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
214
  requirements:
142
215
  - - ">="
143
216
  - !ruby/object:Gem::Version
144
- version: '0'
217
+ version: '2.4'
145
218
  required_rubygems_version: !ruby/object:Gem::Requirement
146
219
  requirements:
147
220
  - - ">="
148
221
  - !ruby/object:Gem::Version
149
222
  version: '0'
150
223
  requirements: []
151
- rubyforge_project:
152
- rubygems_version: 2.5.2
224
+ rubygems_version: 3.0.3.1
153
225
  signing_key:
154
226
  specification_version: 4
155
- summary: Client library to manage translations on Crowdin
227
+ summary: Ruby Client for the Crowdin API
156
228
  test_files: []
@@ -1,23 +0,0 @@
1
- module Crowdin
2
- class API
3
-
4
- module Errors
5
- class Error < StandardError
6
- attr_reader :error_code
7
- attr_reader :error_message
8
- attr_reader :message
9
-
10
- def initialize(error_code, error_message)
11
- @error_code = error_code.to_i
12
- @error_message = error_message
13
- @message = "#{error_code}: #{error_message}"
14
- end
15
-
16
- def to_s
17
- @message
18
- end
19
- end
20
- end
21
-
22
- end
23
- end