rddd 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,10 +1,10 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in rddd.gemspec
4
- gemspec
3
+ gem 'httpclient'
5
4
 
6
- gem 'rake'
7
- gem 'curb'
5
+ group :development do
6
+ gem 'rake'
7
+ end
8
8
 
9
9
  group :testing do
10
10
  gem 'rspec'
@@ -1,14 +1,8 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rddd (0.2.4)
5
- curb
6
-
7
1
  GEM
8
2
  remote: https://rubygems.org/
9
3
  specs:
10
- curb (0.8.3)
11
4
  diff-lcs (1.1.3)
5
+ httpclient (2.3.2)
12
6
  metaclass (0.0.1)
13
7
  mocha (0.13.1)
14
8
  metaclass (~> 0.0.1)
@@ -26,8 +20,7 @@ PLATFORMS
26
20
  ruby
27
21
 
28
22
  DEPENDENCIES
29
- curb
23
+ httpclient
30
24
  mocha
31
25
  rake
32
- rddd!
33
26
  rspec
@@ -1,3 +1,5 @@
1
+ require 'httpclient'
2
+
1
3
  module Rddd
2
4
  module Services
3
5
  module Transports
@@ -7,9 +9,12 @@ module Rddd
7
9
  end
8
10
 
9
11
  def call(service_name, attributes)
10
- JSON.parse(Curl.post("#{@endpoint}#{service_name}", JSON.unparse(attributes)) do |http|
11
- http.headers['Content-Type'] = 'application/json'
12
- end.body_str)
12
+ JSON.parse(
13
+ HTTPClient.new.post("#{@endpoint}#{service_name}",
14
+ :body => JSON.unparse(attributes),
15
+ :header => {'Content-Type' => 'application/json'}
16
+ ).body
17
+ )
13
18
  end
14
19
  end
15
20
  end
@@ -1,3 +1,3 @@
1
1
  module Rddd
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -20,21 +20,21 @@ module Rddd
20
20
 
21
21
  let(:attributes) { {'foo' => 'bar'} }
22
22
 
23
- let(:result) { {'foo' => 'bar'} }
23
+ let(:body) { {'foo' => 'bar'} }
24
24
 
25
- let(:curl) { stub('curl', :body_str => '{"foo": "bar"}', :headers => [])}
25
+ let(:client) { stub('client') }
26
26
 
27
- before do
28
- Curl.expects(:post) \
29
- .with('http://remote.dev/service_name', JSON.unparse(attributes)) \
30
- .yields(curl) \
31
- .returns(curl)
27
+ let(:result) { stub('result', :body => JSON.unparse(body)) }
32
28
 
33
- curl.headers.expects(:[]=).with('Content-Type', 'application/json')
29
+ before do
30
+ HTTPClient.expects(:new).returns(client)
31
+ client.expects(:post) \
32
+ .with('http://remote.dev/service_name', :body => JSON.unparse(attributes), :header => {'Content-Type' => 'application/json'}) \
33
+ .returns(result)
34
34
  end
35
35
 
36
36
 
37
- it { should == result }
37
+ it { should == body }
38
38
  end
39
39
  end
40
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rddd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: