mote_sms 1.3.12 → 1.3.13
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecdd23a035693d0d544c51b1f59dfecf019cf470
|
4
|
+
data.tar.gz: 2580638cc0196e48016ec6d7d385ddd8b0b35f12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afd6b7c77ddc0c3027f76db47681b186a20b08fd36f48a0142c0c0b4b9540eab7bbf70f22b57732395388ec28a39e0a770a915978b6a4e5cb581515959aad751
|
7
|
+
data.tar.gz: 62196ef5cf72e3eaaf57ec9c16024a598b74cab3f07b742827c54861607d73bbfb5dae20247ac991737ef24f2cba20a8a31d27082c2b2a14fd24e211ebe4b5bb
|
@@ -75,11 +75,12 @@ module MoteSMS
|
|
75
75
|
raise ServiceError, "too many recipients, max. is #{MAX_RECIPIENT} (current: #{message.to.length})" if message.to.length > MAX_RECIPIENT
|
76
76
|
|
77
77
|
# Prepare request
|
78
|
-
request = Net::HTTP::Post.new('/messaging/
|
78
|
+
request = Net::HTTP::Post.new('/messaging/sms').tap do |request|
|
79
79
|
request.body = post_params(message)
|
80
|
-
request.content_type = 'application/json
|
81
|
-
request['Accept'] = 'application/json
|
80
|
+
request.content_type = 'application/json'
|
81
|
+
request['Accept'] = 'application/json'
|
82
82
|
request['client_id'] = api_key
|
83
|
+
request['SCS-Version'] = 2
|
83
84
|
end
|
84
85
|
|
85
86
|
# Log as `curl` request
|
data/lib/mote_sms/version.rb
CHANGED
@@ -11,9 +11,9 @@ describe Transports::HttpClient do
|
|
11
11
|
subject { described_class.new('https://api.swisscom.com/') }
|
12
12
|
|
13
13
|
it 'makes a "successful" request, i.e. no HTTPS issues' do
|
14
|
-
request = Net::HTTP::Get.new('/')
|
14
|
+
request = Net::HTTP::Get.new('/messaging/sms')
|
15
15
|
response = subject.request(request)
|
16
|
-
expect(response).to be_a Net::
|
16
|
+
expect(response).to be_a Net::HTTPUnauthorized
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -22,7 +22,7 @@ describe Transports::HttpClient do
|
|
22
22
|
|
23
23
|
it 'makes a "successful" request, i.e. no HTTPS issues' do
|
24
24
|
stub_request(:get, "https://bulk.mobile-gw.com:9012/").
|
25
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>
|
25
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=> "Ruby/mote_sms #{MoteSMS::VERSION}"}).
|
26
26
|
to_return(:status => 200, :body => '', :headers => {})
|
27
27
|
request = Net::HTTP::Get.new('/')
|
28
28
|
response = subject.request(request)
|
@@ -31,7 +31,7 @@ describe MoteSMS::SwisscomTransport do
|
|
31
31
|
|
32
32
|
context '#deliver' do
|
33
33
|
it 'sends POST to endpoint with JSON body and Client ID' do
|
34
|
-
stub_request(:post, "#{endpoint}/messaging/
|
34
|
+
stub_request(:post, "#{endpoint}/messaging/sms").with do |req|
|
35
35
|
params = JSON.load(req.body)
|
36
36
|
expect(params['text']).to eq 'Hello World, with äöü.'
|
37
37
|
expect(params['to']).to eq '+41791231212'
|
@@ -47,19 +47,19 @@ describe MoteSMS::SwisscomTransport do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'raises exception if status code is not 201' do
|
50
|
-
stub_request(:post, "#{endpoint}/messaging/
|
50
|
+
stub_request(:post, "#{endpoint}/messaging/sms").to_return(status: 500)
|
51
51
|
expect { subject.deliver message }.to raise_error(described_class::ServiceError)
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'returns truthy on success' do
|
55
|
-
stub_request(:post, "#{endpoint}/messaging/
|
55
|
+
stub_request(:post, "#{endpoint}/messaging/sms").to_return(success)
|
56
56
|
expect(subject.deliver(message)).to be_truthy
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'logs curl compatible output' do
|
60
60
|
io = StringIO.new
|
61
61
|
described_class.logger = Logger.new(io)
|
62
|
-
stub_request(:post, "#{endpoint}/messaging/
|
62
|
+
stub_request(:post, "#{endpoint}/messaging/sms").to_return(success)
|
63
63
|
subject.deliver message
|
64
64
|
io.rewind
|
65
65
|
expect(io.read).to include('curl -XPOST \'https://api.example.com\' -d \'{')
|
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.13
|
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:
|
12
|
+
date: 2019-01-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: phony
|