ruby-lokalise-api 2.1.0 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d80bce654f8a062530bb976701b4325642c2f9226d49b875ed9b611a0e8c7af8
4
- data.tar.gz: 8d1a71d71f64fcd7fc4ea39d3f3501150f6f08ec809685d777343fc826250df1
3
+ metadata.gz: 7df41029b7adabd3bac978798ce048ae42a0c5e5d35c576c601c0b9b6995ce57
4
+ data.tar.gz: faed59d883ee1f446f72ed64ff0b85f85963d16f808bc20f08f18514938bf44e
5
5
  SHA512:
6
- metadata.gz: b3104ba420248487cd1baa2f4f310390b71a1e852002535ad2a2d85fcb61de9197804a05761b03d7a4fc38ddcbe3b12d3d2fce8c460666c02cda63162fb74269
7
- data.tar.gz: c8c6a680b30f268dc0ec7823f6485dbe6211149177587f3e1ea108d81ad3d00a338a67a94e1959907b7ae9ea29526cc1840fd11172ad78fdafb35d28df1262d0
6
+ metadata.gz: 9e5f04d28fefa3d892310c7d596ee2cd66fe7606f7f1eec68f854101ebea00fc69e3e6c1ae5ff6c742294a128ea85cb1eca249d7fdd02f30a6cddb10a1777157
7
+ data.tar.gz: 2e33876bd69588e81ae657454d4d0dc67aa589c1283e2737b40706da7c16896c78934aad94daac5da256ed185b26b887d73e8dc16af19c00160d475faa50b2db
@@ -1,4 +1,9 @@
1
1
  # Changelog
2
+ ## 2.1.1 (17-May-19)
3
+
4
+ * Incorporate API updates (new attributes, mostly creation and update timestamps)
5
+ * Remove trailing slash from request URLs
6
+ * Updated cassettes and target Rubies (for Travis)
2
7
 
3
8
  ## 2.1.0 (19-Mar-19)
4
9
 
data/README.md CHANGED
@@ -1132,7 +1132,7 @@ user.destroy
1132
1132
  @client.translations(project_id, params = {}) # Input:
1133
1133
  ## project_id (string, required)
1134
1134
  ## params (hash)
1135
- ### :disable_references (string) - whether to disable key references. Supported values are 0 and 1
1135
+ ### Find full list in the docs
1136
1136
  ### :page and :limit
1137
1137
  # Output:
1138
1138
  ## Collection of translations for the project
@@ -7,7 +7,7 @@ module Lokalise
7
7
  headers: {
8
8
  accept: 'application/json',
9
9
  user_agent: "ruby-lokalise-api gem/#{Lokalise::VERSION}",
10
- 'X-Api-Token': token
10
+ 'x-api-token': token
11
11
  },
12
12
  url: BASE_URL
13
13
  }
@@ -5,7 +5,8 @@
5
5
  "comment",
6
6
  "added_by",
7
7
  "added_by_email",
8
- "added_at"
8
+ "added_at",
9
+ "added_at_timestamp"
9
10
  ],
10
11
  "contributor": [
11
12
  "user_id",
@@ -15,7 +16,8 @@
15
16
  "is_admin",
16
17
  "is_reviewer",
17
18
  "languages",
18
- "admin_rights"
19
+ "admin_rights",
20
+ "created_at_timestamp"
19
21
  ],
20
22
  "file": [
21
23
  "filename",
@@ -39,7 +41,8 @@
39
41
  "context",
40
42
  "base_words",
41
43
  "char_limit",
42
- "custom_attributes"
44
+ "custom_attributes",
45
+ "created_at_timestamp"
43
46
  ],
44
47
  "language": [
45
48
  "lang_id",
@@ -65,13 +68,15 @@
65
68
  "translation_tier",
66
69
  "translation_tier_name",
67
70
  "briefing",
68
- "total"
71
+ "total",
72
+ "created_at_timestamp"
69
73
  ],
70
74
  "payment_card": [
71
75
  "card_id",
72
76
  "last4",
73
77
  "brand",
74
- "created_at"
78
+ "created_at",
79
+ "created_at_timestamp"
75
80
  ],
76
81
  "project": [
77
82
  "project_id",
@@ -80,7 +85,12 @@
80
85
  "created_at",
81
86
  "created_by",
82
87
  "created_by_email",
83
- "team_id"
88
+ "team_id",
89
+ "created_at_timestamp",
90
+ "base_language_id",
91
+ "base_language_iso",
92
+ "settings",
93
+ "statistics"
84
94
  ],
85
95
  "screenshot": [
86
96
  "screenshot_id",
@@ -90,14 +100,17 @@
90
100
  "description",
91
101
  "screenshot_tags",
92
102
  "width",
93
- "height"
103
+ "height",
104
+ "created_at",
105
+ "created_at_timestamp"
94
106
  ],
95
107
  "snapshot": [
96
108
  "snapshot_id",
97
109
  "title",
98
110
  "created_at",
99
111
  "created_by",
100
- "created_by_email"
112
+ "created_by_email",
113
+ "created_at_timestamp"
101
114
  ],
102
115
  "task": [
103
116
  "task_id",
@@ -106,19 +119,23 @@
106
119
  "status",
107
120
  "progress",
108
121
  "due_date",
122
+ "due_date_timestamp",
109
123
  "keys_count",
110
124
  "words_count",
111
125
  "created_at",
126
+ "created_at_timestamp",
112
127
  "created_by",
113
128
  "created_by_email",
114
129
  "can_be_parent",
115
130
  "task_type",
116
131
  "parent_task_id",
117
132
  "closing_tags",
133
+ "do_lock_translations",
118
134
  "languages",
119
135
  "auto_close_languages",
120
136
  "auto_close_task",
121
137
  "completed_at",
138
+ "completed_at_timestamp",
122
139
  "completed_by",
123
140
  "completed_by_email"
124
141
  ],
@@ -128,20 +145,23 @@
128
145
  "created_at",
129
146
  "plan",
130
147
  "quota_usage",
131
- "quota_allowed"
148
+ "quota_allowed",
149
+ "created_at_timestamp"
132
150
  ],
133
151
  "team_user": [
134
152
  "user_id",
135
153
  "email",
136
154
  "fullname",
137
155
  "created_at",
138
- "role"
156
+ "role",
157
+ "created_at_timestamp"
139
158
  ],
140
159
  "translation": [
141
160
  "translation_id",
142
161
  "key_id",
143
162
  "language_iso",
144
163
  "modified_at",
164
+ "modified_at_timestamp",
145
165
  "modified_by",
146
166
  "modified_by_email",
147
167
  "translation",
@@ -27,7 +27,10 @@ module Lokalise
27
27
 
28
28
  def delete(path, client, params = {})
29
29
  respond_with(
30
+ # Rubocop tries to replace `delete` with `gsub` but that's a different method here!
31
+ # rubocop:disable Style/CollectionMethods
30
32
  connection(client.token).delete(prepare(path)) do |req|
33
+ # rubocop:enable Style/CollectionMethods
31
34
  req.body = MultiJson.dump(params)
32
35
  end,
33
36
  client
@@ -36,9 +39,9 @@ module Lokalise
36
39
 
37
40
  private
38
41
 
39
- # Get rid of double slashes in the `path` and leading slash
42
+ # Get rid of double slashes in the `path`, leading and trailing slash
40
43
  def prepare(path)
41
- path.gsub(%r{\A/}, '').gsub %r{//}, '/'
44
+ path.gsub(%r{\A/}, '').gsub(%r{//}, '/').gsub(%r{/\z}, '')
42
45
  end
43
46
 
44
47
  def respond_with(response, client)
@@ -1,3 +1,3 @@
1
1
  module Lokalise
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.1.1'.freeze
3
3
  end
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency 'rake', '~> 12.1'
29
29
  spec.add_development_dependency 'rspec', '~> 3.6'
30
30
  spec.add_development_dependency 'rubocop', '~> 0.60'
31
+ spec.add_development_dependency 'rubocop-performance', '~> 1.0'
31
32
  spec.add_development_dependency 'simplecov', '~> 0.16'
32
33
  spec.add_development_dependency 'vcr', '~> 4.0'
33
34
  end
@@ -43,7 +43,8 @@ RSpec.describe Lokalise::Client do
43
43
  expect(comment.key_id).to eq(another_key_id)
44
44
  expect(comment.added_by).to eq(20_181)
45
45
  expect(comment.added_by_email).to eq('bodrovis@protonmail.com')
46
- expect(comment.added_at).to eq('2018-12-09 19:41:44 (Etc/UTC)')
46
+ expect(comment.added_at).to eq('2018-12-09 18:41:44 (Etc/UTC)')
47
+ expect(comment.added_at_timestamp).to eq(1_544_380_904)
47
48
  end
48
49
 
49
50
  specify '#create_comments' do
@@ -37,12 +37,13 @@ RSpec.describe Lokalise::Client do
37
37
 
38
38
  expect(contributor.user_id).to eq(20_181)
39
39
  expect(contributor.email).to eq('bodrovis@protonmail.com')
40
- expect(contributor.fullname).to eq('Ilya')
41
- expect(contributor.created_at).to eq('2018-08-21 17:35:25 (Etc/UTC)')
40
+ expect(contributor.fullname).to eq('Ilya B')
41
+ expect(contributor.created_at).to eq('2018-08-21 15:35:25 (Etc/UTC)')
42
42
  expect(contributor.is_admin).to eq(true)
43
43
  expect(contributor.is_reviewer).to eq(true)
44
- expect(contributor.languages.first['lang_id']).to eq(640)
44
+ expect(contributor.languages.first['lang_id']).to eq(803)
45
45
  expect(contributor.admin_rights.first).to eq('upload')
46
+ expect(contributor.created_at_timestamp).to eq(1_534_865_725)
46
47
  end
47
48
 
48
49
  specify '#create_contributors' do
@@ -39,9 +39,14 @@ RSpec.describe Lokalise::Client do
39
39
  expect(project.name).to eq('demo phoenix')
40
40
  expect(project.team_id).to eq(176_692)
41
41
  expect(project.description).to eq('')
42
- expect(project.created_at).to eq('2018-09-24 18:05:22 (Etc/UTC)')
42
+ expect(project.created_at).to eq('2018-09-24 16:05:22 (Etc/UTC)')
43
43
  expect(project.created_by).to eq(20_181)
44
44
  expect(project.created_by_email).to eq('bodrovis@protonmail.com')
45
+ expect(project.created_at_timestamp).to eq(1_537_805_122)
46
+ expect(project.base_language_id).to eq(640)
47
+ expect(project.base_language_iso).to eq('en')
48
+ expect(project.settings['per_platform_key_names']).to eq(false)
49
+ expect(project.statistics['progress_total']).to eq(18)
45
50
  end
46
51
 
47
52
  specify '#create_project' do
@@ -10,12 +10,13 @@ RSpec.describe Lokalise::Client do
10
10
 
11
11
  snapshot = snapshots.first
12
12
 
13
- expect(snapshots.count).to eq(2)
14
- expect(snapshot.title).to eq('test')
15
- expect(snapshot.snapshot_id).to eq(snapshot_id)
16
- expect(snapshot.created_at).to eq('2018-12-10 17:01:48 (Etc/UTC)')
13
+ expect(snapshots.count).to eq(1)
14
+ expect(snapshot.title).to eq('test rspec')
15
+ expect(snapshot.snapshot_id).to eq(27_882)
16
+ expect(snapshot.created_at).to eq('2018-12-10 17:02:04 (Etc/UTC)')
17
17
  expect(snapshot.created_by).to eq(20_181)
18
18
  expect(snapshot.created_by_email).to eq('bodrovis@protonmail.com')
19
+ expect(snapshot.created_at_timestamp).to eq(1_544_461_324)
19
20
  end
20
21
 
21
22
  it 'should support pagination' do
@@ -27,30 +27,34 @@ RSpec.describe Lokalise::Client do
27
27
 
28
28
  specify '#task' do
29
29
  task = VCR.use_cassette('task') do
30
- test_client.task project_id, task_id
30
+ test_client.task project_id, '11925'
31
31
  end
32
32
 
33
- expect(task.task_id).to eq(task_id)
34
- expect(task.title).to eq('another rspec key')
35
- expect(task.description).to eq('desc here')
36
- expect(task.status).to eq('created')
37
- expect(task.progress).to eq(0)
33
+ expect(task.task_id).to eq(11_925)
34
+ expect(task.title).to eq('Demo review')
35
+ expect(task.description).to eq('')
36
+ expect(task.status).to eq('in progress')
37
+ expect(task.progress).to eq(1)
38
38
  expect(task.due_date).to eq(nil)
39
- expect(task.keys_count).to eq(1)
40
- expect(task.words_count).to eq(0)
41
- expect(task.created_at).to eq('2018-12-10 18:37:02 (Etc/UTC)')
39
+ expect(task.due_date_timestamp).to eq(nil)
40
+ expect(task.keys_count).to eq(16)
41
+ expect(task.words_count).to eq(275)
42
+ expect(task.created_at).to eq('2019-05-13 16:15:26 (Etc/UTC)')
43
+ expect(task.created_at_timestamp).to eq(1_557_764_126)
42
44
  expect(task.created_by).to eq(20_181)
43
45
  expect(task.created_by_email).to eq('bodrovis@protonmail.com')
44
46
  expect(task.can_be_parent).to eq(true)
45
- expect(task.task_type).to eq('translation')
47
+ expect(task.task_type).to eq('review')
46
48
  expect(task.parent_task_id).to eq(nil)
47
49
  expect(task.closing_tags).to eq([])
48
- expect(task.languages.first['language_iso']).to eq('ru')
50
+ expect(task.languages.first['language_iso']).to eq('sq')
49
51
  expect(task.auto_close_languages).to eq(true)
50
52
  expect(task.auto_close_task).to eq(true)
51
53
  expect(task.completed_by).to eq(nil)
52
54
  expect(task.completed_by_email).to eq(nil)
53
55
  expect(task.completed_at).to eq(nil)
56
+ expect(task.completed_at_timestamp).to eq(nil)
57
+ expect(task.do_lock_translations).to eq(false)
54
58
  end
55
59
 
56
60
  specify '#create_task' do
@@ -28,14 +28,15 @@ RSpec.describe Lokalise::Client do
28
28
 
29
29
  specify '#team_user' do
30
30
  team_user = VCR.use_cassette('team_user') do
31
- test_client.team_user team_id, team_user_id
31
+ test_client.team_user team_id, '20181'
32
32
  end
33
33
 
34
- expect(team_user.user_id).to eq(team_user_id)
35
- expect(team_user.email).to eq('rspec@test.com')
36
- expect(team_user.fullname).to eq('Rspec test')
37
- expect(team_user.created_at).to eq('2018-12-07 18:21:24 (Etc/UTC)')
38
- expect(team_user.role).to eq('member')
34
+ expect(team_user.user_id).to eq(20_181)
35
+ expect(team_user.email).to eq('bodrovis@protonmail.com')
36
+ expect(team_user.fullname).to eq('Ilya B')
37
+ expect(team_user.created_at).to eq('2018-08-21 15:35:25 (Etc/UTC)')
38
+ expect(team_user.created_at_timestamp).to eq(1_534_865_725)
39
+ expect(team_user.role).to eq('owner')
39
40
  end
40
41
 
41
42
  specify '#update_team_user' do
@@ -1,22 +1,23 @@
1
1
  RSpec.describe Lokalise::Client do
2
2
  specify '#teams' do
3
3
  teams = VCR.use_cassette('teams') do
4
- test_client.teams page: 1, limit: 1
4
+ test_client.teams page: 2, limit: 1
5
5
  end
6
6
 
7
7
  team = teams.collection.first
8
8
 
9
9
  expect(teams.collection.length).to eq(1)
10
- expect(teams.total_results).to eq(1)
11
- expect(teams.total_pages).to eq(1)
10
+ expect(teams.total_results).to eq(2)
11
+ expect(teams.total_pages).to eq(2)
12
12
  expect(teams.results_per_page).to eq(1)
13
- expect(teams.current_page).to eq(1)
13
+ expect(teams.current_page).to eq(2)
14
14
 
15
15
  expect(team.team_id).to eq(176_692)
16
16
  expect(team.name).to eq('Ilya\'s Team')
17
- expect(team.created_at).to eq('2018-08-21 17:35:25 (Etc/UTC)')
17
+ expect(team.created_at).to eq('2018-08-21 15:35:25 (Etc/UTC)')
18
+ expect(team.created_at_timestamp).to eq(1_534_865_725)
18
19
  expect(team.plan).to eq('Trial')
19
- expect(team.quota_usage['users']).to eq(4)
20
+ expect(team.quota_usage['users']).to eq(9)
20
21
  expect(team.quota_allowed['keys']).to eq(999_999_999)
21
22
  end
22
23
  end
@@ -13,14 +13,14 @@ RSpec.describe Lokalise::Client do
13
13
 
14
14
  it 'should support pagination' do
15
15
  providers = VCR.use_cassette('all_translation_providers_pagination') do
16
- test_client.translation_providers team_id, limit: 2, page: 1
16
+ test_client.translation_providers team_id, limit: 1, page: 2
17
17
  end
18
18
 
19
19
  expect(providers.collection.count).to eq(1)
20
- expect(providers.total_results).to eq(3)
20
+ expect(providers.total_results).to eq(2)
21
21
  expect(providers.total_pages).to eq(2)
22
- expect(providers.results_per_page).to eq(2)
23
- expect(providers.current_page).to eq(1)
22
+ expect(providers.results_per_page).to eq(1)
23
+ expect(providers.current_page).to eq(2)
24
24
  end
25
25
  end
26
26
 
@@ -14,16 +14,18 @@ RSpec.describe Lokalise::Client do
14
14
 
15
15
  it 'should support pagination' do
16
16
  translations = VCR.use_cassette('all_translations_pagination') do
17
- test_client.translations project_id, limit: 4, page: 2, disable_references: 0
17
+ test_client.translations project_id, limit: 4, page: 2, disable_references: 0,
18
+ filter_is_reviewed: 0
18
19
  end
19
20
 
20
21
  expect(translations.collection.count).to eq(4)
21
- expect(translations.total_results).to eq(9)
22
- expect(translations.total_pages).to eq(3)
22
+ expect(translations.total_results).to eq(187)
23
+ expect(translations.total_pages).to eq(47)
23
24
  expect(translations.results_per_page).to eq(4)
24
25
  expect(translations.current_page).to eq(2)
25
26
  expect(translations.request_params[:page]).to eq(2)
26
27
  expect(translations.request_params[:disable_references]).to eq(0)
28
+ expect(translations.request_params[:filter_is_reviewed]).to eq(0)
27
29
 
28
30
  next_page_trans = VCR.use_cassette('translations_next_page') do
29
31
  translations.next_page
@@ -33,9 +35,9 @@ RSpec.describe Lokalise::Client do
33
35
  expect(next_page_trans.client).to be_an_instance_of(Lokalise::Client)
34
36
  expect(next_page_trans.request_params[:page]).to eq(3)
35
37
  expect(next_page_trans.request_params[:disable_references]).to eq(0)
36
- expect(next_page_trans.total_results).to eq(9)
38
+ expect(next_page_trans.total_results).to eq(187)
37
39
  expect(next_page_trans.current_page).to eq(3)
38
- expect(next_page_trans.next_page?).to eq(false)
40
+ expect(next_page_trans.next_page?).to eq(true)
39
41
  expect(next_page_trans.prev_page?).to eq(true)
40
42
 
41
43
  prev_page_trans = VCR.use_cassette('translations_prev_page') do
@@ -46,7 +48,7 @@ RSpec.describe Lokalise::Client do
46
48
  expect(prev_page_trans.client).to be_an_instance_of(Lokalise::Client)
47
49
  expect(prev_page_trans.request_params[:page]).to eq(1)
48
50
  expect(next_page_trans.request_params[:disable_references]).to eq(0)
49
- expect(prev_page_trans.total_results).to eq(9)
51
+ expect(prev_page_trans.total_results).to eq(187)
50
52
  expect(prev_page_trans.current_page).to eq(1)
51
53
  expect(prev_page_trans.next_page?).to eq(true)
52
54
  expect(prev_page_trans.prev_page?).to eq(false)
@@ -61,13 +63,14 @@ RSpec.describe Lokalise::Client do
61
63
  expect(translation.translation_id).to eq(translation_id)
62
64
  expect(translation.key_id).to eq(15_571_975)
63
65
  expect(translation.language_iso).to eq('en')
64
- expect(translation.modified_at).to eq('2018-12-10 19:04:08 (Etc/UTC)')
66
+ expect(translation.modified_at).to eq('2019-03-26 16:41:31 (Etc/UTC)')
67
+ expect(translation.modified_at_timestamp).to eq(1_553_618_491)
65
68
  expect(translation.modified_by).to eq(20_181)
66
69
  expect(translation.modified_by_email).to eq('bodrovis@protonmail.com')
67
- expect(translation.translation).to eq('rspec trans')
70
+ expect(translation.translation).to eq('RSpec is a testing suite')
68
71
  expect(translation.is_fuzzy).to eq(false)
69
- expect(translation.is_reviewed).to eq(true)
70
- expect(translation.words).to eq(2)
72
+ expect(translation.is_reviewed).to eq(false)
73
+ expect(translation.words).to eq(5)
71
74
  end
72
75
 
73
76
  specify '#update_translation' do
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.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Bodrov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-19 00:00:00.000000000 Z
11
+ date: 2019-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0.60'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-performance
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: simplecov
113
127
  requirement: !ruby/object:Gem::Requirement