smspromote 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/smspromote/gateway.rb +9 -5
- data/lib/smspromote.rb +1 -5
- metadata +10 -26
data/lib/smspromote/gateway.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
+
require "net/http"
|
2
|
+
require "uri"
|
3
|
+
|
1
4
|
module SmsPromote
|
2
5
|
class Gateway
|
3
|
-
SECURE = "https://gateway.smspromote.de
|
4
|
-
INSECURE = "http://gateway.smspromote.de
|
6
|
+
SECURE = "https://gateway.smspromote.de"
|
7
|
+
INSECURE = "http://gateway.smspromote.de"
|
5
8
|
|
6
9
|
# returns the api key as string. The api key will be read
|
7
10
|
# from the ".smspromote.key" file from the home directroy of
|
@@ -42,15 +45,16 @@ module SmsPromote
|
|
42
45
|
options[:from] = @options[:originator]
|
43
46
|
end
|
44
47
|
|
45
|
-
|
48
|
+
response = Net::HTTP.post_form(URI.parse(service_url + "/"), options)
|
49
|
+
data = parse_response(response.body)
|
46
50
|
message.after_send(data[:code], data[:message_id], data[:cost], data[:count])
|
47
51
|
message
|
48
52
|
end
|
49
53
|
|
50
54
|
# returns the credits left for the gateway
|
51
55
|
def credits
|
52
|
-
url =
|
53
|
-
|
56
|
+
url = URI.parse(service_url + "/credits/?key=#{@api_key}")
|
57
|
+
Net::HTTP.get(url).to_f
|
54
58
|
end
|
55
59
|
|
56
60
|
# returns the response message hash based on the body data
|
data/lib/smspromote.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smspromote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Vincent Landgraf
|
@@ -15,29 +15,13 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-27 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
name: rest-client
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 15
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 6
|
33
|
-
- 0
|
34
|
-
version: 1.6.0
|
35
|
-
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
21
|
- !ruby/object:Gem::Dependency
|
38
22
|
name: rake
|
39
23
|
prerelease: false
|
40
|
-
requirement: &
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
41
25
|
none: false
|
42
26
|
requirements:
|
43
27
|
- - ">="
|
@@ -47,11 +31,11 @@ dependencies:
|
|
47
31
|
- 0
|
48
32
|
version: "0"
|
49
33
|
type: :development
|
50
|
-
version_requirements: *
|
34
|
+
version_requirements: *id001
|
51
35
|
- !ruby/object:Gem::Dependency
|
52
36
|
name: rspec
|
53
37
|
prerelease: false
|
54
|
-
requirement: &
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
55
39
|
none: false
|
56
40
|
requirements:
|
57
41
|
- - ">="
|
@@ -61,7 +45,7 @@ dependencies:
|
|
61
45
|
- 0
|
62
46
|
version: "0"
|
63
47
|
type: :development
|
64
|
-
version_requirements: *
|
48
|
+
version_requirements: *id002
|
65
49
|
description: ""
|
66
50
|
email:
|
67
51
|
- vilandgr@googlemail.com
|
@@ -110,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
94
|
requirements: []
|
111
95
|
|
112
96
|
rubyforge_project:
|
113
|
-
rubygems_version: 1.
|
97
|
+
rubygems_version: 1.4.1
|
114
98
|
signing_key:
|
115
99
|
specification_version: 3
|
116
100
|
summary: this gem helps sending sms using the smspromote.de sms gateway
|