action_sms_gateways 0.0.1 → 0.0.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{action_sms_gateways}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Wilkie"]
12
- s.date = %q{2010-07-07}
12
+ s.date = %q{2010-09-04}
13
13
  s.email = %q{dwilkie@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "README.markdown"
@@ -23,6 +23,33 @@ module ActionSms
23
23
  @service_url.scheme = config[:use_ssl] ? "https" : "http"
24
24
  end
25
25
 
26
+ def message_id(data)
27
+ sms_global_message_id_prefix = "SMSGlobalMsgID:"
28
+ if data.is_a?(Hash)
29
+ message_id = data["msgid"]
30
+ sms_global_message_id_prefix + message_id if message_id
31
+ elsif data.is_a?(String)
32
+ match = /#{sms_global_message_id_prefix}\d+/.match(data)
33
+ match[0] if match
34
+ end
35
+ end
36
+
37
+ def status(delivery_receipt)
38
+ delivery_receipt["dlrstatus"]
39
+ end
40
+
41
+ def message_text(params)
42
+ params["msg"]
43
+ end
44
+
45
+ def sender(params)
46
+ params["from"]
47
+ end
48
+
49
+ def authenticated?(params, secret_token)
50
+ params["userfield"] == secret_token
51
+ end
52
+
26
53
  def deliver(sms)
27
54
  params = {
28
55
  :action => 'sendsms',
@@ -33,6 +60,9 @@ module ActionSms
33
60
  :to => sms.recipients,
34
61
  :text => sms.body
35
62
  }
63
+ params.merge!(
64
+ :userfield => sms.user_field
65
+ ) if sms.respond_to?(:user_field)
36
66
  send_http_request(@service_url.to_s, params)
37
67
  end
38
68
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - David Wilkie
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-07 00:00:00 +07:00
17
+ date: 2010-09-04 00:00:00 +07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20