mobilove 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mobilove.rb +1 -0
- data/lib/mobilove/text.rb +5 -3
- data/lib/mobilove/version.rb +1 -1
- metadata +4 -4
data/lib/mobilove.rb
CHANGED
data/lib/mobilove/text.rb
CHANGED
@@ -4,11 +4,11 @@ module Mobilove
|
|
4
4
|
|
5
5
|
class Text
|
6
6
|
def initialize(key, route, from)
|
7
|
-
@key, @route, @from = key, route, from
|
7
|
+
@key, @route, @from = key, route, CGI.escape(Iconv.conv('ISO-8859-1', 'utf-8', from))
|
8
8
|
end
|
9
9
|
|
10
10
|
def send(to, message, debug_mode = false)
|
11
|
-
url = send_url(to, message, debug_mode)
|
11
|
+
url = send_url(to, CGI.escape(Iconv.conv('ISO-8859-1', 'utf-8', message)), debug_mode)
|
12
12
|
response = RestClient.get(url)
|
13
13
|
respond(response)
|
14
14
|
end
|
@@ -16,13 +16,15 @@ module Mobilove
|
|
16
16
|
private
|
17
17
|
|
18
18
|
def send_url(to, message, debug_mode)
|
19
|
-
"http://gw.mobilant.net/?key=#{@key}&to=#{to}&message=#{
|
19
|
+
"http://gw.mobilant.net/?key=#{@key}&to=#{to}&message=#{message}&route=#{@route}&from=#{@from}&debug=#{debug_mode ? '1' : '0'}"
|
20
20
|
end
|
21
21
|
|
22
22
|
def respond(response)
|
23
23
|
case response.code.to_i
|
24
24
|
when 100
|
25
25
|
true
|
26
|
+
when 200
|
27
|
+
true
|
26
28
|
when 10
|
27
29
|
raise InvalidNumber.new(response.body)
|
28
30
|
when 20
|
data/lib/mobilove/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobilove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Red Davis
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-04-
|
19
|
+
date: 2011-04-21 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|