action_smser 2.1.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2350764320f6928baacedb55468d17ec9b7a8a4a
4
+ data.tar.gz: 1c8121397346aeacf82842955aa1ae3b53fd460a
5
+ SHA512:
6
+ metadata.gz: 19a8c025c2de53b900bc678236e5a12f16a150e9df4b5e189015094f7176872bfd564b7702e636887ca67aa924b5d6d6c277a960a6d11023149d1f277b840624
7
+ data.tar.gz: d86fdce835d1d978c3642a280653f172faa39c95ef8dd746a608e9a3eed5ccc154918f9c7bf6533867cf369da0b90110617beaae6c6da2b1e38ff89a7530490c
data/README.md CHANGED
@@ -226,23 +226,14 @@ end
226
226
 
227
227
  ```
228
228
 
229
- # Requirements
230
-
231
- Gem has been tested with ruby 1.9.2 and Rails 3.1.
232
-
233
- [<img src="https://secure.travis-ci.org/holli/action_smser.png" />](http://travis-ci.org/holli/action_smser)
234
-
235
- http://travis-ci.org/#!/holli/action_smser
236
-
237
- ### Changes
238
-
239
- Version 2.0 dropped support for ruby 1.8.7. Versions below 2.0 were tested also with ruby 1.8.7
240
-
241
-
242
229
  # Support
243
230
 
244
231
  Submit suggestions or feature requests as a GitHub Issue or Pull Request. Remember to update tests. Tests are quite extensive.
245
232
 
233
+ Check travis for what environments are supported http://travis-ci.org/#!/holli/action_smser
234
+
235
+ [<img src="https://secure.travis-ci.org/holli/action_smser.png" />](http://travis-ci.org/holli/action_smser)
236
+
246
237
 
247
238
  ### Similar gems
248
239
 
@@ -53,7 +53,11 @@ class ActionSmser::Base
53
53
 
54
54
  # Called from class.method_missing with own_sms_message when you call OwnMailer.own_sms_message
55
55
  def initialize(method_name = 'no_name_given', *args)
56
- @delivery_options = ActionSmser.delivery_options.deep_dup
56
+ @delivery_options = {}
57
+ ActionSmser.delivery_options.each do |key,value|
58
+ value = value.dup if value.is_a?(Hash) || value.is_a?(Array)
59
+ @delivery_options[key] = value
60
+ end
57
61
  @valid = true
58
62
  @sms_action = method_name
59
63
  @sms_type = "#{self.class}.#{@sms_action}"
@@ -86,7 +90,7 @@ class ActionSmser::Base
86
90
 
87
91
  return false unless valid?
88
92
 
89
- logger.info "Sending sms - Delivery_method: #{delivery_options[:delivery_method]} - Sms: (#{self.to_s})"
93
+ ActionSmser::Logger.info "Sending sms - Delivery_method: #{delivery_options[:delivery_method]} - Sms: (#{self.to_s})"
90
94
 
91
95
  response = delivery_method.deliver(self)
92
96
 
@@ -139,10 +143,5 @@ class ActionSmser::Base
139
143
  ttl.blank? ? ActionSmser.delivery_options[:default_ttl] : ttl.to_i
140
144
  end
141
145
 
142
- def logger
143
- ActionSmser::Logger
144
- end
145
-
146
-
147
146
  end
148
147
 
@@ -8,7 +8,7 @@ module ActionSmser::DeliveryMethods
8
8
  # Also optional code (=unicode) is possible. See https://docs.nexmo.com/index.php/messaging-sms-api/send-message
9
9
  # overwrite deliver_path(sms, options) with your own if you have different type of path
10
10
  class Nexmo < SimpleHttp
11
-
11
+
12
12
  def self.deliver(sms)
13
13
  options = sms.delivery_options[:nexmo] || {}
14
14
  options = options.dup
@@ -23,8 +23,8 @@ module ActionSmser::DeliveryMethods
23
23
  deliver_path = self.deliver_path(sms, to, options)
24
24
  response = self.deliver_http_request(sms, options, deliver_path)
25
25
 
26
- logger.info "Nexmo delivery http ||| #{deliver_path} ||| #{response.inspect}"
27
- logger.info response.body if !response.blank?
26
+ ActionSmser::Logger.info "Nexmo delivery http ||| #{deliver_path} ||| #{response.inspect}"
27
+ ActionSmser::Logger.info response.body if !response.blank?
28
28
 
29
29
  sms.delivery_info.push(response)
30
30
 
@@ -8,14 +8,14 @@ module ActionSmser::DeliveryMethods
8
8
  # overwrite deliver_path(sms, options) with your own if you have different type of path
9
9
  # When save_delivery_reports=true it expects collection msg_ids in each line in http response
10
10
  class SimpleHttp
11
-
11
+
12
12
  def self.deliver(sms, options = nil)
13
13
  options = options ? options : sms.delivery_options[:simple_http]
14
14
  deliver_path = self.deliver_path(sms, options)
15
15
  response = self.deliver_http_request(sms, options, deliver_path)
16
16
 
17
- logger.info "SimpleHttp delivery ||| #{deliver_path} ||| #{response.inspect}"
18
- logger.info response.body if !response.blank?
17
+ ActionSmser::Logger.info "SimpleHttp delivery ||| #{deliver_path} ||| #{response.inspect}"
18
+ ActionSmser::Logger.info response.body if !response.blank?
19
19
  sms.delivery_info = response
20
20
 
21
21
  # Results include sms_id or error code in each line
@@ -38,7 +38,7 @@ module ActionSmser::DeliveryMethods
38
38
  # http://notetoself.vrensk.com/2008/09/verified-https-in-ruby/
39
39
 
40
40
  response = nil
41
-
41
+
42
42
  server_port = options[:use_ssl] ? 443 : 80
43
43
  http = Net::HTTP.new(options[:server], server_port)
44
44
  if options[:use_ssl]
@@ -50,7 +50,7 @@ module ActionSmser::DeliveryMethods
50
50
  response = http.request(Net::HTTP::Get.new(path)) unless Rails.env.test? #Never request by accident in test environment.
51
51
  end
52
52
  else
53
- logger.warn "DeliveryMethods does never make real http requests in test environment!"
53
+ ActionSmser::Logger.warn "DeliveryMethods does never make real http requests in test environment!"
54
54
  end
55
55
 
56
56
  response
@@ -60,9 +60,5 @@ module ActionSmser::DeliveryMethods
60
60
  "/api/sendsms/plain?user=#{options[:username]}&password=#{options[:password]}&sender=#{sms.from_encoded}&SMSText=#{sms.body_encoded_escaped}&GSM=#{sms.to_encoded}"
61
61
  end
62
62
 
63
- def self.logger
64
- ActionSmser::Logger
65
- end
66
-
67
63
  end
68
64
  end
@@ -33,8 +33,8 @@ module ActionSmser::DeliveryMethods
33
33
  deliver_path = self.deliver_path(sms, to, options)
34
34
  response = self.deliver_http_request(sms, options, deliver_path)
35
35
 
36
- logger.info "Smstrade delivery http ||| #{deliver_path} ||| #{response.inspect}"
37
- logger.info response.body if !response.blank?
36
+ ActionSmser::Logger.info "Smstrade delivery http ||| #{deliver_path} ||| #{response.inspect}"
37
+ ActionSmser::Logger.info response.body if !response.blank?
38
38
 
39
39
  sms.delivery_info.push(response)
40
40
 
@@ -1,3 +1,3 @@
1
1
  module ActionSmser
2
- VERSION = "2.1.2"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  # This file is auto-generated from the current state of the database. Instead
2
3
  # of editing this file, please use the migrations feature of Active Record to
3
4
  # incrementally modify your database, and then regenerate this schema definition.
@@ -8,8 +9,24 @@
8
9
  # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
10
  # you'll amass, the slower it'll run and the greater likelihood for issues).
10
11
  #
11
- # It's strongly recommended to check this file into your version control system.
12
+ # It's strongly recommended that you check this file into your version control system.
12
13
 
13
- ActiveRecord::Schema.define(:version => 0) do
14
+ ActiveRecord::Schema.define(version: 20120102215215) do
15
+
16
+ create_table "action_smser_delivery_reports", force: true do |t|
17
+ t.string "msg_id"
18
+ t.string "status"
19
+ t.datetime "status_updated_at"
20
+ t.string "sms_type"
21
+ t.text "log"
22
+ t.string "to"
23
+ t.string "from"
24
+ t.string "body"
25
+ t.string "gateway"
26
+ t.datetime "created_at"
27
+ t.datetime "updated_at"
28
+ end
29
+
30
+ add_index "action_smser_delivery_reports", ["msg_id"], name: "index_action_smser_delivery_reports_on_msg_id"
14
31
 
15
32
  end