virtual_sms 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 643672cccb3b99f08f897039c4cbc16549d500aa
4
- data.tar.gz: 897b0bd15f0a933c6f2df730376466497d9e514f
3
+ metadata.gz: e46e3ec85d066b7485df875360bceab5257e4aa8
4
+ data.tar.gz: eee4c1d6c70f39f215716f6f7b0eca73428df9a9
5
5
  SHA512:
6
- metadata.gz: 3dee8e2c654df967e1f0e610874e2a97b9fbb2ee16a6f8323ae3ef43777ab2b4d1138f263b28f4074b3ab3872d89d524aec9170048c4031359f3146a2ad8a255
7
- data.tar.gz: 164897889b2d300554c24a6890d2760eaf307d5ebf1d15645432890b4f1a81e9ca3d383a24359bf8b0c5c1f7a19d3d55151fc39a36a7f9a9baff540ef484410a
6
+ metadata.gz: 6b74cc599752b096b50c643c168007bf541f71ad4073893d2c2e95ce279258a2daafe078bd7e2b789d52b630d7b989aeb53f877da6c222aed7b15f075a363dc6
7
+ data.tar.gz: f062548ed38e1b1760af18e11ca4cbb18a948d54cc84bb2e76a95a4f1126c2a19d1cf1060fd0d539ee9b1fa42466cd0de8fd3747d307c45a436c03cb49184492
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v0.1.1 / 2015-10-28
2
+
3
+ * Prevent delivery_method changed.
4
+ * Add date column.
5
+
1
6
  # v0.1.0 / 2015-10-26
2
7
 
3
8
  Create project
@@ -4,12 +4,13 @@ module VirtualSms
4
4
  class Message
5
5
  include ActionView::Helpers::TagHelper
6
6
 
7
- attr_accessor :sms
7
+ attr_accessor :sms, :date
8
8
  delegate :body, :from, to: :sms
9
9
 
10
10
  def initialize(sms)
11
11
  @sms = sms
12
12
  @sms[:sms_id] = SecureRandom.uuid
13
+ self.date = Time.now
13
14
  end
14
15
 
15
16
  def id
@@ -10,8 +10,9 @@
10
10
  <th>From</th>
11
11
  <th>To</th>
12
12
  <th>Body</th>
13
+ <th>Date</th>
13
14
  </tr>
14
- <% @messages.each do |message| %>
15
+ <% @messages.reverse_each do |message| %>
15
16
  <tr>
16
17
  <td>
17
18
  <%= message.from %>
@@ -22,6 +23,9 @@
22
23
  <td>
23
24
  <%= link_to message.body, message_path(:id => message.id) %>
24
25
  </td>
26
+ <td>
27
+ <%= message.date %>
28
+ </td>
25
29
  </tr>
26
30
  <% end %>
27
31
  </table>
@@ -12,6 +12,12 @@
12
12
  <%= @message.list_to %>
13
13
  </td>
14
14
  </tr>
15
+ <tr>
16
+ <th>Date</th>
17
+ <td>
18
+ <%= @message.date %>
19
+ </td>
20
+ </tr>
15
21
  <tr>
16
22
  <th colspan="2">
17
23
  Body
@@ -0,0 +1,9 @@
1
+ module VirtualSms
2
+ class Interceptor
3
+ def self.delivering_sms(sms)
4
+ if SmsCarrier::Base.delivery_method == :virtual && sms.delivery_method != VirtualSms::Carrier
5
+ sms.delivery_method(VirtualSms::Carrier)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module VirtualSms
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/virtual_sms.rb CHANGED
@@ -1,9 +1,11 @@
1
1
  require "sms_carrier"
2
2
  require "virtual_sms/engine"
3
3
  require "virtual_sms/carrier"
4
+ require "virtual_sms/interceptor"
4
5
 
5
6
  module VirtualSms
6
7
  CacheKey = 'virtual_sms'
7
8
 
8
9
  SmsCarrier::Base.add_delivery_method :virtual, VirtualSms::Carrier
10
+ SmsCarrier::Base.register_interceptor(VirtualSms::Interceptor)
9
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtual_sms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chen Yi-Cyuan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-26 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -175,6 +175,7 @@ files:
175
175
  - lib/virtual_sms.rb
176
176
  - lib/virtual_sms/carrier.rb
177
177
  - lib/virtual_sms/engine.rb
178
+ - lib/virtual_sms/interceptor.rb
178
179
  - lib/virtual_sms/version.rb
179
180
  homepage: https://github.com/emn178/virtual_sms
180
181
  licenses:
@@ -196,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
197
  version: '0'
197
198
  requirements: []
198
199
  rubyforge_project:
199
- rubygems_version: 2.4.8
200
+ rubygems_version: 2.4.5
200
201
  signing_key:
201
202
  specification_version: 4
202
203
  summary: An rails plugin that provides a virtual SMS box and SMS Carrier delivery