ruby-lokalise-api 2.8.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile +2 -0
- data/README.md +1 -0
- data/Rakefile +6 -1
- data/lib/ruby-lokalise-api.rb +2 -0
- data/lib/ruby-lokalise-api/client.rb +2 -0
- data/lib/ruby-lokalise-api/collections/base.rb +2 -0
- data/lib/ruby-lokalise-api/collections/branch.rb +3 -1
- data/lib/ruby-lokalise-api/collections/contributor.rb +2 -0
- data/lib/ruby-lokalise-api/collections/custom_translation_status.rb +3 -1
- data/lib/ruby-lokalise-api/collections/file.rb +2 -0
- data/lib/ruby-lokalise-api/collections/key.rb +2 -0
- data/lib/ruby-lokalise-api/collections/key_comment.rb +2 -0
- data/lib/ruby-lokalise-api/collections/order.rb +2 -0
- data/lib/ruby-lokalise-api/collections/payment_card.rb +2 -0
- data/lib/ruby-lokalise-api/collections/project.rb +2 -0
- data/lib/ruby-lokalise-api/collections/project_comment.rb +2 -0
- data/lib/ruby-lokalise-api/collections/project_language.rb +2 -0
- data/lib/ruby-lokalise-api/collections/screenshot.rb +2 -0
- data/lib/ruby-lokalise-api/collections/snapshot.rb +2 -0
- data/lib/ruby-lokalise-api/collections/system_language.rb +2 -0
- data/lib/ruby-lokalise-api/collections/task.rb +2 -0
- data/lib/ruby-lokalise-api/collections/team.rb +2 -0
- data/lib/ruby-lokalise-api/collections/team_user.rb +2 -0
- data/lib/ruby-lokalise-api/collections/team_user_group.rb +3 -1
- data/lib/ruby-lokalise-api/collections/translation.rb +2 -0
- data/lib/ruby-lokalise-api/collections/translation_provider.rb +2 -0
- data/lib/ruby-lokalise-api/collections/webhook.rb +2 -0
- data/lib/ruby-lokalise-api/connection.rb +3 -1
- data/lib/ruby-lokalise-api/error.rb +2 -0
- data/lib/ruby-lokalise-api/json_handler.rb +4 -0
- data/lib/ruby-lokalise-api/request.rb +2 -0
- data/lib/ruby-lokalise-api/resources/base.rb +2 -0
- data/lib/ruby-lokalise-api/resources/branch.rb +2 -0
- data/lib/ruby-lokalise-api/resources/contributor.rb +3 -1
- data/lib/ruby-lokalise-api/resources/custom_translation_status.rb +3 -1
- data/lib/ruby-lokalise-api/resources/file.rb +2 -0
- data/lib/ruby-lokalise-api/resources/key.rb +2 -0
- data/lib/ruby-lokalise-api/resources/key_comment.rb +4 -2
- data/lib/ruby-lokalise-api/resources/order.rb +2 -0
- data/lib/ruby-lokalise-api/resources/payment_card.rb +2 -0
- data/lib/ruby-lokalise-api/resources/project.rb +2 -0
- data/lib/ruby-lokalise-api/resources/project_comment.rb +3 -1
- data/lib/ruby-lokalise-api/resources/project_language.rb +4 -2
- data/lib/ruby-lokalise-api/resources/screenshot.rb +2 -0
- data/lib/ruby-lokalise-api/resources/snapshot.rb +2 -0
- data/lib/ruby-lokalise-api/resources/system_language.rb +3 -1
- data/lib/ruby-lokalise-api/resources/task.rb +2 -0
- data/lib/ruby-lokalise-api/resources/team.rb +2 -0
- data/lib/ruby-lokalise-api/resources/team_user.rb +3 -1
- data/lib/ruby-lokalise-api/resources/team_user_group.rb +4 -2
- data/lib/ruby-lokalise-api/resources/translation.rb +2 -0
- data/lib/ruby-lokalise-api/resources/translation_provider.rb +2 -0
- data/lib/ruby-lokalise-api/resources/webhook.rb +2 -0
- data/lib/ruby-lokalise-api/rest/branches.rb +2 -0
- data/lib/ruby-lokalise-api/rest/comments.rb +2 -0
- data/lib/ruby-lokalise-api/rest/contributors.rb +2 -0
- data/lib/ruby-lokalise-api/rest/custom_translation_statuses.rb +2 -0
- data/lib/ruby-lokalise-api/rest/files.rb +2 -0
- data/lib/ruby-lokalise-api/rest/keys.rb +2 -0
- data/lib/ruby-lokalise-api/rest/languages.rb +2 -0
- data/lib/ruby-lokalise-api/rest/orders.rb +2 -0
- data/lib/ruby-lokalise-api/rest/payment_cards.rb +2 -0
- data/lib/ruby-lokalise-api/rest/projects.rb +2 -0
- data/lib/ruby-lokalise-api/rest/screenshots.rb +2 -0
- data/lib/ruby-lokalise-api/rest/snapshots.rb +2 -0
- data/lib/ruby-lokalise-api/rest/tasks.rb +2 -0
- data/lib/ruby-lokalise-api/rest/team_user_group.rb +2 -0
- data/lib/ruby-lokalise-api/rest/team_users.rb +2 -0
- data/lib/ruby-lokalise-api/rest/teams.rb +2 -0
- data/lib/ruby-lokalise-api/rest/translation_providers.rb +2 -0
- data/lib/ruby-lokalise-api/rest/translations.rb +2 -0
- data/lib/ruby-lokalise-api/rest/webhooks.rb +2 -0
- data/lib/ruby-lokalise-api/utils/attribute_helpers.rb +2 -0
- data/lib/ruby-lokalise-api/utils/endpoint_helpers.rb +2 -0
- data/lib/ruby-lokalise-api/utils/string_utils.rb +2 -0
- data/lib/ruby-lokalise-api/version.rb +3 -1
- data/ruby-lokalise-api.gemspec +7 -2
- data/spec/lib/ruby-lokalise-api/connection_spec.rb +10 -7
- data/spec/lib/ruby-lokalise-api/custom_json_parser_spec.rb +9 -5
- data/spec/lib/ruby-lokalise-api/error_spec.rb +7 -4
- data/spec/lib/ruby-lokalise-api/rest/branches_spec.rb +7 -5
- data/spec/lib/ruby-lokalise-api/rest/comments_spec.rb +7 -5
- data/spec/lib/ruby-lokalise-api/rest/contributors_spec.rb +6 -4
- data/spec/lib/ruby-lokalise-api/rest/custom_translation_statuses_spec.rb +6 -4
- data/spec/lib/ruby-lokalise-api/rest/files_spec.rb +4 -2
- data/spec/lib/ruby-lokalise-api/rest/keys_spec.rb +8 -6
- data/spec/lib/ruby-lokalise-api/rest/languages_spec.rb +8 -6
- data/spec/lib/ruby-lokalise-api/rest/orders_spec.rb +4 -2
- data/spec/lib/ruby-lokalise-api/rest/payment_cards_spec.rb +5 -3
- data/spec/lib/ruby-lokalise-api/rest/projects_spec.rb +6 -4
- data/spec/lib/ruby-lokalise-api/rest/screenshots_spec.rb +6 -4
- data/spec/lib/ruby-lokalise-api/rest/snapshots_spec.rb +6 -4
- data/spec/lib/ruby-lokalise-api/rest/tasks_spec.rb +6 -4
- data/spec/lib/ruby-lokalise-api/rest/team_user_groups_spec.rb +8 -6
- data/spec/lib/ruby-lokalise-api/rest/team_users_spec.rb +6 -4
- data/spec/lib/ruby-lokalise-api/rest/teams_spec.rb +2 -0
- data/spec/lib/ruby-lokalise-api/rest/translation_providers_spec.rb +4 -2
- data/spec/lib/ruby-lokalise-api/rest/translations_spec.rb +8 -6
- data/spec/lib/ruby-lokalise-api/rest/webhooks_spec.rb +4 -2
- data/spec/lib/ruby-lokalise-api/utils/snakecase_spec.rb +2 -0
- data/spec/lib/ruby-lokalise-api_spec.rb +12 -9
- data/spec/spec_helper.rb +8 -1
- data/spec/support/test_client.rb +2 -0
- data/spec/support/vcr.rb +2 -0
- metadata +49 -7
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Lokalise::Client do
|
2
4
|
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
3
5
|
let(:webhook_id) { 'c7eb7e6e3c2fb2b26d0b64d0de083a5a71675b3d' }
|
4
6
|
let(:new_webhook_id) { 'b345ccc6499920c490e8f4fe9487b1378dbf1dbf' }
|
5
7
|
|
6
8
|
describe '#webhooks' do
|
7
|
-
it '
|
9
|
+
it 'returns all webhooks' do
|
8
10
|
webhooks = VCR.use_cassette('webhooks') do
|
9
11
|
test_client.webhooks project_id
|
10
12
|
end.collection
|
@@ -13,7 +15,7 @@ RSpec.describe Lokalise::Client do
|
|
13
15
|
expect(webhooks.first.url).to eq('https://serios.webhook')
|
14
16
|
end
|
15
17
|
|
16
|
-
it '
|
18
|
+
it 'supports pagination' do
|
17
19
|
webhooks = VCR.use_cassette('all_webhooks_pagination') do
|
18
20
|
test_client.webhooks project_id, limit: 1, page: 2
|
19
21
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Lokalise do
|
2
4
|
specify '.client' do
|
3
5
|
expect(test_client).to be_an_instance_of(Lokalise::Client)
|
@@ -8,22 +10,23 @@ RSpec.describe Lokalise do
|
|
8
10
|
|
9
11
|
specify '.reset_client!' do
|
10
12
|
expect(test_client).to be_an_instance_of(Lokalise::Client)
|
11
|
-
|
12
|
-
current_client =
|
13
|
+
described_class.reset_client!
|
14
|
+
current_client = described_class.instance_variable_get '@client'
|
13
15
|
expect(current_client).to be_nil
|
14
16
|
end
|
15
17
|
|
16
|
-
context 'client params' do
|
17
|
-
before
|
18
|
-
|
18
|
+
context 'with client params' do
|
19
|
+
before { described_class.reset_client! }
|
20
|
+
|
21
|
+
after { described_class.reset_client! }
|
19
22
|
|
20
|
-
it '
|
21
|
-
custom_client =
|
23
|
+
it 'is possible to customize timeout' do
|
24
|
+
custom_client = described_class.client(ENV['LOKALISE_API_TOKEN'], timeout: 600)
|
22
25
|
expect(custom_client.timeout).to eq(600)
|
23
26
|
end
|
24
27
|
|
25
|
-
it '
|
26
|
-
custom_client =
|
28
|
+
it 'is possible to customize open timeout' do
|
29
|
+
custom_client = described_class.client(ENV['LOKALISE_API_TOKEN'], open_timeout: 100)
|
27
30
|
expect(custom_client.open_timeout).to eq(100)
|
28
31
|
end
|
29
32
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'dotenv/load'
|
2
4
|
require 'simplecov'
|
3
5
|
SimpleCov.start do
|
@@ -5,10 +7,15 @@ SimpleCov.start do
|
|
5
7
|
add_filter '.github/'
|
6
8
|
end
|
7
9
|
|
10
|
+
if ENV['CI'] == 'true'
|
11
|
+
require 'codecov'
|
12
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
13
|
+
end
|
14
|
+
|
8
15
|
require 'ruby-lokalise-api'
|
9
16
|
|
10
17
|
# Support files
|
11
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
18
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
|
12
19
|
|
13
20
|
RSpec.configure do |config|
|
14
21
|
config.include TestClient
|
data/spec/support/test_client.rb
CHANGED
data/spec/support/vcr.rb
CHANGED
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: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Bodrov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -30,14 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
33
|
+
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.3'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: codecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.1'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: dotenv
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +142,28 @@ dependencies:
|
|
114
142
|
requirements:
|
115
143
|
- - "~>"
|
116
144
|
- !ruby/object:Gem::Version
|
117
|
-
version: '1.
|
145
|
+
version: '1.5'
|
118
146
|
type: :development
|
119
147
|
prerelease: false
|
120
148
|
version_requirements: !ruby/object:Gem::Requirement
|
121
149
|
requirements:
|
122
150
|
- - "~>"
|
123
151
|
- !ruby/object:Gem::Version
|
124
|
-
version: '1.
|
152
|
+
version: '1.5'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop-rspec
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.37'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.37'
|
125
167
|
- !ruby/object:Gem::Dependency
|
126
168
|
name: simplecov
|
127
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -288,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
288
330
|
- !ruby/object:Gem::Version
|
289
331
|
version: '0'
|
290
332
|
requirements: []
|
291
|
-
rubygems_version: 3.
|
333
|
+
rubygems_version: 3.1.2
|
292
334
|
signing_key:
|
293
335
|
specification_version: 4
|
294
336
|
summary: Ruby interface to the Lokalise API
|