sms_aero 0.0.8 → 0.0.9

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: 72e9e51445557fc494d84d9cfce4b5957dfa80fd
4
- data.tar.gz: c1a3b3bf2bc3ff692611c22c0673db2af0c61df1
3
+ metadata.gz: 47495d4e60d1b2a8904d61a84e717e2dd07f45e6
4
+ data.tar.gz: d4f7bf8b15f966f5aa2995484caaa44a81e006f5
5
5
  SHA512:
6
- metadata.gz: a9db2d930914402abcd8c62dc42856d85694ae103def4d274c7e58edca6820775b477b60c8edf0c064b398501d9a371fba044bbe955ab5e99aa958382253e2a7
7
- data.tar.gz: a18d350f2706ef047a93efddb26c8ec37495184e0eb776328b615427ddb50855a925d5104d495e403070832e4935596dea8154f58f66713fcd8ea0ca4aaaa4ba
6
+ metadata.gz: 4072ece391ff1ad9f1ebd508b9a89d39c70e6c95f9aecb4a6d85ddf08de1b10da031f5e94ec3a65601cd906199e00e367587ef6a17a288326e86be35a2324704
7
+ data.tar.gz: 036f412146078b61ec6d1fee915d4a98686de50301938e9c7e7e7b57879e4972365510aff4a805fb7f0fb41e8b672b6c9ebb1a2711075a990de512aa8274f214
data/CHANGELOG.md CHANGED
@@ -4,12 +4,18 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [0.0.9] - [2017-06-23]
8
+
9
+ ### Fixed
10
+ - Always add `#success` to answers to `#send_sms` (@nepalez)
11
+
7
12
  ## [0.0.8] - [2017-06-23]
8
13
 
9
14
  ### Added
10
15
  - Weakened dependency from [dry-types], allowing v0.0.9 (@nepalez)
16
+
11
17
  Between v0.9.0 and v0.9.1 an `optional` property has been broken.
12
- Starting from sms_aero v1.0 [dry-types] will be removed from dependencies.
13
18
 
14
19
  [dry-types]: https://github.com/dry-rb/dry-types
15
- [0.0.8]: https://github.com/tram-rb/tram-policy/compare/v0.0.7...v0.0.8
20
+ [0.0.8]: https://github.com/nepalez/sms_aero/compare/v0.0.7...v0.0.8
21
+ [0.0.9]: https://github.com/nepalez/sms_aero/compare/v0.0.8...v0.0.9
@@ -12,7 +12,11 @@ class SmsAero
12
12
 
13
13
  response :success, 200, format: :json, model: Answer do
14
14
  attribute :id, proc(&:to_s)
15
- attribute :success, default: proc { !id.empty? }
15
+ attribute :success, default: proc { id != "" }
16
+ end
17
+
18
+ response :failure, 200, format: :json, model: Answer do
19
+ attribute :success, default: proc { false }
16
20
  end
17
21
  end
18
22
  end
data/sms_aero.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "sms_aero"
3
- gem.version = "0.0.8"
3
+ gem.version = "0.0.9"
4
4
  gem.author = "Andrew Kozin (nepalez)"
5
5
  gem.email = "andrew.kozin@gmail.com"
6
6
  gem.homepage = "https://github.com/nepalez/sms_aero"
@@ -3,6 +3,7 @@ RSpec.describe SmsAero, "#send_sms" do
3
3
  let(:client) { described_class.new(settings) }
4
4
  let(:params) { { text: "Hi", to: "+7 (909) 382-84-45", from: "Qux" } }
5
5
  let(:answer) { { id: 3898, result: "accepted" } }
6
+ let(:failure) { { reason: nil, result: "no credits" } }
6
7
 
7
8
  before { stub_request(:any, //).to_return(body: answer.to_json) }
8
9
  subject { client.send_sms(params) }
@@ -24,11 +25,21 @@ RSpec.describe SmsAero, "#send_sms" do
24
25
  expect(a_request(:post, url)).to have_been_made
25
26
  end
26
27
 
27
- it "returns success" do
28
+ it "returns successful answer" do
28
29
  expect(subject).to be_kind_of SmsAero::Answer
29
30
  expect(subject.result).to eq "accepted"
31
+ expect(subject.id).to eq "3898"
30
32
  expect(subject.success).to eq true
31
33
  end
34
+
35
+ context "with a failure:" do
36
+ before { stub_request(:any, //).to_return(body: failure.to_json) }
37
+
38
+ it "returns unsuccessful answer" do
39
+ expect(subject).to be_kind_of SmsAero::Answer
40
+ expect(subject.success).to eq false
41
+ end
42
+ end
32
43
  end
33
44
 
34
45
  context "via GET:" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sms_aero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kozin (nepalez)
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  version: '0'
195
195
  requirements: []
196
196
  rubyforge_project:
197
- rubygems_version: 2.5.2
197
+ rubygems_version: 2.6.4
198
198
  signing_key:
199
199
  specification_version: 4
200
200
  summary: HTTP(s) client to SMS Aero API