send_sonar 1.0.9 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RELEASE.md +4 -0
- data/lib/send_sonar/exceptions.rb +3 -1
- data/lib/send_sonar/version.rb +1 -1
- data/spec/integrations/simple_desk_spec.rb +22 -0
- data/spec/vcr_cassettes/add_customer_bad_token.yml +2 -2
- data/spec/vcr_cassettes/add_customer_invalid_phone_number.yml +44 -0
- data/spec/vcr_cassettes/message_customer_invalid_phone_number.yml +50 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 476f08ec59419ef64eacb5231bb79ebcb295b75f
|
4
|
+
data.tar.gz: 4b88361e84d2fe3b96779dd831315deb3baa4c58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5d67356fb0e828950c788a4ffdc7665559473caee492b647c60b49650a5bb9b0cb6c3b408b0d8ecf609d98057f204f91bde47a3f601e3559d703c37ed045e93
|
7
|
+
data.tar.gz: ab3a82a0ac0e0eea7ff9d4aeb45ff1b77c844cba244f4641c10eac6f676da405c2b37e5145ba10f5998aae4da6a2612e4655d50a7ff537e35cc9db9367146156
|
data/RELEASE.md
CHANGED
@@ -33,6 +33,7 @@ module SendSonar
|
|
33
33
|
end
|
34
34
|
|
35
35
|
class BadToken < RequestException; end
|
36
|
+
class InvalidPhoneNumber < RequestException; end
|
36
37
|
class NoActiveSubscription < RequestException; end
|
37
38
|
class ApiDisabledForCompany < RequestException; end
|
38
39
|
class UnknownRequestError < RequestException; end
|
@@ -47,7 +48,8 @@ module SendSonar
|
|
47
48
|
"Bad Token" => BadToken,
|
48
49
|
"No Active Subscription" => NoActiveSubscription,
|
49
50
|
"Api Disabled For Company" => ApiDisabledForCompany,
|
50
|
-
"Request Timed Out" => RequestTimeout
|
51
|
+
"Request Timed Out" => RequestTimeout,
|
52
|
+
"Invalid Phone Number" => InvalidPhoneNumber
|
51
53
|
}
|
52
54
|
end
|
53
55
|
end
|
data/lib/send_sonar/version.rb
CHANGED
@@ -98,6 +98,17 @@ describe 'SendSonar' do
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
+
context 'with an invalid phone number' do
|
102
|
+
let(:token) { 'tKux9Vwkt0UuTVJqGUO80MGJHCAeebpe' }
|
103
|
+
|
104
|
+
it 'raises a Invalid Phone Number error' do
|
105
|
+
VCR.use_cassette("#{cassette_group}_invalid_phone_number") do
|
106
|
+
expect { response }.to raise_error(SendSonar::BadRequest,
|
107
|
+
'400 Bad Request: {"error":"Invalid Phone Number"}')
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
101
112
|
context 'with proper params, active subscription' do
|
102
113
|
it 'returns a new customer' do
|
103
114
|
VCR.use_cassette('add_customer') do
|
@@ -148,6 +159,17 @@ describe 'SendSonar' do
|
|
148
159
|
end
|
149
160
|
end
|
150
161
|
|
162
|
+
context 'with an invalid phone number' do
|
163
|
+
let(:token) { 'tKux9Vwkt0UuTVJqGUO80MGJHCAeebpe' }
|
164
|
+
|
165
|
+
it 'raises a Invalid Phone Number error' do
|
166
|
+
VCR.use_cassette("#{cassette_group}_invalid_phone_number") do
|
167
|
+
expect { response }.to raise_error(SendSonar::BadRequest,
|
168
|
+
'400 Bad Request: {"error":"Invalid Phone Number"}')
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
151
173
|
context 'with proper params, active subscription' do
|
152
174
|
it 'returns a new customer' do
|
153
175
|
VCR.use_cassette('message_customer') do
|
@@ -12,7 +12,7 @@ http_interactions:
|
|
12
12
|
Accept-Encoding:
|
13
13
|
- gzip, deflate
|
14
14
|
Token:
|
15
|
-
-
|
15
|
+
- ts9mOO_O5Dc7TOBaEAQym-00RGEl3Uel
|
16
16
|
Client:
|
17
17
|
- rubygem 0.0.1
|
18
18
|
Content-Length:
|
@@ -45,6 +45,6 @@ http_interactions:
|
|
45
45
|
body:
|
46
46
|
encoding: UTF-8
|
47
47
|
string: '{"error":"Bad Token"}'
|
48
|
-
http_version:
|
48
|
+
http_version:
|
49
49
|
recorded_at: Fri, 19 Sep 2014 20:22:08 GMT
|
50
50
|
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:3000/api/v1/customers
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: phone_number=111&email=user%40example.com&first_name=john&last_name=doe&properties[great_customer]=true
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Token:
|
15
|
+
- ts9mOO_O5Dc7TOBaEAQym-00RGEl3Uel
|
16
|
+
Client:
|
17
|
+
- rubygem 1.0.9
|
18
|
+
Content-Length:
|
19
|
+
- '110'
|
20
|
+
Content-Type:
|
21
|
+
- application/x-www-form-urlencoded
|
22
|
+
User-Agent:
|
23
|
+
- Ruby
|
24
|
+
response:
|
25
|
+
status:
|
26
|
+
code: 400
|
27
|
+
message: Unauthorized
|
28
|
+
headers:
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Cache-Control:
|
32
|
+
- no-cache
|
33
|
+
X-Request-Id:
|
34
|
+
- 865a266f-9351-4021-b216-7984090f75e8
|
35
|
+
X-Runtime:
|
36
|
+
- '1.139514'
|
37
|
+
Content-Length:
|
38
|
+
- '21'
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"error":"Invalid Phone Number"}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Tue, 20 Oct 2015 05:46:37 GMT
|
44
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:3000/api/v1/messages
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: to=111&text=this%20is%20the%20message%20text
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Token:
|
15
|
+
- ts9mOO_O5Dc7TOBaEAQym-00RGEl3Uel
|
16
|
+
Client:
|
17
|
+
- rubygem 0.0.1
|
18
|
+
Content-Length:
|
19
|
+
- '51'
|
20
|
+
Content-Type:
|
21
|
+
- application/x-www-form-urlencoded
|
22
|
+
User-Agent:
|
23
|
+
- Ruby
|
24
|
+
response:
|
25
|
+
status:
|
26
|
+
code: 400
|
27
|
+
message: 'Bad Request '
|
28
|
+
headers:
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- '36'
|
33
|
+
Cache-Control:
|
34
|
+
- no-cache
|
35
|
+
X-Request-Id:
|
36
|
+
- 091f4623-a053-46fc-8680-3f2ea4a1ffbb
|
37
|
+
X-Runtime:
|
38
|
+
- '0.028476'
|
39
|
+
Server:
|
40
|
+
- WEBrick/1.3.1 (Ruby/2.1.0/2013-12-25)
|
41
|
+
Date:
|
42
|
+
- Fri, 19 Sep 2014 20:48:59 GMT
|
43
|
+
Connection:
|
44
|
+
- Keep-Alive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"error":"Invalid Phone Number"}'
|
48
|
+
http_version:
|
49
|
+
recorded_at: Fri, 19 Sep 2014 20:48:59 GMT
|
50
|
+
recorded_with: VCR 2.9.2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: send_sonar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Berman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,11 +136,13 @@ files:
|
|
136
136
|
- spec/vcr_cassettes/add_customer_api_disabled.yml
|
137
137
|
- spec/vcr_cassettes/add_customer_bad_params.yml
|
138
138
|
- spec/vcr_cassettes/add_customer_bad_token.yml
|
139
|
+
- spec/vcr_cassettes/add_customer_invalid_phone_number.yml
|
139
140
|
- spec/vcr_cassettes/add_customer_no_subscription.yml
|
140
141
|
- spec/vcr_cassettes/message_customer.yml
|
141
142
|
- spec/vcr_cassettes/message_customer_api_disabled.yml
|
142
143
|
- spec/vcr_cassettes/message_customer_bad_params.yml
|
143
144
|
- spec/vcr_cassettes/message_customer_bad_token.yml
|
145
|
+
- spec/vcr_cassettes/message_customer_invalid_phone_number.yml
|
144
146
|
- spec/vcr_cassettes/message_customer_no_subscription.yml
|
145
147
|
homepage: http://github.com/sendsonar/send_sonar_gem
|
146
148
|
licenses:
|
@@ -173,9 +175,11 @@ test_files:
|
|
173
175
|
- spec/vcr_cassettes/add_customer_api_disabled.yml
|
174
176
|
- spec/vcr_cassettes/add_customer_bad_params.yml
|
175
177
|
- spec/vcr_cassettes/add_customer_bad_token.yml
|
178
|
+
- spec/vcr_cassettes/add_customer_invalid_phone_number.yml
|
176
179
|
- spec/vcr_cassettes/add_customer_no_subscription.yml
|
177
180
|
- spec/vcr_cassettes/message_customer.yml
|
178
181
|
- spec/vcr_cassettes/message_customer_api_disabled.yml
|
179
182
|
- spec/vcr_cassettes/message_customer_bad_params.yml
|
180
183
|
- spec/vcr_cassettes/message_customer_bad_token.yml
|
184
|
+
- spec/vcr_cassettes/message_customer_invalid_phone_number.yml
|
181
185
|
- spec/vcr_cassettes/message_customer_no_subscription.yml
|