jimson-client 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +5 -0
- data/VERSION +1 -1
- data/lib/jimson/client.rb +5 -7
- metadata +3 -3
data/CHANGELOG.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/jimson/client.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'rest-client'
|
2
2
|
require 'jimson/server_error'
|
3
3
|
require 'jimson/client_error'
|
4
4
|
require 'jimson/request'
|
@@ -13,10 +13,8 @@ module Jimson
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def initialize(url)
|
16
|
-
@
|
17
|
-
|
18
|
-
@path = uri.path
|
19
|
-
@http.base_url = "#{uri.scheme}://#{uri.host}:#{uri.port}"
|
16
|
+
@url = url
|
17
|
+
URI.parse(@url) # for the sake of validating the url
|
20
18
|
@batch = []
|
21
19
|
end
|
22
20
|
|
@@ -39,7 +37,7 @@ module Jimson
|
|
39
37
|
'params' => args,
|
40
38
|
'id' => self.class.make_id
|
41
39
|
}.to_json
|
42
|
-
resp =
|
40
|
+
resp = RestClient.post(@url, post_data, :content_type => 'application/json')
|
43
41
|
if resp.nil? || resp.body.nil? || resp.body.empty?
|
44
42
|
raise Jimson::ClientError::InvalidResponse.new
|
45
43
|
end
|
@@ -52,7 +50,7 @@ module Jimson
|
|
52
50
|
|
53
51
|
def send_batch_request(batch)
|
54
52
|
post_data = batch.to_json
|
55
|
-
resp =
|
53
|
+
resp = RestClient.post(@url, post_data, :content_type => 'application/json')
|
56
54
|
if resp.nil? || resp.body.nil? || resp.body.empty?
|
57
55
|
raise Jimson::ClientError::InvalidResponse.new
|
58
56
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: jimson-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Chris Kite
|
@@ -14,14 +14,14 @@ date: 2011-07-20 00:00:00 -05:00
|
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: rest-client
|
18
18
|
prerelease: false
|
19
19
|
requirement: &id001 !ruby/object:Gem::Requirement
|
20
20
|
none: false
|
21
21
|
requirements:
|
22
22
|
- - ">="
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
24
|
+
version: 1.6.3
|
25
25
|
type: :runtime
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|