cellular 1.1.0 → 1.2.0

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: 4d69945358dbd5a90eda81aee664adfffe7a971a
4
- data.tar.gz: d0cccde1eb19cc6d1eb8b54d2414ee21815f02f0
3
+ metadata.gz: b2b557a411a9a042061ab2725cc29921a353cf55
4
+ data.tar.gz: b3c248d7b158b41ce1015f68431b395e1c278db8
5
5
  SHA512:
6
- metadata.gz: 1e752bde39f9752f58f4e5c09aa2eb73a431c19066324aeb69a45930b83393aa59e042e5afe8549c5c23c749bdf5d390880273b977cee25a8f0c959080cb255f
7
- data.tar.gz: 87d001976dbefd1fc8b7bc76f6e01007ebe23e17f28ec74f0a2ac37c6d8b9fdab0de2cd5b7c623935bfb7487c11e928b4b17fe6e4c35a6d506e1f254201821b2
6
+ metadata.gz: d4cf9e5c7b6b22d90ed3cc99d60fbb9d44051d6e789b33463136bfceeaf0202ce012a248a946e07a3ef4892d1fa699dab57b8d557027a3b921cbc252aa360ca7
7
+ data.tar.gz: 0850f3123d23661353059947a672e2a56ba5774d2e90b2e0d856fd5658a3dd55f5be341092bf2bf4259d31230b13b183fcb9eff460aeedc98d4eb6bfd9589680
data/README.md CHANGED
@@ -37,6 +37,7 @@ Cellular.configure do |config|
37
37
  config.username = 'username'
38
38
  config.password = 'password'
39
39
  config.backend = Cellular::Backends::Sendega
40
+ config.sender = 'Default custom sender'
40
41
  end
41
42
  ```
42
43
 
@@ -55,7 +56,6 @@ The options supported may differ between backends.
55
56
  sms = Cellular::SMS.new(
56
57
  recipient: '47xxxxxxxx',
57
58
  sender: 'Custom sender',
58
- country: 'NO',
59
59
  message: 'This is an SMS message'
60
60
  )
61
61
 
@@ -70,3 +70,9 @@ sms.deliver
70
70
  3. Commit your changes (`git commit -am 'Add some feature'`)
71
71
  4. Push to the branch (`git push origin my-new-feature`)
72
72
  5. Create pull request
73
+
74
+
75
+ ## Credits
76
+
77
+ Hyper made this. We're a digital communications agency with a passion for good code,
78
+ and if you're using this library we probably want to hire you.
@@ -3,5 +3,7 @@ module Cellular
3
3
 
4
4
  attr_accessor :username, :password, :delivery_url, :backend
5
5
 
6
+ attr_accessor :country_code, :price, :sender
7
+
6
8
  end
7
9
  end
@@ -7,10 +7,10 @@ module Cellular
7
7
  @backend = Cellular.config.backend
8
8
 
9
9
  @recipient = options[:recipient]
10
- @sender = options[:sender]
10
+ @sender = options[:sender] || Cellular.config.sender
11
11
  @message = options[:message]
12
- @price = options[:price]
13
- @country = options[:country]
12
+ @price = options[:price] || Cellular.config.price
13
+ @country = options[:country] || Cellular.config.country_code
14
14
 
15
15
  @delivered = false
16
16
  end
@@ -1,3 +1,3 @@
1
1
  module Cellular
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -11,4 +11,11 @@ describe Cellular::Configuration do
11
11
  it { should respond_to :backend= }
12
12
  it { should respond_to :backend }
13
13
 
14
+ it { should respond_to :price= }
15
+ it { should respond_to :price }
16
+ it { should respond_to :country_code= }
17
+ it { should respond_to :country_code }
18
+ it { should respond_to :sender= }
19
+ it { should respond_to :sender }
20
+
14
21
  end
@@ -6,7 +6,7 @@ describe Cellular::SMS do
6
6
  let(:sender) { 'Custom sender' }
7
7
  let(:message) { 'This is an SMS message' }
8
8
  let(:price) { 100 }
9
- let(:country) { 'NO '}
9
+ let(:country) { 'NO'}
10
10
 
11
11
  subject do
12
12
  described_class.new(
@@ -30,6 +30,36 @@ describe Cellular::SMS do
30
30
  its(:country) { should eq country }
31
31
 
32
32
  it { should_not be_delivered }
33
+
34
+ context 'when sender omitted' do
35
+ before do
36
+ Cellular.config.sender = 'Hyper'
37
+ end
38
+
39
+ subject { described_class.new }
40
+
41
+ its(:sender) { should eq 'Hyper' }
42
+ end
43
+
44
+ context 'when price omitted' do
45
+ before do
46
+ Cellular.config.price = 5
47
+ end
48
+
49
+ subject { described_class.new }
50
+
51
+ its(:price) { should eq 5 }
52
+ end
53
+
54
+ context 'when country omitted' do
55
+ before do
56
+ Cellular.config.country_code = 'NL'
57
+ end
58
+
59
+ subject { described_class.new }
60
+
61
+ its(:country) { should eq 'NL' }
62
+ end
33
63
  end
34
64
 
35
65
  describe '#deliver' do
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: 1.1.0
4
+ version: 1.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: 2014-02-28 00:00:00.000000000 Z
12
+ date: 2014-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty