shoutbox-client 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/shoutbox_client.rb +2 -2
- data/spec/shoutbox_client_spec.rb +5 -5
- metadata +4 -4
data/lib/shoutbox_client.rb
CHANGED
@@ -27,7 +27,7 @@ class ShoutboxClient
|
|
27
27
|
req = Net::HTTP::Put.new( request_url(options) )
|
28
28
|
default_headers(req)
|
29
29
|
req['Content-Type'] = 'application/json'
|
30
|
-
req.body = { :status => options[:status].to_s }.to_json
|
30
|
+
req.body = { :statusId => options[:statusId], :group => (options[:group] || 'default'), :status => options[:status].to_s }.to_json
|
31
31
|
http.request(req)
|
32
32
|
end
|
33
33
|
response.body == "OK"
|
@@ -48,7 +48,7 @@ class ShoutboxClient
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def self.request_url( options )
|
51
|
-
'/status
|
51
|
+
'/status'
|
52
52
|
end
|
53
53
|
|
54
54
|
def self.valid_status?( status )
|
@@ -23,8 +23,8 @@ describe "ShoutboxClient" do
|
|
23
23
|
|
24
24
|
context 'http communication' do
|
25
25
|
it 'should create a valid PUT request to the shoutbox' do
|
26
|
-
stub_request(:put, "http://localhost:3000/status
|
27
|
-
with(:body => "{\"status\":\"green\"}",
|
26
|
+
stub_request(:put, "http://localhost:3000/status").
|
27
|
+
with(:body => "{\"statusId\":\"test_status\",\"group\":\"my_group\",\"status\":\"green\"}",
|
28
28
|
:headers => {'Accept'=>'application/json', 'User-Agent'=>'Ruby shoutbox-client'}).
|
29
29
|
to_return(:status => 200, :body => "OK", :headers => {})
|
30
30
|
|
@@ -32,8 +32,8 @@ describe "ShoutboxClient" do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should create use group default if no group given' do
|
35
|
-
stub_request(:put, "http://localhost:3000/status
|
36
|
-
with(:body => "{\"status\":\"green\"}",
|
35
|
+
stub_request(:put, "http://localhost:3000/status").
|
36
|
+
with(:body => "{\"statusId\":\"test_status\",\"group\":\"default\",\"status\":\"green\"}",
|
37
37
|
:headers => {'Accept'=>'application/json', 'User-Agent'=>'Ruby shoutbox-client'}).
|
38
38
|
to_return(:status => 200, :body => "OK", :headers => {})
|
39
39
|
|
@@ -41,7 +41,7 @@ describe "ShoutboxClient" do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'should delete a status' do
|
44
|
-
stub_request(:delete, "http://localhost:3000/status
|
44
|
+
stub_request(:delete, "http://localhost:3000/status").
|
45
45
|
with(:headers => {'Accept'=>'application/json', 'User-Agent'=>'Ruby shoutbox-client'}).
|
46
46
|
to_return(:status => 200, :body => "OK", :headers => {})
|
47
47
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Benjamin Krause
|
@@ -14,7 +14,7 @@ autorequire: shoutbox_client
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-20 00:00:00 +01:00
|
18
18
|
default_executable: shout
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -134,7 +134,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
134
|
requirements:
|
135
135
|
- - ">="
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
hash:
|
137
|
+
hash: 3703056664628772386
|
138
138
|
segments:
|
139
139
|
- 0
|
140
140
|
version: "0"
|