web_translate_it 2.5.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f01930a3c46a7521f57e14caa623d495f37d81f1e392ceee1d11716e53366f69
4
- data.tar.gz: 24f554f5a22af0333e19adbcd846e1e100d789d06be261b28a943851307e5c57
3
+ metadata.gz: bb952e216ebe7b504b0c40dfcc1659795e527b0822c4d952cdba9d251b0f32b5
4
+ data.tar.gz: 685717f0eb53fe6e5f42c35896cedcfeeb39555e8e7eaf0a4fad7caa3edf237a
5
5
  SHA512:
6
- metadata.gz: 65aa66ec8c8b70c937c18de52857e8d2a54835847b147ea2b9c8e07e761ea8ef262b1af6db87be42ee6b41c36b94eaee1748f677e36dacb453e27e84e4710f7d
7
- data.tar.gz: 47d4c899f44bb80f04d695a0365fe2acd9948b3cfac8eec936ce9df44c846a4659fcbd34e1023aab686ac2b51ec3ed39f0e68ff84e3852484745ae905b058533
6
+ metadata.gz: 49894fbc42db771158b68e233bbfc1e197d4eb1299f47a25270d4fdd3dbccd846e2018e86b291109bd4195bcdab31188fc518d8bbbf3f65cbd33deb2d0bd6a18
7
+ data.tar.gz: 1f78011a382d2d4e8ffc9e21135c6e2899420d04403fa3481ce1ced2a9194610285abcec8b78ae8214519cde9106048f2fe1c4ea1e6b1a257e7f4739fe3e1886
data/history.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Version 2.5.1 / 2021-11-15
2
+
3
+ * Ruby 3.1.0 compatible.
4
+
1
5
  ## Version 2.5.0 / 2021-11-15
2
6
 
3
7
  * Display files that are being updated on WebTranslateIt but are not ready to be downloaded by a `*`.
@@ -25,7 +25,7 @@ module WebTranslateIt
25
25
  self.after_pull = configuration['after_pull']
26
26
  self.before_push = configuration['before_push']
27
27
  self.after_push = configuration['after_push']
28
- project_info = YAML.load WebTranslateIt::Project.fetch_info(api_key)
28
+ project_info = YAML.safe_load WebTranslateIt::Project.fetch_info(api_key), permitted_classes: [Time]
29
29
  set_locales_to_ignore(configuration)
30
30
  set_locales_needed(configuration)
31
31
  set_files(project_info['project'])
@@ -1,23 +1,23 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe WebTranslateIt::String do
4
-
5
- let(:api_key) { "19875cfdd4f169b33e0ffab32cfb0bbb9e33d653" }
6
-
4
+
5
+ let(:api_key) { "proj_pvt_glzDR250FLXlMgJPZfEyHQ" }
6
+
7
7
  describe "#initialize" do
8
8
  it "should assign api_key and many parameters" do
9
9
  string = WebTranslateIt::String.new({ "id" => 1234, "key" => "bacon"})
10
10
  string.id.should == 1234
11
11
  string.key.should == "bacon"
12
12
  end
13
-
13
+
14
14
  it "should assign parameters using symbols" do
15
15
  string = WebTranslateIt::String.new({ :id => 1234, :key => "bacon"})
16
16
  string.id.should == 1234
17
17
  string.key.should == "bacon"
18
18
  end
19
19
  end
20
-
20
+
21
21
  describe "#save" do
22
22
  it "should create a new String" do
23
23
  WebTranslateIt::Connection.new(api_key) do
@@ -31,7 +31,7 @@ describe WebTranslateIt::String do
31
31
  string.delete
32
32
  end
33
33
  end
34
-
34
+
35
35
  it "should update an existing String" do
36
36
  WebTranslateIt::Connection.new(api_key) do
37
37
  string = WebTranslateIt::String.new({ "key" => "bacony" })
@@ -43,11 +43,11 @@ describe WebTranslateIt::String do
43
43
  string.delete
44
44
  end
45
45
  end
46
-
46
+
47
47
  it "should create a new String with Translation" do
48
48
  translation1 = WebTranslateIt::Translation.new({ "locale" => "en", "text" => "Hello" })
49
49
  translation2 = WebTranslateIt::Translation.new({ "locale" => "fr", "text" => "Bonjour" })
50
-
50
+
51
51
  string = WebTranslateIt::String.new({ "key" => "bacon", "translations" => [translation1, translation2] })
52
52
  WebTranslateIt::Connection.new(api_key) do
53
53
  string.save
@@ -60,20 +60,20 @@ describe WebTranslateIt::String do
60
60
  string.delete
61
61
  end
62
62
  end
63
-
63
+
64
64
  it "should update a String and save its Translation" do
65
65
  translation1 = WebTranslateIt::Translation.new({ "locale" => "en", "text" => "Hello" })
66
66
  translation2 = WebTranslateIt::Translation.new({ "locale" => "fr", "text" => "Bonjour" })
67
-
67
+
68
68
  string = WebTranslateIt::String.new({ "key" => "bacon" })
69
69
  WebTranslateIt::Connection.new(api_key) do
70
70
  string.save
71
71
  string_fetched = WebTranslateIt::String.find(string.id)
72
72
  string_fetched.translation_for("fr").should be_nil
73
-
73
+
74
74
  string_fetched.translations = [translation1, translation2]
75
75
  string_fetched.save
76
-
76
+
77
77
  string_fetched = WebTranslateIt::String.find(string.id)
78
78
  string_fetched.translation_for("en").should_not be_nil
79
79
  string_fetched.translation_for("en").text.should == "Hello"
@@ -83,7 +83,7 @@ describe WebTranslateIt::String do
83
83
  end
84
84
  end
85
85
  end
86
-
86
+
87
87
  describe "#delete" do
88
88
  it "should delete a String" do
89
89
  string = WebTranslateIt::String.new({ "key" => "bacon" })
@@ -91,53 +91,48 @@ describe WebTranslateIt::String do
91
91
  string.save
92
92
  string_fetched = WebTranslateIt::String.find(string.id)
93
93
  string_fetched.should_not be_nil
94
-
94
+
95
95
  string_fetched.delete
96
96
  WebTranslateIt::String.find(string.id).should be_nil
97
97
  end
98
98
  end
99
99
  end
100
-
100
+
101
101
  describe "#find_all" do
102
102
  it "should find many strings" do
103
103
  WebTranslateIt::Connection.new(api_key) do
104
- string1 = WebTranslateIt::String.new({ "key" => "bacon" })
104
+ string1 = WebTranslateIt::String.new({ "key" => "one two three" })
105
105
  string1.save
106
- string2 = WebTranslateIt::String.new({ "key" => "tart" })
106
+ string2 = WebTranslateIt::String.new({ "key" => "four five six" })
107
107
  string2.save
108
- string3 = WebTranslateIt::String.new({ "key" => "bacon tart" })
108
+ string3 = WebTranslateIt::String.new({ "key" => "six seven eight" })
109
109
  string3.save
110
-
111
- strings = WebTranslateIt::String.find_all({ "key" => "bacon" })
112
- strings.count.should == 2
113
- strings[0].key.should == "bacon"
114
- strings[1].key.should == "bacon tart"
115
-
116
- strings = WebTranslateIt::String.find_all({ :key => "bacon" })
110
+
111
+ strings = WebTranslateIt::String.find_all({ "key" => "six" })
117
112
  strings.count.should == 2
118
- strings[0].key.should == "bacon"
119
- strings[1].key.should == "bacon tart"
113
+ strings[0].key.should == "four five six"
114
+ strings[1].key.should == "six seven eight"
120
115
 
121
- strings = WebTranslateIt::String.find_all({ "key" => "tart" })
116
+ strings = WebTranslateIt::String.find_all({ :key => "six" })
122
117
  strings.count.should == 2
123
- strings[0].key.should == "tart"
124
- strings[1].key.should == "bacon tart"
125
-
126
- strings = WebTranslateIt::String.find_all({ "key" => "bacon tart" })
118
+ strings[0].key.should == "four five six"
119
+ strings[1].key.should == "six seven eight"
120
+
121
+ strings = WebTranslateIt::String.find_all({ "key" => "eight" })
122
+ strings.count.should == 1
123
+ strings[0].key.should == "six seven eight"
124
+
125
+ strings = WebTranslateIt::String.find_all({ "key" => "three" })
127
126
  strings.count.should == 1
128
- strings[0].key.should == "bacon tart"
129
-
130
- string1.delete
131
- string2.delete
132
- string3.delete
127
+ strings[0].key.should == "one two three"
133
128
  end
134
129
  end
135
130
  end
136
-
131
+
137
132
  describe "#translation_for" do
138
133
  it "should fetch translations" do
139
134
  translation = WebTranslateIt::Translation.new({ "locale" => "en", "text" => "Hello" })
140
- string = WebTranslateIt::String.new({ "key" => "bacon", "translations" => [translation] })
135
+ string = WebTranslateIt::String.new({ "key" => "greetings", "translations" => [translation] })
141
136
  WebTranslateIt::Connection.new(api_key) do
142
137
  string.save
143
138
  string_fetched = WebTranslateIt::String.find(string.id)
@@ -147,9 +142,9 @@ describe WebTranslateIt::String do
147
142
  string.delete
148
143
  end
149
144
  end
150
-
145
+
151
146
  it "should not return a stale object" do
152
- string = WebTranslateIt::String.new({ :key => "bacon" })
147
+ string = WebTranslateIt::String.new({ :key => "greetings 2" })
153
148
  translation = WebTranslateIt::Translation.new({ :locale => "es", :text => "text", :string_id => string.id })
154
149
  string.translations << translation
155
150
  string.translation_for('fr').should be_nil
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe WebTranslateIt::Term do
4
-
5
- let(:api_key) { "19875cfdd4f169b33e0ffab32cfb0bbb9e33d653" }
6
-
4
+
5
+ let(:api_key) { "proj_pvt_glzDR250FLXlMgJPZfEyHQ" }
6
+
7
7
  describe "#initialize" do
8
8
  it "should assign api_key and many parameters" do
9
9
  term = WebTranslateIt::Term.new({ "id" => 1234, "text" => "bacon"})
@@ -17,7 +17,7 @@ describe WebTranslateIt::Term do
17
17
  term.text.should == "bacon"
18
18
  end
19
19
  end
20
-
20
+
21
21
  describe "#save" do
22
22
  it "should create a new Term" do
23
23
  WebTranslateIt::Connection.new(api_key) do
@@ -31,10 +31,10 @@ describe WebTranslateIt::Term do
31
31
  term.delete
32
32
  end
33
33
  end
34
-
34
+
35
35
  it "should update an existing Term" do
36
36
  WebTranslateIt::Connection.new(api_key) do
37
- term = WebTranslateIt::Term.new({ "text" => "Term", "description" => "A description" })
37
+ term = WebTranslateIt::Term.new({ "text" => "Term 2", "description" => "A description" })
38
38
  term.save
39
39
  term.text = "A Term"
40
40
  term.save
@@ -43,11 +43,11 @@ describe WebTranslateIt::Term do
43
43
  term.delete
44
44
  end
45
45
  end
46
-
46
+
47
47
  it "should create a new Term with a TermTranslation" do
48
48
  translation1 = WebTranslateIt::TermTranslation.new({ "locale" => "fr", "text" => "Bonjour" })
49
49
  translation2 = WebTranslateIt::TermTranslation.new({ "locale" => "fr", "text" => "Salut" })
50
-
50
+
51
51
  term = WebTranslateIt::Term.new({ "text" => "Hello", "translations" => [translation1, translation2] })
52
52
  WebTranslateIt::Connection.new(api_key) do
53
53
  term.save
@@ -59,20 +59,20 @@ describe WebTranslateIt::Term do
59
59
  term.delete
60
60
  end
61
61
  end
62
-
62
+
63
63
  it "should update a Term and save its Translation" do
64
64
  translation1 = WebTranslateIt::TermTranslation.new({ "locale" => "fr", "text" => "Bonjour" })
65
65
  translation2 = WebTranslateIt::TermTranslation.new({ "locale" => "fr", "text" => "Salut" })
66
-
66
+
67
67
  term = WebTranslateIt::Term.new({ "text" => "Hi!" })
68
68
  WebTranslateIt::Connection.new(api_key) do
69
69
  term.save
70
70
  term_fetched = WebTranslateIt::Term.find(term.id)
71
71
  term_fetched.translation_for("fr").should be_nil
72
-
72
+
73
73
  term_fetched.translations = [translation1, translation2]
74
74
  term_fetched.save
75
-
75
+
76
76
  term_fetched = WebTranslateIt::Term.find(term.id)
77
77
  term_fetched.translation_for("fr").should_not be_nil
78
78
  term_fetched.translation_for("fr")[0].text.should == "Bonjour"
@@ -81,7 +81,7 @@ describe WebTranslateIt::Term do
81
81
  end
82
82
  end
83
83
  end
84
-
84
+
85
85
  describe "#delete" do
86
86
  it "should delete a Term" do
87
87
  term = WebTranslateIt::Term.new({ "text" => "bacon" })
@@ -89,27 +89,27 @@ describe WebTranslateIt::Term do
89
89
  term.save
90
90
  term_fetched = WebTranslateIt::Term.find(term.id)
91
91
  term_fetched.should_not be_nil
92
-
92
+
93
93
  term_fetched.delete
94
94
  term_fetched = WebTranslateIt::Term.find(term.id)
95
95
  term_fetched.should be_nil
96
96
  end
97
97
  end
98
98
  end
99
-
99
+
100
100
  describe "#find_all" do
101
101
  it "should fetch many terms" do
102
102
  WebTranslateIt::Connection.new(api_key) do
103
- term1 = WebTranslateIt::Term.new({ "text" => "bacon" })
103
+ term1 = WebTranslateIt::Term.new({ "text" => "greeting 1" })
104
104
  term1.save
105
- term2 = WebTranslateIt::Term.new({ "text" => "tart" })
105
+ term2 = WebTranslateIt::Term.new({ "text" => "greeting 2" })
106
106
  term2.save
107
- term3 = WebTranslateIt::Term.new({ "text" => "bacon tart" })
107
+ term3 = WebTranslateIt::Term.new({ "text" => "greeting 3" })
108
108
  term3.save
109
-
109
+
110
110
  terms = WebTranslateIt::Term.find_all
111
111
  terms.count.should == 3
112
-
112
+
113
113
  term1.delete
114
114
  term2.delete
115
115
  term3.delete
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_translate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edouard Briere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-15 00:00:00.000000000 Z
11
+ date: 2022-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  requirements: []
144
- rubygems_version: 3.0.6
144
+ rubygems_version: 3.0.9
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: A CLI to sync locale files with WebTranslateIt.com.