smspromote 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- data = parse_response(RestClient.post(service_url, options).body)
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 = @options[:secure] ? "https://" : "http://"
53
- RestClient.get("gateway.smspromote.de/credits/?key=#{@api_key}").to_f
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
@@ -1,11 +1,7 @@
1
1
  module SmsPromote
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
4
4
 
5
- gem 'rest-client', '>= 1.6.0'
6
-
7
- require 'rest_client'
8
-
9
5
  require 'smspromote/message'
10
6
  require 'smspromote/gateway'
11
7
  require 'smspromote/encoding'
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: 25
5
- prerelease: false
4
+ hash: 23
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
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: 2010-07-26 00:00:00 +02:00
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: &id002 !ruby/object:Gem::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: *id002
34
+ version_requirements: *id001
51
35
  - !ruby/object:Gem::Dependency
52
36
  name: rspec
53
37
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::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: *id003
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.3.7
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