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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d5e95e80efd49044368c14b8a2031c63aec7842
4
- data.tar.gz: a8b96f2f97b22d8a08fd5addb0501e1ae8cf666e
3
+ metadata.gz: e001fb39dec2e643ef3dab5732206ff1f1658923
4
+ data.tar.gz: 7c413836b0bee1276b7f2f59f4e7bb96ae5af25b
5
5
  SHA512:
6
- metadata.gz: 4e28b3b343f4e0cb7f09f674537df1056edb2bfc6eb7487c7d4f5b526f248f78b9daddf14b6b878ac33e239b9d7197683b6124624f138fb9f15c0ea7de432f17
7
- data.tar.gz: 4f120d02269a0b37245d895986d3bd5158fb47a734a3806d21d9a5ff017e20636157d1141077a1067128093b4e00a8cf9fe4157c7a2955c65db0ef3831b5d2b7
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
- beepsend.send_sms(to: '000xxx555', from: 'Mailman', message: 'Hello world!')
40
- # => ["201", "[{"id": ["TX ID number"], "from": "Mailman", "to": "000xxx555"}]"]
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
@@ -1,8 +1,7 @@
1
1
  module Beepsend
2
2
  class Client
3
3
  def send_sms(to:, from: configuration.from, message:)
4
- response = http.request request(to, from, message)
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
@@ -1,3 +1,3 @@
1
1
  module Beepsend
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
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.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: 2015-12-29 00:00:00.000000000 Z
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: