web_translate_it 2.0.0.rc3 → 2.0.0.rc4
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.
- data/history.md +4 -0
- data/lib/web_translate_it/string.rb +7 -5
- data/lib/web_translate_it/term.rb +5 -3
- data/lib/web_translate_it/term_translation.rb +3 -2
- data/lib/web_translate_it/translation.rb +3 -2
- data/lib/web_translate_it/util/hash_util.rb +10 -0
- data/spec/web_translate_it/string_spec.rb +11 -0
- data/spec/web_translate_it/term_spec.rb +6 -0
- data/version +1 -1
- metadata +3 -3
data/history.md
CHANGED
@@ -10,17 +10,18 @@ module WebTranslateIt
|
|
10
10
|
#
|
11
11
|
# Implementation Example:
|
12
12
|
#
|
13
|
-
# WebTranslateIt::String.new({
|
13
|
+
# WebTranslateIt::String.new({ :key => "product_name_123" })
|
14
14
|
#
|
15
15
|
# to instantiate a new String without any text.
|
16
16
|
#
|
17
|
-
# translation_en = WebTranslateIt::Translation.new({
|
18
|
-
# translation_fr = WebTranslateIt::Translation.new({
|
19
|
-
# WebTranslateIt::String.new({
|
17
|
+
# translation_en = WebTranslateIt::Translation.new({ :locale => "en", :text => "Hello" })
|
18
|
+
# translation_fr = WebTranslateIt::Translation.new({ :locale => "fr", :text => "Bonjour" })
|
19
|
+
# WebTranslateIt::String.new({ :key => "product_name_123", :translations => [translation_en, translation_fr]})
|
20
20
|
#
|
21
21
|
# to instantiate a new String with a source and target translation.
|
22
22
|
|
23
23
|
def initialize(params = {})
|
24
|
+
params.stringify_keys!
|
24
25
|
self.id = params["id"] || nil
|
25
26
|
self.key = params["key"] || nil
|
26
27
|
self.plural = params["plural"] || nil
|
@@ -42,7 +43,7 @@ module WebTranslateIt
|
|
42
43
|
# Implementation Example:
|
43
44
|
#
|
44
45
|
# WebTranslateIt::Connection.new('secret_api_token') do
|
45
|
-
# strings = WebTranslateIt::String.find_all({
|
46
|
+
# strings = WebTranslateIt::String.find_all({ :key => "product_name_123" })
|
46
47
|
# end
|
47
48
|
#
|
48
49
|
# puts strings.inspect #=> An array of WebTranslateIt::String objects
|
@@ -52,6 +53,7 @@ module WebTranslateIt
|
|
52
53
|
# TODO: Implement pagination
|
53
54
|
|
54
55
|
def self.find_all(params = {})
|
56
|
+
params.stringify_keys!
|
55
57
|
url = "/api/projects/#{Connection.api_key}/strings.yaml"
|
56
58
|
url += '?' + HashUtil.to_params("filters" => params) unless params.empty?
|
57
59
|
|
@@ -10,17 +10,18 @@ module WebTranslateIt
|
|
10
10
|
#
|
11
11
|
# Implementation Example:
|
12
12
|
#
|
13
|
-
# WebTranslateIt::Term.new({
|
13
|
+
# WebTranslateIt::Term.new({ :text => "Term Name" })
|
14
14
|
#
|
15
15
|
# to instantiate a new Term.
|
16
16
|
#
|
17
|
-
# translation_es = WebTranslateIt::TermTranslation.new({
|
18
|
-
# translation_fr = WebTranslateIt::TermTranslation.new({
|
17
|
+
# translation_es = WebTranslateIt::TermTranslation.new({ :locale => "es", :text => "Hola" })
|
18
|
+
# translation_fr = WebTranslateIt::TermTranslation.new({ :locale => "fr", :text => "Bonjour" })
|
19
19
|
# WebTranslateIt::Term.new({ "text" => "Hello", "translations" => [translation_es, translation_fr]})
|
20
20
|
#
|
21
21
|
# to instantiate a new Term with a Term Translations in Spanish and French.
|
22
22
|
|
23
23
|
def initialize(params = {})
|
24
|
+
params.stringify_keys!
|
24
25
|
self.id = params["id"] || nil
|
25
26
|
self.text = params["text"] || nil
|
26
27
|
self.description = params["description"] || nil
|
@@ -43,6 +44,7 @@ module WebTranslateIt
|
|
43
44
|
# TODO: Implement pagination
|
44
45
|
|
45
46
|
def self.find_all(params = {})
|
47
|
+
params.stringify_keys!
|
46
48
|
url = "/api/projects/#{Connection.api_key}/terms.yaml"
|
47
49
|
url += '?' + HashUtil.to_params(params) unless params.empty?
|
48
50
|
|
@@ -10,12 +10,13 @@ module WebTranslateIt
|
|
10
10
|
#
|
11
11
|
# Implementation Example:
|
12
12
|
#
|
13
|
-
# WebTranslateIt::TermTranslation.new({
|
13
|
+
# WebTranslateIt::TermTranslation.new({ :text => "Super!" })
|
14
14
|
#
|
15
15
|
# to instantiate a new TermTranslation.
|
16
16
|
#
|
17
17
|
|
18
18
|
def initialize(params = {})
|
19
|
+
params.stringify_keys!
|
19
20
|
self.id = params["id"] || nil
|
20
21
|
self.locale = params["locale"] || nil
|
21
22
|
self.text = params["text"] || nil
|
@@ -29,7 +30,7 @@ module WebTranslateIt
|
|
29
30
|
#
|
30
31
|
# Implementation Example:
|
31
32
|
#
|
32
|
-
# translation = WebTranslateIt::TermTranslation.new({
|
33
|
+
# translation = WebTranslateIt::TermTranslation.new({ :term_id => "1234", :text => "Super!" })
|
33
34
|
# WebTranslateIt::Connection.new('secret_api_token') do
|
34
35
|
# translation.save
|
35
36
|
# end
|
@@ -10,12 +10,13 @@ module WebTranslateIt
|
|
10
10
|
#
|
11
11
|
# Implementation Example:
|
12
12
|
#
|
13
|
-
# WebTranslateIt::Translation.new({
|
13
|
+
# WebTranslateIt::Translation.new({ :string_id => "1234", :text => "Super!" })
|
14
14
|
#
|
15
15
|
# to instantiate a new Translation without any text.
|
16
16
|
#
|
17
17
|
|
18
18
|
def initialize(params = {})
|
19
|
+
params.stringify_keys!
|
19
20
|
self.id = params["id"] || nil
|
20
21
|
self.locale = params["locale"] || nil
|
21
22
|
self.text = params["text"] || nil
|
@@ -34,7 +35,7 @@ module WebTranslateIt
|
|
34
35
|
#
|
35
36
|
# Implementation Example:
|
36
37
|
#
|
37
|
-
# translation = WebTranslateIt::Translation.new({
|
38
|
+
# translation = WebTranslateIt::Translation.new({ :string_id => "1234", :text => "Super!" })
|
38
39
|
# WebTranslateIt::Connection.new('secret_api_token') do
|
39
40
|
# translation.save
|
40
41
|
# end
|
@@ -10,6 +10,12 @@ describe WebTranslateIt::String do
|
|
10
10
|
string.id.should == 1234
|
11
11
|
string.key.should == "bacon"
|
12
12
|
end
|
13
|
+
|
14
|
+
it "should assign parameters using symbols" do
|
15
|
+
string = WebTranslateIt::String.new({ :id => 1234, :key => "bacon"})
|
16
|
+
string.id.should == 1234
|
17
|
+
string.key.should == "bacon"
|
18
|
+
end
|
13
19
|
end
|
14
20
|
|
15
21
|
describe "#save" do
|
@@ -108,6 +114,11 @@ describe WebTranslateIt::String do
|
|
108
114
|
strings[0].key.should == "bacon"
|
109
115
|
strings[1].key.should == "bacon tart"
|
110
116
|
|
117
|
+
strings = WebTranslateIt::String.find_all({ :key => "bacon" })
|
118
|
+
strings.count.should == 2
|
119
|
+
strings[0].key.should == "bacon"
|
120
|
+
strings[1].key.should == "bacon tart"
|
121
|
+
|
111
122
|
strings = WebTranslateIt::String.find_all({ "key" => "tart" })
|
112
123
|
strings.count.should == 2
|
113
124
|
strings[0].key.should == "tart"
|
@@ -10,6 +10,12 @@ describe WebTranslateIt::Term do
|
|
10
10
|
term.id.should == 1234
|
11
11
|
term.text.should == "bacon"
|
12
12
|
end
|
13
|
+
|
14
|
+
it "should assign parameters using symbols" do
|
15
|
+
term = WebTranslateIt::Term.new({ :id => 1234, :text => "bacon"})
|
16
|
+
term.id.should == 1234
|
17
|
+
term.text.should == "bacon"
|
18
|
+
end
|
13
19
|
end
|
14
20
|
|
15
21
|
describe "#save" do
|
data/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0.
|
1
|
+
2.0.0.rc4
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_translate_it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc4
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multipart-post
|
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
155
|
version: 1.3.1
|
156
156
|
requirements: []
|
157
157
|
rubyforge_project:
|
158
|
-
rubygems_version: 1.8.
|
158
|
+
rubygems_version: 1.8.23
|
159
159
|
signing_key:
|
160
160
|
specification_version: 3
|
161
161
|
summary: A CLI to sync locale files with webtranslateit.com.
|