cellular 2.1.0 → 2.2.0

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -2
  3. data/cellular.gemspec +5 -5
  4. data/lib/cellular.rb +1 -1
  5. data/lib/cellular/backends.rb +5 -3
  6. data/lib/cellular/backends/backend.rb +3 -2
  7. data/lib/cellular/backends/cool_sms.rb +3 -4
  8. data/lib/cellular/backends/link_mobility.rb +72 -0
  9. data/lib/cellular/backends/log.rb +1 -0
  10. data/lib/cellular/backends/sendega.rb +12 -13
  11. data/lib/cellular/backends/test.rb +1 -0
  12. data/lib/cellular/backends/twilio.rb +4 -4
  13. data/lib/cellular/configuration.rb +3 -6
  14. data/lib/cellular/jobs.rb +2 -1
  15. data/lib/cellular/jobs/async_messenger.rb +1 -0
  16. data/lib/cellular/logger.rb +2 -5
  17. data/lib/cellular/models/sms.rb +7 -5
  18. data/lib/cellular/version.rb +1 -1
  19. data/spec/cellular/backends/backend_spec.rb +19 -0
  20. data/spec/cellular/backends/cool_sms_spec.rb +31 -27
  21. data/spec/cellular/backends/link_mobility_spec.rb +118 -0
  22. data/spec/cellular/backends/log_spec.rb +3 -5
  23. data/spec/cellular/backends/log_with_rails_spec.rb +5 -7
  24. data/spec/cellular/backends/sendega_spec.rb +35 -37
  25. data/spec/cellular/backends/test_spec.rb +1 -12
  26. data/spec/cellular/backends/twilio_spec.rb +47 -42
  27. data/spec/cellular/configuration_spec.rb +1 -3
  28. data/spec/cellular/jobs/async_messenger_spec.rb +4 -4
  29. data/spec/cellular/logger_spec.rb +0 -2
  30. data/spec/cellular/models/sms_spec.rb +15 -15
  31. data/spec/cellular_spec.rb +0 -2
  32. data/spec/fixtures/backends/link_mobility/failure.json +1 -0
  33. data/spec/fixtures/backends/link_mobility/success.json +1 -0
  34. data/spec/spec_helper.rb +0 -2
  35. metadata +17 -7
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Cellular::Configuration do
4
-
5
4
  it { should respond_to :username= }
6
5
  it { should respond_to :username }
7
6
  it { should respond_to :password= }
@@ -17,8 +16,7 @@ describe Cellular::Configuration do
17
16
  it { should respond_to :country_code }
18
17
  it { should respond_to :sender= }
19
18
  it { should respond_to :sender }
20
-
19
+
21
20
  it { should respond_to :logger= }
22
21
  it { should respond_to :logger }
23
-
24
22
  end
@@ -1,15 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Cellular::Jobs::AsyncMessenger do
4
- let(:sms_stub) { double "SMS", deliver: true }
5
- let(:sms_options) { { "recipient" => "12345678", "text" => "Foo" } }
4
+ let(:sms_stub) { double 'SMS', deliver: true }
5
+ let(:sms_options) { { 'recipient' => '12345678', 'text' => 'Foo' } }
6
6
 
7
7
  before do
8
8
  allow(Cellular::SMS).to receive(:new).and_return sms_stub
9
9
  end
10
10
 
11
11
  it 'creates a new SMS object' do
12
- symbolized_sms_options = { recipient: "12345678", text: "Foo" }
12
+ symbolized_sms_options = { recipient: '12345678', text: 'Foo' }
13
13
 
14
14
  subject.perform sms_options
15
15
 
@@ -17,7 +17,7 @@ describe Cellular::Jobs::AsyncMessenger do
17
17
  .with(symbolized_sms_options)
18
18
  end
19
19
 
20
- it "delivers the SMS" do
20
+ it 'delivers the SMS' do
21
21
  subject.perform sms_options
22
22
 
23
23
  expect(sms_stub).to have_received :deliver
@@ -1,7 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Cellular::Logger do
4
-
5
4
  it { should respond_to :info }
6
-
7
5
  end
@@ -1,12 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Cellular::SMS do
4
-
5
4
  let(:recipient) { '47xxxxxxxx' }
6
5
  let(:sender) { 'Custom sender' }
7
6
  let(:message) { 'This is an SMS message' }
8
7
  let(:price) { 100 }
9
- let(:country_code) { 'NO'}
8
+ let(:country_code) { 'NO' }
10
9
  let(:recipients) { nil }
11
10
 
12
11
  subject do
@@ -25,11 +24,11 @@ describe Cellular::SMS do
25
24
  end
26
25
 
27
26
  describe '#initialize' do
28
- it{ expect(subject.recipient).to eq recipient }
29
- it{ expect(subject.sender).to eq sender }
30
- it{ expect(subject.message).to eq message }
31
- it{ expect(subject.price).to eq price }
32
- it{ expect(subject.country_code).to eq country_code }
27
+ it { expect(subject.recipient).to eq recipient }
28
+ it { expect(subject.sender).to eq sender }
29
+ it { expect(subject.message).to eq message }
30
+ it { expect(subject.price).to eq price }
31
+ it { expect(subject.country_code).to eq country_code }
33
32
 
34
33
  it { should_not be_delivered }
35
34
 
@@ -39,7 +38,7 @@ describe Cellular::SMS do
39
38
  end
40
39
 
41
40
  subject { described_class.new }
42
- it{ expect(subject.sender).to eq 'Hyper' }
41
+ it { expect(subject.sender).to eq 'Hyper' }
43
42
  end
44
43
 
45
44
  context 'when price omitted' do
@@ -49,7 +48,7 @@ describe Cellular::SMS do
49
48
 
50
49
  subject { described_class.new }
51
50
 
52
- it{ expect(subject.price).to be 5 }
51
+ it { expect(subject.price).to be 5 }
53
52
  end
54
53
 
55
54
  context 'when country omitted' do
@@ -58,7 +57,7 @@ describe Cellular::SMS do
58
57
  end
59
58
 
60
59
  subject { described_class.new }
61
- it{ expect(subject.country_code).to eq 'NL'}
60
+ it { expect(subject.country_code).to eq 'NL' }
62
61
  end
63
62
  end
64
63
 
@@ -80,11 +79,11 @@ describe Cellular::SMS do
80
79
  end
81
80
  end
82
81
 
83
- describe "#deliver_async" do
84
- it "makes ActiveJob schedule an SMS job" do
82
+ describe '#deliver_async' do
83
+ it 'makes ActiveJob schedule an SMS job' do
85
84
  sms_options = {
86
- receiver: "12345678",
87
- message: "Test SMS"
85
+ receiver: '12345678',
86
+ message: 'Test SMS'
88
87
  }
89
88
  wait = 100
90
89
 
@@ -94,7 +93,8 @@ describe Cellular::SMS do
94
93
 
95
94
  sms = Cellular::SMS.new sms_options
96
95
 
97
- allow(ActiveJob::Base).to receive(:queue_adapter).and_return ActiveJob::QueueAdapters::TestAdapter.new
96
+ allow(ActiveJob::Base).to receive(:queue_adapter)
97
+ .and_return ActiveJob::QueueAdapters::TestAdapter.new
98
98
  allow(sms).to receive(:options).and_return sms_options
99
99
 
100
100
  sms.deliver_async(wait: wait)
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Cellular do
4
-
5
4
  describe '::config' do
6
5
  it 'creates a new configuration if none exists' do
7
6
  described_class.config = nil
@@ -24,5 +23,4 @@ describe Cellular do
24
23
  expect(described_class.config.username).to eq 'username'
25
24
  end
26
25
  end
27
-
28
26
  end
@@ -0,0 +1 @@
1
+ {"status":106102,"description":"Unable to access SMSC credentials","translatedDescription":null}
@@ -0,0 +1 @@
1
+ {"messageId":"fPJFgT+ZqikAAAFXlRC29Rfq","resultCode":1005,"description":"Queued"}
@@ -14,12 +14,10 @@ require 'cellular'
14
14
  Dir['./spec/support/**/*.rb'].sort.each { |file| require file }
15
15
 
16
16
  RSpec.configure do |config|
17
-
18
17
  # Allow focussing on individual specs
19
18
  config.filter_run focus: true
20
19
  config.run_all_when_everything_filtered = true
21
20
 
22
21
  # Run specs in random order to surface order dependencies
23
22
  config.order = 'random'
24
-
25
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cellular
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sindre Moen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-25 00:00:00.000000000 Z
12
+ date: 2016-10-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.13.0
20
+ version: '0.13'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.13.0
27
+ version: '0.13'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: savon
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -43,14 +43,14 @@ dependencies:
43
43
  name: rails
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ">="
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '4.2'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">="
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '4.2'
56
56
  - !ruby/object:Gem::Dependency
@@ -156,6 +156,7 @@ files:
156
156
  - lib/cellular/backends.rb
157
157
  - lib/cellular/backends/backend.rb
158
158
  - lib/cellular/backends/cool_sms.rb
159
+ - lib/cellular/backends/link_mobility.rb
159
160
  - lib/cellular/backends/log.rb
160
161
  - lib/cellular/backends/sendega.rb
161
162
  - lib/cellular/backends/test.rb
@@ -166,7 +167,9 @@ files:
166
167
  - lib/cellular/logger.rb
167
168
  - lib/cellular/models/sms.rb
168
169
  - lib/cellular/version.rb
170
+ - spec/cellular/backends/backend_spec.rb
169
171
  - spec/cellular/backends/cool_sms_spec.rb
172
+ - spec/cellular/backends/link_mobility_spec.rb
170
173
  - spec/cellular/backends/log_spec.rb
171
174
  - spec/cellular/backends/log_with_rails_spec.rb
172
175
  - spec/cellular/backends/sendega_spec.rb
@@ -179,6 +182,8 @@ files:
179
182
  - spec/cellular_spec.rb
180
183
  - spec/fixtures/backends/cool_sms/failure.xml
181
184
  - spec/fixtures/backends/cool_sms/success.xml
185
+ - spec/fixtures/backends/link_mobility/failure.json
186
+ - spec/fixtures/backends/link_mobility/success.json
182
187
  - spec/fixtures/backends/sendega/failure.xml
183
188
  - spec/fixtures/backends/sendega/service.wsdl
184
189
  - spec/fixtures/backends/sendega/success.xml
@@ -205,12 +210,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
210
  version: '0'
206
211
  requirements: []
207
212
  rubyforge_project:
208
- rubygems_version: 2.5.1
213
+ rubygems_version: 2.2.2
209
214
  signing_key:
210
215
  specification_version: 4
211
216
  summary: Sending and receiving SMSs through pluggable backends
212
217
  test_files:
218
+ - spec/cellular/backends/backend_spec.rb
213
219
  - spec/cellular/backends/cool_sms_spec.rb
220
+ - spec/cellular/backends/link_mobility_spec.rb
214
221
  - spec/cellular/backends/log_spec.rb
215
222
  - spec/cellular/backends/log_with_rails_spec.rb
216
223
  - spec/cellular/backends/sendega_spec.rb
@@ -223,6 +230,8 @@ test_files:
223
230
  - spec/cellular_spec.rb
224
231
  - spec/fixtures/backends/cool_sms/failure.xml
225
232
  - spec/fixtures/backends/cool_sms/success.xml
233
+ - spec/fixtures/backends/link_mobility/failure.json
234
+ - spec/fixtures/backends/link_mobility/success.json
226
235
  - spec/fixtures/backends/sendega/failure.xml
227
236
  - spec/fixtures/backends/sendega/service.wsdl
228
237
  - spec/fixtures/backends/sendega/success.xml
@@ -230,3 +239,4 @@ test_files:
230
239
  - spec/fixtures/backends/twilio/success.json
231
240
  - spec/spec_helper.rb
232
241
  - spec/support/fixture.rb
242
+ has_rdoc: