chutki 1.0.0 → 1.1.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.
- data/lib/chutki.rb +7 -1
- data/lib/chutki/version.rb +1 -1
- data/test/test_init.rb +13 -3
- metadata +3 -3
data/lib/chutki.rb
CHANGED
@@ -5,13 +5,19 @@ class Chutki
|
|
5
5
|
include HTTParty
|
6
6
|
base_uri "http://prosms.easy2approach.com"
|
7
7
|
|
8
|
-
|
8
|
+
attr_reader :options
|
9
|
+
|
10
|
+
def initialize(options = {})
|
9
11
|
@options = options
|
10
12
|
@username = options[:user]
|
11
13
|
@password = options[:password]
|
12
14
|
@sender_id = options[:sender]
|
13
15
|
end
|
14
16
|
|
17
|
+
def settings!(options)
|
18
|
+
@options.merge!(options)
|
19
|
+
end
|
20
|
+
|
15
21
|
def send_sms(message,to,opts = {})
|
16
22
|
opts ||= {}
|
17
23
|
opts[:mobiles] = to
|
data/lib/chutki/version.rb
CHANGED
data/test/test_init.rb
CHANGED
@@ -4,12 +4,22 @@ class InitTest < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
context "Initialization" do
|
6
6
|
|
7
|
-
should "
|
8
|
-
lambda { Chutki.new }.should raise_error(ArgumentError)
|
7
|
+
should "can accept username and password and senderid" do
|
9
8
|
Chutki.new({user: "username", password: "password", sender: "senderid"})
|
10
9
|
end
|
11
10
|
end
|
12
11
|
|
12
|
+
context "Settings" do
|
13
|
+
should "allow settings to be updated" do
|
14
|
+
chutki = Chutki.new
|
15
|
+
o = {user: "username", password: "password", sender: "senderid"}
|
16
|
+
chutki.settings!(o)
|
17
|
+
chutki.options[:user].should equal(o[:user])
|
18
|
+
chutki.options[:sender].should equal(o[:sender])
|
19
|
+
chutki.options[:password].should equal(o[:password])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
13
23
|
context "making remote calls" do
|
14
24
|
setup do
|
15
25
|
@response = "ok"
|
@@ -18,7 +28,7 @@ class InitTest < Test::Unit::TestCase
|
|
18
28
|
|
19
29
|
context "Sending SMS" do
|
20
30
|
@chutki = Chutki.new({user: "username", password: "password", sender: "senderid"})
|
21
|
-
|
31
|
+
@chutki.class.expects(:post).with("/sendhttp.php", :query => {:mobiles => "phonenumber", :message => "message", :user => "username", :password => "password", :sender => "senderid"})
|
22
32
|
@chutki.send_sms("message","phonenumber",{})
|
23
33
|
end
|
24
34
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chutki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
131
|
rubyforge_project:
|
132
|
-
rubygems_version: 1.8.
|
132
|
+
rubygems_version: 1.8.24
|
133
133
|
signing_key:
|
134
134
|
specification_version: 3
|
135
135
|
summary: Your SMS provider has given you an endpoint which you must call to Send SMS.
|