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,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Lokalise::Client do
|
2
4
|
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
3
5
|
|
4
6
|
describe '#files' do
|
5
|
-
it '
|
7
|
+
it 'returns all files' do
|
6
8
|
files = VCR.use_cassette('files') do
|
7
9
|
test_client.files project_id
|
8
10
|
end.collection
|
@@ -14,7 +16,7 @@ RSpec.describe Lokalise::Client do
|
|
14
16
|
expect(file.key_count).to eq(1)
|
15
17
|
end
|
16
18
|
|
17
|
-
it '
|
19
|
+
it 'supports pagination' do
|
18
20
|
files = VCR.use_cassette('all_files_pagination') do
|
19
21
|
test_client.files project_id, limit: 1, page: 1
|
20
22
|
end
|
@@ -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(:key_id) { 15_305_182 }
|
4
6
|
let(:new_key_id) { 15_519_770 }
|
5
7
|
|
6
8
|
describe '#keys' do
|
7
|
-
it '
|
9
|
+
it 'returns all keys' do
|
8
10
|
keys = VCR.use_cassette('all_keys') do
|
9
11
|
test_client.keys project_id
|
10
12
|
end.collection
|
@@ -12,7 +14,7 @@ RSpec.describe Lokalise::Client do
|
|
12
14
|
expect(keys.count).to eq(1)
|
13
15
|
end
|
14
16
|
|
15
|
-
it '
|
17
|
+
it 'supports pagination' do
|
16
18
|
keys = VCR.use_cassette('all_keys_pagination') do
|
17
19
|
test_client.keys project_id, limit: 1, page: 1
|
18
20
|
end
|
@@ -126,8 +128,8 @@ RSpec.describe Lokalise::Client do
|
|
126
128
|
expect(response['keys_removed']).to eq(true)
|
127
129
|
end
|
128
130
|
|
129
|
-
context 'key chained
|
130
|
-
it '
|
131
|
+
context 'when key methods are chained' do
|
132
|
+
it 'supports update and destroy' do
|
131
133
|
key = VCR.use_cassette('create_another_key') do
|
132
134
|
test_client.create_keys project_id, key_name: 'chained_k', platforms: %w[ios]
|
133
135
|
end.collection.first
|
@@ -153,8 +155,8 @@ RSpec.describe Lokalise::Client do
|
|
153
155
|
end
|
154
156
|
end
|
155
157
|
|
156
|
-
context 'keys collection chained
|
157
|
-
it '
|
158
|
+
context 'when keys collection methods are chained' do
|
159
|
+
it 'supports destroy_all' do
|
158
160
|
keys = VCR.use_cassette('create_keys_collection') do
|
159
161
|
test_client.create_keys project_id, [
|
160
162
|
{
|
@@ -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(:language_id) { 640 }
|
4
6
|
let(:new_language_id) { 894 }
|
5
7
|
|
6
8
|
describe '#system_languages' do
|
7
|
-
it '
|
9
|
+
it 'returns all system languages' do
|
8
10
|
languages = VCR.use_cassette('all_system_languages') do
|
9
11
|
test_client.system_languages
|
10
12
|
end.collection
|
@@ -13,7 +15,7 @@ RSpec.describe Lokalise::Client do
|
|
13
15
|
expect(languages.first.lang_iso).to eq('ab')
|
14
16
|
end
|
15
17
|
|
16
|
-
it '
|
18
|
+
it 'supports pagination' do
|
17
19
|
languages = VCR.use_cassette('all_system_languages_pagination') do
|
18
20
|
test_client.system_languages limit: 10, page: 3
|
19
21
|
end
|
@@ -27,7 +29,7 @@ RSpec.describe Lokalise::Client do
|
|
27
29
|
end
|
28
30
|
|
29
31
|
describe '#project_languages' do
|
30
|
-
it '
|
32
|
+
it 'returns all project languages' do
|
31
33
|
languages = VCR.use_cassette('all_project_languages') do
|
32
34
|
test_client.project_languages project_id
|
33
35
|
end.collection
|
@@ -36,7 +38,7 @@ RSpec.describe Lokalise::Client do
|
|
36
38
|
expect(languages.first.lang_iso).to eq('en')
|
37
39
|
end
|
38
40
|
|
39
|
-
it '
|
41
|
+
it 'supports pagination' do
|
40
42
|
languages = VCR.use_cassette('all_project_languages_pagination') do
|
41
43
|
test_client.project_languages project_id, limit: 1, page: 2
|
42
44
|
end
|
@@ -89,8 +91,8 @@ RSpec.describe Lokalise::Client do
|
|
89
91
|
expect(response['language_deleted']).to eq(true)
|
90
92
|
end
|
91
93
|
|
92
|
-
context 'project language chained
|
93
|
-
it '
|
94
|
+
context 'when project language methods are chained' do
|
95
|
+
it 'supports update and destroy' do
|
94
96
|
language = VCR.use_cassette('create_another_language') do
|
95
97
|
test_client.create_languages project_id, lang_iso: 'ab', custom_name: 'chained lang'
|
96
98
|
end.collection.first
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Lokalise::Client do
|
2
4
|
let(:team_id) { 176_692 }
|
3
5
|
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
@@ -6,7 +8,7 @@ RSpec.describe Lokalise::Client do
|
|
6
8
|
let(:card_id) { 1774 }
|
7
9
|
|
8
10
|
describe '#orders' do
|
9
|
-
it '
|
11
|
+
it 'returns all orders' do
|
10
12
|
orders = VCR.use_cassette('all_orders') do
|
11
13
|
test_client.orders team_id
|
12
14
|
end.collection
|
@@ -15,7 +17,7 @@ RSpec.describe Lokalise::Client do
|
|
15
17
|
expect(orders.first.order_id).to eq(order_id)
|
16
18
|
end
|
17
19
|
|
18
|
-
it '
|
20
|
+
it 'supports pagination' do
|
19
21
|
orders = VCR.use_cassette('all_orders_pagination') do
|
20
22
|
test_client.orders team_id, limit: 1, page: 1
|
21
23
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Lokalise::Client do
|
2
4
|
let(:card_id) { 1773 }
|
3
5
|
|
4
6
|
describe '#payment_cards' do
|
5
|
-
it '
|
7
|
+
it 'returns all payment cards' do
|
6
8
|
cards = VCR.use_cassette('all_payment_cards') do
|
7
9
|
test_client.payment_cards
|
8
10
|
end.collection
|
@@ -12,7 +14,7 @@ RSpec.describe Lokalise::Client do
|
|
12
14
|
expect(card.last4).to eq('0358')
|
13
15
|
end
|
14
16
|
|
15
|
-
it '
|
17
|
+
it 'supports pagination' do
|
16
18
|
cards = VCR.use_cassette('all_payment_cards_pagination') do
|
17
19
|
test_client.payment_cards limit: 1, page: 1
|
18
20
|
end
|
@@ -62,7 +64,7 @@ RSpec.describe Lokalise::Client do
|
|
62
64
|
expect(result['card_id']).to eq(card_id)
|
63
65
|
end
|
64
66
|
|
65
|
-
it '
|
67
|
+
it 'supports chained destroy' do
|
66
68
|
card = VCR.use_cassette('payment_card') do
|
67
69
|
test_client.payment_card card_id
|
68
70
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Lokalise::Client do
|
2
4
|
let(:new_project_id) { '572222075c0953fd70d492.30502628' }
|
3
5
|
|
4
6
|
describe '#projects' do
|
5
|
-
it '
|
7
|
+
it 'returns all projects' do
|
6
8
|
projects = VCR.use_cassette('all_projects') do
|
7
9
|
test_client.projects
|
8
10
|
end.collection
|
@@ -12,7 +14,7 @@ RSpec.describe Lokalise::Client do
|
|
12
14
|
expect(project.name).to eq('demo phoenix')
|
13
15
|
end
|
14
16
|
|
15
|
-
it '
|
17
|
+
it 'supports pagination' do
|
16
18
|
projects = VCR.use_cassette('all_projects_pagination') do
|
17
19
|
test_client.projects limit: 1, page: 2
|
18
20
|
end
|
@@ -87,8 +89,8 @@ RSpec.describe Lokalise::Client do
|
|
87
89
|
expect(response['project_deleted']).to eq(true)
|
88
90
|
end
|
89
91
|
|
90
|
-
context 'project chained
|
91
|
-
it '
|
92
|
+
context 'when project methods are chained' do
|
93
|
+
it 'supports update, empty, and destroy' do
|
92
94
|
project = VCR.use_cassette('create_another_project') do
|
93
95
|
test_client.create_project name: 'chained proj'
|
94
96
|
end
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Lokalise::Client do
|
2
4
|
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
3
5
|
let(:screenshot_id) { 115_185 }
|
4
6
|
|
5
7
|
describe '#screenshots' do
|
6
|
-
it '
|
8
|
+
it 'returns all screenshots' do
|
7
9
|
screenshots = VCR.use_cassette('all_screenshots') do
|
8
10
|
test_client.screenshots project_id
|
9
11
|
end.collection
|
@@ -11,7 +13,7 @@ RSpec.describe Lokalise::Client do
|
|
11
13
|
expect(screenshots.count).to eq(1)
|
12
14
|
end
|
13
15
|
|
14
|
-
it '
|
16
|
+
it 'supports pagination' do
|
15
17
|
screenshots = VCR.use_cassette('all_screenshots_pagination') do
|
16
18
|
test_client.screenshots project_id, limit: 1, page: 1
|
17
19
|
end
|
@@ -69,8 +71,8 @@ RSpec.describe Lokalise::Client do
|
|
69
71
|
expect(response['screenshot_deleted']).to eq(true)
|
70
72
|
end
|
71
73
|
|
72
|
-
context 'screenshot chained
|
73
|
-
it '
|
74
|
+
context 'when screenshot methods are chained' do
|
75
|
+
it 'supports update and destroy' do
|
74
76
|
screenshot = screenshot_from_file do |file|
|
75
77
|
VCR.use_cassette('create_another_screenshot') do
|
76
78
|
test_client.create_screenshots project_id, data: file.read, title: 'chained screen'
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Lokalise::Client do
|
2
4
|
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
3
5
|
let(:snapshot_id) { 27_881 }
|
4
6
|
|
5
7
|
describe '#snapshots' do
|
6
|
-
it '
|
8
|
+
it 'returns all snapshots' do
|
7
9
|
snapshots = VCR.use_cassette('all_snapshots') do
|
8
10
|
test_client.snapshots project_id
|
9
11
|
end.collection
|
@@ -19,7 +21,7 @@ RSpec.describe Lokalise::Client do
|
|
19
21
|
expect(snapshot.created_at_timestamp).to eq(1_544_461_324)
|
20
22
|
end
|
21
23
|
|
22
|
-
it '
|
24
|
+
it 'supports pagination' do
|
23
25
|
snapshots = VCR.use_cassette('all_snapshots_pagination') do
|
24
26
|
test_client.snapshots project_id, limit: 1, page: 2
|
25
27
|
end
|
@@ -65,8 +67,8 @@ RSpec.describe Lokalise::Client do
|
|
65
67
|
expect(response['snapshot_deleted']).to eq(true)
|
66
68
|
end
|
67
69
|
|
68
|
-
context 'snapshot chained
|
69
|
-
it '
|
70
|
+
context 'when snapshot methods are chained' do
|
71
|
+
it 'supports destroy and restore' do
|
70
72
|
snapshot = VCR.use_cassette('create_another_snapshot') do
|
71
73
|
test_client.create_snapshot project_id, title: 'chained'
|
72
74
|
end
|
@@ -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(:key_id) { 15_571_976 }
|
4
6
|
let(:task_id) { 4387 }
|
5
7
|
|
6
8
|
describe '#tasks' do
|
7
|
-
it '
|
9
|
+
it 'returns all tasks' do
|
8
10
|
tasks = VCR.use_cassette('all_tasks') do
|
9
11
|
test_client.tasks project_id
|
10
12
|
end.collection
|
@@ -12,7 +14,7 @@ RSpec.describe Lokalise::Client do
|
|
12
14
|
expect(tasks.count).to eq(3)
|
13
15
|
end
|
14
16
|
|
15
|
-
it '
|
17
|
+
it 'supports pagination' do
|
16
18
|
tasks = VCR.use_cassette('all_tasks_pagination') do
|
17
19
|
test_client.tasks project_id, limit: 2, page: 2
|
18
20
|
end
|
@@ -92,8 +94,8 @@ RSpec.describe Lokalise::Client do
|
|
92
94
|
expect(response['task_deleted']).to eq(true)
|
93
95
|
end
|
94
96
|
|
95
|
-
context 'task chained
|
96
|
-
it '
|
97
|
+
context 'when task methods are chained' do
|
98
|
+
it 'supports update and destroy' do
|
97
99
|
task = VCR.use_cassette('create_another_task') do
|
98
100
|
test_client.create_task project_id, title: 'chained',
|
99
101
|
keys: [key_id],
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Lokalise::Client do
|
2
4
|
let(:team_id) { 176_692 }
|
3
5
|
let(:group_id) { 515 }
|
@@ -8,7 +10,7 @@ RSpec.describe Lokalise::Client do
|
|
8
10
|
let(:user_id) { 35_554 }
|
9
11
|
|
10
12
|
describe '#team_user_groups' do
|
11
|
-
it '
|
13
|
+
it 'returns all team_user_groups' do
|
12
14
|
team_user_groups = VCR.use_cassette('team_user_groups') do
|
13
15
|
test_client.team_user_groups team_id
|
14
16
|
end
|
@@ -17,7 +19,7 @@ RSpec.describe Lokalise::Client do
|
|
17
19
|
expect(team_user_groups.team_id).to eq(team_id)
|
18
20
|
end
|
19
21
|
|
20
|
-
it '
|
22
|
+
it 'supports pagination' do
|
21
23
|
team_users = VCR.use_cassette('team_user_groups_pagination') do
|
22
24
|
test_client.team_user_groups team_id, limit: 1, page: 2
|
23
25
|
end
|
@@ -121,8 +123,8 @@ RSpec.describe Lokalise::Client do
|
|
121
123
|
expect(group.members).to be_empty
|
122
124
|
end
|
123
125
|
|
124
|
-
context 'team user group chained
|
125
|
-
it '
|
126
|
+
context 'when team user group methods are chained' do
|
127
|
+
it 'supports update and destroy' do
|
126
128
|
group = VCR.use_cassette('another_team_user_group') do
|
127
129
|
test_client.team_user_group team_id, third_group_id
|
128
130
|
end
|
@@ -145,7 +147,7 @@ RSpec.describe Lokalise::Client do
|
|
145
147
|
expect(response['group_deleted']).to eq(true)
|
146
148
|
end
|
147
149
|
|
148
|
-
it '
|
150
|
+
it 'supports project management' do
|
149
151
|
group = VCR.use_cassette('team_user_group') do
|
150
152
|
test_client.team_user_group team_id, group_id
|
151
153
|
end
|
@@ -167,7 +169,7 @@ RSpec.describe Lokalise::Client do
|
|
167
169
|
expect(group.projects).not_to include(another_project_id)
|
168
170
|
end
|
169
171
|
|
170
|
-
it '
|
172
|
+
it 'supports users management' do
|
171
173
|
group = VCR.use_cassette('team_user_group') do
|
172
174
|
test_client.team_user_group team_id, group_id
|
173
175
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Lokalise::Client do
|
2
4
|
let(:team_id) { 176_692 }
|
3
5
|
let(:team_user_id) { 25_953 }
|
4
6
|
let(:another_user_id) { 26_265 }
|
5
7
|
|
6
8
|
describe '#team_users' do
|
7
|
-
it '
|
9
|
+
it 'returns all team_users' do
|
8
10
|
team_users = VCR.use_cassette('team_users') do
|
9
11
|
test_client.team_users team_id
|
10
12
|
end
|
@@ -13,7 +15,7 @@ RSpec.describe Lokalise::Client do
|
|
13
15
|
expect(team_users.team_id).to eq(team_id)
|
14
16
|
end
|
15
17
|
|
16
|
-
it '
|
18
|
+
it 'supports pagination' do
|
17
19
|
team_users = VCR.use_cassette('all_team_users_pagination') do
|
18
20
|
test_client.team_users team_id, limit: 1, page: 3
|
19
21
|
end
|
@@ -56,8 +58,8 @@ RSpec.describe Lokalise::Client do
|
|
56
58
|
expect(response['team_user_deleted']).to eq(true)
|
57
59
|
end
|
58
60
|
|
59
|
-
context 'team user chained
|
60
|
-
it '
|
61
|
+
context 'when team user methods are chained' do
|
62
|
+
it 'supports update and destroy' do
|
61
63
|
team_user = VCR.use_cassette('another_team_user') do
|
62
64
|
test_client.team_user team_id, another_user_id
|
63
65
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec.describe Lokalise::Client do
|
2
4
|
let(:team_id) { 176_692 }
|
3
5
|
|
4
6
|
describe '#translation_providers' do
|
5
|
-
it '
|
7
|
+
it 'returns all providers' do
|
6
8
|
providers = VCR.use_cassette('all_translation_providers') do
|
7
9
|
test_client.translation_providers team_id
|
8
10
|
end.collection
|
@@ -11,7 +13,7 @@ RSpec.describe Lokalise::Client do
|
|
11
13
|
expect(providers.first.slug).to eq('gengo')
|
12
14
|
end
|
13
15
|
|
14
|
-
it '
|
16
|
+
it 'supports pagination' do
|
15
17
|
providers = VCR.use_cassette('all_translation_providers_pagination') do
|
16
18
|
test_client.translation_providers team_id, limit: 1, page: 2
|
17
19
|
end
|
@@ -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(:translation_id) { 80_015_147 }
|
4
6
|
let(:another_translation_id) { 82_070_312 }
|
5
7
|
|
6
8
|
describe '#translations' do
|
7
|
-
it '
|
9
|
+
it 'returns all translations' do
|
8
10
|
translations = VCR.use_cassette('translations') do
|
9
11
|
test_client.translations project_id
|
10
12
|
end.collection
|
@@ -12,7 +14,7 @@ RSpec.describe Lokalise::Client do
|
|
12
14
|
expect(translations.count).to eq(9)
|
13
15
|
end
|
14
16
|
|
15
|
-
it '
|
17
|
+
it 'supports pagination' do
|
16
18
|
translations = VCR.use_cassette('all_translations_pagination') do
|
17
19
|
test_client.translations project_id, limit: 4, page: 2, disable_references: 0,
|
18
20
|
filter_is_reviewed: 0
|
@@ -32,7 +34,7 @@ RSpec.describe Lokalise::Client do
|
|
32
34
|
end
|
33
35
|
|
34
36
|
expect(next_page_trans).to be_an_instance_of(Lokalise::Collections::Translation)
|
35
|
-
expect(next_page_trans.client).to be_an_instance_of(
|
37
|
+
expect(next_page_trans.client).to be_an_instance_of(described_class)
|
36
38
|
expect(next_page_trans.request_params[:page]).to eq(3)
|
37
39
|
expect(next_page_trans.request_params[:disable_references]).to eq(0)
|
38
40
|
expect(next_page_trans.total_results).to eq(187)
|
@@ -45,7 +47,7 @@ RSpec.describe Lokalise::Client do
|
|
45
47
|
end
|
46
48
|
|
47
49
|
expect(prev_page_trans).to be_an_instance_of(Lokalise::Collections::Translation)
|
48
|
-
expect(prev_page_trans.client).to be_an_instance_of(
|
50
|
+
expect(prev_page_trans.client).to be_an_instance_of(described_class)
|
49
51
|
expect(prev_page_trans.request_params[:page]).to eq(1)
|
50
52
|
expect(next_page_trans.request_params[:disable_references]).to eq(0)
|
51
53
|
expect(prev_page_trans.total_results).to eq(187)
|
@@ -85,8 +87,8 @@ RSpec.describe Lokalise::Client do
|
|
85
87
|
expect(translation.is_reviewed).to eq(true)
|
86
88
|
end
|
87
89
|
|
88
|
-
context 'translation chained methods' do
|
89
|
-
it '
|
90
|
+
context 'when translation chained methods are used' do
|
91
|
+
it 'supports update' do
|
90
92
|
translation = VCR.use_cassette('another_translation') do
|
91
93
|
test_client.translation project_id, another_translation_id
|
92
94
|
end
|