beepsend 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -2
- data/lib/beepsend/client.rb +1 -8
- data/lib/beepsend/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e001fb39dec2e643ef3dab5732206ff1f1658923
|
4
|
+
data.tar.gz: 7c413836b0bee1276b7f2f59f4e7bb96ae5af25b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d1251025c7208e9a7cc9f675412760d6aac6d3128bb4ef038fb70f3f1ae88cb2517f5cc1a8c8996c2f6e95eb7699a2d93f0e63df3325f9542c3475a82566940
|
7
|
+
data.tar.gz: 4e76def4d040b708de36471c05108463db8b4946dd0673f187581e28f6f48d3fed53ca4640da67ddd771b77a164938ab593867d57673ab679f60892195b5a635
|
data/README.md
CHANGED
@@ -36,8 +36,26 @@ Here is example usage of this gem:
|
|
36
36
|
|
37
37
|
```ruby
|
38
38
|
beepsend = Beepsend::Client.new
|
39
|
-
|
40
|
-
#
|
39
|
+
|
40
|
+
# Message has been successfully sent
|
41
|
+
beepsend.send_sms(to: '380xxxxxxxx2', from: 'Sender', message: 'hello')
|
42
|
+
=> "[{\"id\":[\"0966xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2\"],\"from\":\"Sender\",\"to\":\"380xxxxxxxx2\"}]"
|
43
|
+
|
44
|
+
# Invalid recipient
|
45
|
+
> beepsend.send_sms(to: 'wrong recipient', from: 'Sender', message: 'hello')
|
46
|
+
=> "{\"errors\":[{\"code\":1031,\"description\":\"\\\"to\\\" is required and needs to be between 3-17 chars and not null\"}]}"
|
47
|
+
|
48
|
+
# Invalid from
|
49
|
+
> beepsend.send_sms(to: '380xxxxxxxx2', from: 'Bad from field', message: 'hello')
|
50
|
+
=> "{\"errors\":[{\"code\":1030,\"description\":\"\\\"from\\\" can not be longer than 11 characters\"}]}"
|
51
|
+
|
52
|
+
# Empty message
|
53
|
+
> beepsend.send_sms(to: '380xxxxxxxx2', from: 'Sender', message: '')
|
54
|
+
=> "{\"errors\":[{\"code\":1036,\"description\":\"body must not be empty\"}]}"
|
55
|
+
|
56
|
+
# Invalid API token
|
57
|
+
> beepsend.send_sms(to: '380xxxxxxxx2', from: 'Sender', message: 'hello')
|
58
|
+
=> "{\"errors\":[\"A valid API-token is required.\"]}"
|
41
59
|
```
|
42
60
|
|
43
61
|
## Development
|
data/lib/beepsend/client.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
module Beepsend
|
2
2
|
class Client
|
3
3
|
def send_sms(to:, from: configuration.from, message:)
|
4
|
-
|
5
|
-
handle_response response
|
4
|
+
http.request(request(to, from, message)).body
|
6
5
|
end
|
7
6
|
|
8
7
|
private
|
@@ -15,12 +14,6 @@ module Beepsend
|
|
15
14
|
request
|
16
15
|
end
|
17
16
|
|
18
|
-
def handle_response(response)
|
19
|
-
unless response.code =~ /\A2\d\d\Z/ # all 2xx codes
|
20
|
-
raise ServerResponseError, "Response code: #{response.code}. Body: #{response.body}"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
17
|
def configuration
|
25
18
|
@configuration ||= Beepsend.configuration
|
26
19
|
end
|
data/lib/beepsend/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beepsend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anatoliy Kukul
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -124,4 +124,3 @@ signing_key:
|
|
124
124
|
specification_version: 4
|
125
125
|
summary: For sending SMS using Beepsend API
|
126
126
|
test_files: []
|
127
|
-
has_rdoc:
|