easy_translate 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/easy_translate/translator.rb +4 -2
- data/lib/easy_translate/version.rb +1 -1
- metadata +13 -4
@@ -1,6 +1,8 @@
|
|
1
1
|
module EasyTranslate
|
2
2
|
|
3
|
-
|
3
|
+
class <<self
|
4
|
+
attr_accessor :api_key
|
5
|
+
end
|
4
6
|
|
5
7
|
# Detect the language of a given string of text.
|
6
8
|
# Optional parameters:
|
@@ -103,7 +105,7 @@ module EasyTranslate
|
|
103
105
|
def self.base_params(text, options)
|
104
106
|
raise ArgumentError.new('multiple :from not allowed') if options[:from] && options[:from].class == Array
|
105
107
|
raise ArgumentError.new('no string given') if text.empty?
|
106
|
-
key = options[:key] ||
|
108
|
+
key = options[:key] || EasyTranslate.api_key || nil
|
107
109
|
params = ParamBuilder.new
|
108
110
|
params.add :v, API_VERSION
|
109
111
|
params.add :user_ip, URI.escape(options[:user_ip]) if options.has_key?(:user_ip)
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_translate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- John Crepezzi
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-12-29 00:00:00 -05:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rspec
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -33,9 +36,11 @@ dependencies:
|
|
33
36
|
name: json
|
34
37
|
prerelease: false
|
35
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
36
40
|
requirements:
|
37
41
|
- - ">="
|
38
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
39
44
|
segments:
|
40
45
|
- 0
|
41
46
|
version: "0"
|
@@ -64,23 +69,27 @@ rdoc_options: []
|
|
64
69
|
require_paths:
|
65
70
|
- lib
|
66
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
67
73
|
requirements:
|
68
74
|
- - ">="
|
69
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
70
77
|
segments:
|
71
78
|
- 0
|
72
79
|
version: "0"
|
73
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
74
82
|
requirements:
|
75
83
|
- - ">="
|
76
84
|
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
77
86
|
segments:
|
78
87
|
- 0
|
79
88
|
version: "0"
|
80
89
|
requirements: []
|
81
90
|
|
82
91
|
rubyforge_project: easy-translate
|
83
|
-
rubygems_version: 1.3.
|
92
|
+
rubygems_version: 1.3.7
|
84
93
|
signing_key:
|
85
94
|
specification_version: 3
|
86
95
|
summary: Google Translate API Wrapper for Ruby
|