smart_sms 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 325ca64649f2a85722659b93eae872bb20b1c5b9
4
- data.tar.gz: 5d44ed9d5c466c8884ddc8dbdee257423dcbaa50
3
+ metadata.gz: e6657970a00f52d9f254456d29b60fd0d69e73bf
4
+ data.tar.gz: 8aefe4480f4df68eceb9ce68503badf6ba6e0e7b
5
5
  SHA512:
6
- metadata.gz: 6956d9f1b4b1948f149340a9214095d42b5d1307d6f0a410f0c752e32a3d2077acb81c34b76026f2de3adc25129240f1e8c6a9e28acacb8daacaa6a89daa9d8a
7
- data.tar.gz: a81043483f4b9c4e010a6793672fa17dacd9c841f0e3d3751791e2f060ac82d989f5f3709257f791e7bd9b62a75537cb28ba639ce71ec8c32a4d3a8d8be8dcc7
6
+ metadata.gz: c07ba9e1dbaff74a199f2809844594969775a5feaa2981b33c9603f70c491d5f76c26ad1e24cbea047127e1d6d291034048bfee30f933b26b253fcc9c4fab556
7
+ data.tar.gz: a2d90862fe00c430dc8c4b98650cc5d9bb644c494740ef22b0d4d4b0d57a9d0655a9bb4a2a12344ed01bb0e92bd2a2634f862297277c69bd2435a3a337dbdbe6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_sms (0.0.2)
4
+ smart_sms (0.0.3)
5
5
  activerecord (>= 3.0, < 5.0)
6
6
  activesupport (>= 3.0, < 5.0)
7
7
 
@@ -114,7 +114,6 @@ module SmartSMS
114
114
  sms = SmartSMS.find_by_sid(result['result']['sid'])['sms']
115
115
  if SmartSMS.config.store_sms_in_local
116
116
  message = self.send(self.messages_association_name).build sms
117
- message.send_time = Time.parse sms['send_time']
118
117
  message.code = text
119
118
  message.save
120
119
  else
@@ -126,6 +125,16 @@ module SmartSMS
126
125
  end
127
126
  end
128
127
 
128
+ def deliver_fake_sms text = SmartSMS::VerificationCode.random
129
+ sms = SmartSMS::FakeSMS.build_fake_sms self.send(self.class.sms_mobile_column), text, SmartSMS.config.company
130
+ if SmartSMS.config.store_sms_in_local
131
+ message = self.send(self.messages_association_name).build sms
132
+ message.code = text
133
+ message.save
134
+ else
135
+ sms
136
+ end
137
+ end
129
138
  end
130
139
  end
131
140
  end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ module SmartSMS
4
+ module FakeSMS
5
+ extend self
6
+
7
+ def build_fake_sms mobile, code, company
8
+ {
9
+ "sid" => SecureRandom.uuid,
10
+ "mobile" => mobile,
11
+ "send_time" => Time.zone.now,
12
+ "text" => "您的验证码是#{code}。如非本人操作,请忽略本短信【#{company}】",
13
+ "send_status" => "SUCCESS",
14
+ "report_status" => "UNKNOWN",
15
+ "fee" => 1,
16
+ "user_receive_time" => nil,
17
+ "error_msg" => nil
18
+ }
19
+ end
20
+
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module SmartSMS
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
data/lib/smart_sms.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require 'smart_sms/config'
2
2
  require 'smart_sms/request'
3
3
  require 'smart_sms/template'
4
+ require 'smart_sms/helpers/fake_sms'
5
+ require 'smart_sms/helpers/verification_code'
4
6
  require 'smart_sms/message_service'
5
7
  require 'smart_sms/account'
6
- require 'smart_sms/helper/verification_code'
7
8
 
8
9
  if !defined? ActiveRecord
9
10
  begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_sms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - lyfeyaj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-09 00:00:00.000000000 Z
11
+ date: 2014-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -142,7 +142,8 @@ files:
142
142
  - lib/smart_sms/account.rb
143
143
  - lib/smart_sms/config.rb
144
144
  - lib/smart_sms/has_sms_verification.rb
145
- - lib/smart_sms/helper/verification_code.rb
145
+ - lib/smart_sms/helpers/fake_sms.rb
146
+ - lib/smart_sms/helpers/verification_code.rb
146
147
  - lib/smart_sms/message_service.rb
147
148
  - lib/smart_sms/model/message.rb
148
149
  - lib/smart_sms/request.rb