mote_sms 1.3.5 → 1.3.6
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f10f73a589f4b3c1be67c92e145f4f32f35573e
|
|
4
|
+
data.tar.gz: 73d03f876767262b60d6ebdc13c282ff01c9f249
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 707447bed878a270f152a78f2cf73b67730f3b9454aced32057a01cb0bfc960ed696c7316b77ee381228341e09d5d8d34377ad6e6a2aefeec2d873122c28147d
|
|
7
|
+
data.tar.gz: 31cfe8946eb6e5124ad75b8d0dd5c0e9bed3302fa67a8c503737cc1229d7e25bdef2b361492273e3d781a9f4b66d289d0740803b520b8168a0620c4171b2ef0e
|
|
@@ -23,7 +23,7 @@ module MoteSMS
|
|
|
23
23
|
# Custom exception subclass.
|
|
24
24
|
ServiceError = Class.new(::Exception)
|
|
25
25
|
|
|
26
|
-
attr_reader :from_number, :
|
|
26
|
+
attr_reader :from_number, :account_sid, :auth_token
|
|
27
27
|
|
|
28
28
|
# Public: Create a new instance using specified endpoint, api_key
|
|
29
29
|
# and password.
|
|
@@ -34,9 +34,9 @@ module MoteSMS
|
|
|
34
34
|
#
|
|
35
35
|
# Returns a new instance.
|
|
36
36
|
def initialize(account_sid, auth_token, from_number = nil)
|
|
37
|
+
@account_sid = account_sid
|
|
38
|
+
@auth_token = auth_token
|
|
37
39
|
@from_number = from_number
|
|
38
|
-
|
|
39
|
-
@client = Twilio::REST::Client.new account_sid, auth_token
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
# Public: Delivers message using mobile technics HTTP/S API.
|
|
@@ -52,8 +52,9 @@ module MoteSMS
|
|
|
52
52
|
|
|
53
53
|
raise ArgumentError, 'no from number given on new message or the transport given' if from.empty?
|
|
54
54
|
|
|
55
|
+
client = Twilio::REST::Client.new(account_sid, auth_token)
|
|
55
56
|
messages = prepare_numbers(message.to).map do |n|
|
|
56
|
-
|
|
57
|
+
client.messages.create(
|
|
57
58
|
from: from,
|
|
58
59
|
to: n,
|
|
59
60
|
body: message.body
|
data/lib/mote_sms/version.rb
CHANGED
|
@@ -5,9 +5,6 @@ require 'mote_sms/message'
|
|
|
5
5
|
|
|
6
6
|
describe MoteSMS::TwilioTransport do
|
|
7
7
|
subject do
|
|
8
|
-
client = double(Twilio::REST::Client)
|
|
9
|
-
expect(client).to receive(:messages).at_least(:once) { results }
|
|
10
|
-
expect(Twilio::REST::Client).to receive(:new).with('account', '123456') { client }
|
|
11
8
|
described_class.new('account', '123456', '41791110011')
|
|
12
9
|
end
|
|
13
10
|
|
|
@@ -18,13 +15,6 @@ describe MoteSMS::TwilioTransport do
|
|
|
18
15
|
end
|
|
19
16
|
end
|
|
20
17
|
|
|
21
|
-
let(:result) do
|
|
22
|
-
Twilio::REST::Message.new('/SMS', subject.client, from: '+41791110011', to: '41790001122', body: 'Hello World')
|
|
23
|
-
end
|
|
24
|
-
let(:results) do
|
|
25
|
-
Twilio::REST::Messages.new('/SMS', subject.client)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
18
|
let(:message) do
|
|
29
19
|
MoteSMS::Message.new do
|
|
30
20
|
to '+41790001122'
|
|
@@ -33,23 +23,28 @@ describe MoteSMS::TwilioTransport do
|
|
|
33
23
|
end
|
|
34
24
|
|
|
35
25
|
context '#deliver' do
|
|
26
|
+
before do
|
|
27
|
+
allow_any_instance_of(Twilio::REST::Client).to receive_message_chain(:messages, :create) do |params|
|
|
28
|
+
OpenStruct.new(to: params[:to])
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
36
32
|
it 'send message' do
|
|
37
|
-
|
|
33
|
+
expect_any_instance_of(Twilio::REST::Client).to receive_message_chain(:messages, :create).with(
|
|
38
34
|
from: '41791110011',
|
|
39
35
|
to: '+41790001122',
|
|
40
36
|
body: 'Hello World'
|
|
41
|
-
)
|
|
42
|
-
|
|
37
|
+
)
|
|
43
38
|
expect(subject.deliver(message).normalized_numbers).to eq(['41790001122'])
|
|
44
39
|
end
|
|
45
40
|
|
|
46
41
|
it 'uses the number from the message' do
|
|
47
42
|
message.from = '41791110033'
|
|
48
|
-
|
|
43
|
+
expect_any_instance_of(Twilio::REST::Client).to receive_message_chain(:messages, :create).with(
|
|
49
44
|
from: '41791110033',
|
|
50
45
|
to: '+41790001122',
|
|
51
46
|
body: 'Hello World'
|
|
52
|
-
)
|
|
47
|
+
)
|
|
53
48
|
|
|
54
49
|
expect(subject.deliver(message).normalized_numbers).to eq(['41790001122'])
|
|
55
50
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mote_sms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lukas Westermann
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2017-11-
|
|
12
|
+
date: 2017-11-16 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: phony
|