shoutbox-client 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/shoutbox_client.rb +2 -1
- data/spec/shoutbox_client_spec.rb +2 -1
- metadata +4 -4
data/lib/shoutbox_client.rb
CHANGED
@@ -26,7 +26,6 @@ class ShoutboxClient
|
|
26
26
|
response = Net::HTTP.start(configuration.host, configuration.port) do |http|
|
27
27
|
req = Net::HTTP::Put.new( request_url(options) )
|
28
28
|
default_headers(req)
|
29
|
-
req['Content-Type'] = 'application/json'
|
30
29
|
req.body = { :statusId => options[:statusId], :group => (options[:group] || 'default'), :status => options[:status].to_s }.to_json
|
31
30
|
http.request(req)
|
32
31
|
end
|
@@ -36,6 +35,7 @@ class ShoutboxClient
|
|
36
35
|
def self.delete_status( options )
|
37
36
|
response = Net::HTTP.start(configuration.host, configuration.port) do |http|
|
38
37
|
req = Net::HTTP::Delete.new( request_url(options) )
|
38
|
+
req.body = { :statusId => options[:statusId], :group => (options[:group] || 'default') }.to_json
|
39
39
|
default_headers(req)
|
40
40
|
http.request(req)
|
41
41
|
end
|
@@ -44,6 +44,7 @@ class ShoutboxClient
|
|
44
44
|
|
45
45
|
def self.default_headers( request )
|
46
46
|
request['User-Agent'] = 'Ruby shoutbox-client'
|
47
|
+
request['Content-Type'] = 'application/json'
|
47
48
|
request['Accept'] = 'application/json'
|
48
49
|
end
|
49
50
|
|
@@ -42,7 +42,8 @@ describe "ShoutboxClient" do
|
|
42
42
|
|
43
43
|
it 'should delete a status' do
|
44
44
|
stub_request(:delete, "http://localhost:3000/status").
|
45
|
-
with(:
|
45
|
+
with(:body => "{\"statusId\":\"test_status\",\"group\":\"default\"}",
|
46
|
+
:headers => {'Accept'=>'application/json', 'User-Agent'=>'Ruby shoutbox-client'}).
|
46
47
|
to_return(:status => 200, :body => "OK", :headers => {})
|
47
48
|
|
48
49
|
ShoutboxClient.shout( :statusId => "test_status", :status => :destroy ).should == true
|
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
|
+
- 5
|
9
|
+
version: 0.0.5
|
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-23 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: -1908286584344260910
|
138
138
|
segments:
|
139
139
|
- 0
|
140
140
|
version: "0"
|