api_client 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/api_client.gemspec CHANGED
@@ -19,18 +19,18 @@ Gem::Specification.new do |s|
19
19
 
20
20
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
21
21
  if RUBY_PLATFORM == "java"
22
- s.add_runtime_dependency(%q<json_pure>)
23
- else
24
- s.add_runtime_dependency(%q<yajl-ruby>)
22
+ s.add_runtime_dependency(%q<json_pure>)
23
+ else
24
+ s.add_runtime_dependency(%q<yajl-ruby>)
25
25
  end
26
26
  s.add_runtime_dependency(%q<faraday>, [">= 0.8.1"])
27
- s.add_runtime_dependency(%q<hashie>, [">= 1.2.0"])
27
+ s.add_runtime_dependency(%q<hashie>, [">= 2.0.5"])
28
28
  s.add_runtime_dependency(%q<multi_json>, [">= 1.6.1"])
29
29
  else
30
30
  if RUBY_PLATFORM == "java"
31
- s.add_dependency(%q<json_pure>)
32
- else
33
- s.add_dependency(%q<yajl-ruby>)
31
+ s.add_dependency(%q<json_pure>)
32
+ else
33
+ s.add_dependency(%q<yajl-ruby>)
34
34
  end
35
35
  s.add_dependency(%q<faraday>, [">= 0.8.1"])
36
36
  s.add_dependency(%q<hashie>, [">= 1.2.0"])
@@ -38,9 +38,9 @@ Gem::Specification.new do |s|
38
38
  end
39
39
  else
40
40
  if RUBY_PLATFORM == "java"
41
- s.add_dependency(%q<json_pure>)
42
- else
43
- s.add_dependency(%q<yajl-ruby>)
41
+ s.add_dependency(%q<json_pure>)
42
+ else
43
+ s.add_dependency(%q<yajl-ruby>)
44
44
  end
45
45
  s.add_dependency(%q<faraday>, [">= 0.8.1"])
46
46
  s.add_dependency(%q<hashie>, [">= 1.2.0"])
@@ -1,3 +1,3 @@
1
1
  module ApiClient
2
- VERSION = "0.4.3"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe ApiClient::Base do
4
4
 
5
5
  it "delegates methods to scope" do
6
- scope = mock
6
+ scope = double
7
7
  ApiClient::Base.stub(:scope).and_return(scope)
8
8
  [:fetch, :get, :put, :post, :delete, :headers, :endpoint, :options, :adapter, :params, :raw].each do |method|
9
9
  scope.should_receive(method)
@@ -12,4 +12,4 @@ describe ApiClient::Base do
12
12
 
13
13
  end
14
14
 
15
- end
15
+ end
@@ -34,10 +34,10 @@ describe ApiClient::Base do
34
34
  describe '.scoped' do
35
35
 
36
36
  it "stores the scope in the thread context, attached to class name" do
37
- mock_scope3 = mock
37
+ mock_scope3 = double
38
38
  ApiClient::Base.scoped(mock_scope3) do
39
39
  Thread.new {
40
- mock_scope2 = mock
40
+ mock_scope2 = double
41
41
  ApiClient::Base.scoped(mock_scope2) do
42
42
  ApiClient::Base.scope.should == mock_scope2
43
43
  Thread.current[ApiClient::Base.scope_thread_attribute_name].should == [mock_scope2]
@@ -47,7 +47,7 @@ describe ApiClient::Base do
47
47
  Thread.current[ApiClient::Base.scope_thread_attribute_name].should == [mock_scope3]
48
48
  end
49
49
  Thread.new {
50
- mock_scope = mock
50
+ mock_scope = double
51
51
  ApiClient::Base.scoped(mock_scope) do
52
52
  ApiClient::Base.scope.should == mock_scope
53
53
  Thread.current[ApiClient::Base.scope_thread_attribute_name].should == [mock_scope]
@@ -8,7 +8,7 @@ describe ApiClient::Connection::Abstract do
8
8
  it "does not raise an error when instantiating a subclass" do
9
9
  lambda {
10
10
  ConnectionSubclass.new("http://google.com")
11
- }.should_not raise_error("Cannot instantiate abstract class")
11
+ }.should_not raise_error()
12
12
  end
13
13
 
14
14
  it "raises an error when instantiating directly and not as a subclass" do
@@ -13,7 +13,7 @@ describe ApiClient::Connection::Basic do
13
13
  end
14
14
 
15
15
  it "adds the logger middlewares to faraday if ApiClient.logger is available" do
16
- logger = mock
16
+ logger = double
17
17
  ApiClient.stub(:logger).and_return(logger)
18
18
  instance = ApiClient::Connection::Basic.new("http://google.com")
19
19
  instance.handler.builder.handlers.collect(&:name).should == [
@@ -36,8 +36,8 @@ describe ApiClient::Connection::Basic do
36
36
  @headers = { "header" => "token" }
37
37
  @params = { "param" => "1", "nested" => { "param" => "1" } }
38
38
  @response = Faraday::Response.new(:status => 200)
39
- @faraday_request_params = mock
40
- @faraday_request = mock(:params => @faraday_request_params)
39
+ @faraday_request_params = double
40
+ @faraday_request = double(:params => @faraday_request_params)
41
41
  end
42
42
 
43
43
  it "can perform GET requests" do
@@ -12,7 +12,7 @@ describe ApiClient::Connection::Oauth do
12
12
  end
13
13
 
14
14
  it "adds the logger middlewares to faraday if ApiClient.logger is available" do
15
- logger = mock
15
+ logger = double
16
16
  ApiClient.stub(:logger).and_return(logger)
17
17
  instance = ApiClient::Connection::Oauth.new("http://google.com")
18
18
  instance.handler.builder.handlers.collect(&:name).should == [
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe ApiClient::Connection::Middlewares::Request::Json do
4
- let(:app) { mock }
4
+ let(:app) { double }
5
5
  let(:body) { {:some => :data} }
6
6
  let(:env) do
7
7
  {
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe ApiClient::Connection::Middlewares::Request::Logger do
4
4
 
5
5
  it "adds a oauth header to the request" do
6
- app = mock
6
+ app = double
7
7
  logger = FakeLogger.new
8
8
  instance = ApiClient::Connection::Middlewares::Request::Logger.new(app, logger)
9
9
  env = {
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe ApiClient::Connection::Middlewares::Request::OAuth do
4
4
 
5
5
  it "adds a oauth header to the request" do
6
- app = mock
6
+ app = double
7
7
  options = {
8
8
  :token => 'TOKEN',
9
9
  :token_secret => 'SECRET',
@@ -54,7 +54,7 @@ describe ApiClient::Resource::Base do
54
54
  end
55
55
 
56
56
  it "retains the original scope" do
57
- @instance.original_scope = stub
57
+ @instance.original_scope = double
58
58
  @instance.original_scope.should_receive(:destroy).with(42)
59
59
  @instance.destroy
60
60
  end
@@ -70,7 +70,7 @@ describe ApiClient::Resource::Base do
70
70
 
71
71
  it "retains the original scope" do
72
72
  ApiClient::Resource::Base.stub(:update)
73
- @instance.original_scope = stub
73
+ @instance.original_scope = double
74
74
  @instance.original_scope.should_receive(:update).with(42, "name" => "Mike")
75
75
  @instance.remote_update
76
76
  end
@@ -85,7 +85,7 @@ describe ApiClient::Resource::Base do
85
85
  end
86
86
 
87
87
  it "retains the original scope" do
88
- @instance.original_scope = stub
88
+ @instance.original_scope = double
89
89
  @instance.original_scope.should_receive(:create).with("name" => "Mike")
90
90
  @instance.remote_create
91
91
  end
@@ -60,7 +60,7 @@ describe ApiClient::Scope do
60
60
  end
61
61
 
62
62
  it "executes connection hooks" do
63
- AConnectionHook = mock
63
+ AConnectionHook = double
64
64
  class ScopeConnectionHooksTest < ApiClient::Base
65
65
  end
66
66
  ScopeConnectionHooksTest.connection_hooks = [AConnectionHook]
@@ -80,7 +80,7 @@ describe ApiClient::Scope do
80
80
  end
81
81
 
82
82
  def test_request(method)
83
- connection = mock
83
+ connection = double
84
84
  instance = ApiClient::Scope.new(ApiClient::Base)
85
85
  instance.stub(:connection).and_return(connection)
86
86
  response = Faraday::Response.new(:body => '{"a": "1"}')
@@ -89,7 +89,7 @@ describe ApiClient::Scope do
89
89
  end
90
90
 
91
91
  it "can make any request" do
92
- connection = mock
92
+ connection = double
93
93
  instance = ApiClient::Scope.new(ApiClient::Base)
94
94
  instance.stub(:connection).and_return(connection)
95
95
  response = Faraday::Response.new(:body => '{"a": "1"}')
@@ -99,7 +99,7 @@ describe ApiClient::Scope do
99
99
  end
100
100
 
101
101
  it "can make any request and get a raw response" do
102
- connection = mock
102
+ connection = double
103
103
  instance = ApiClient::Scope.new(ApiClient::Base)
104
104
  instance.stub(:connection).and_return(connection)
105
105
  response = Faraday::Response.new(:body => '{"a": "1"}')
@@ -133,7 +133,7 @@ describe ApiClient::Scope do
133
133
  describe "fetch" do
134
134
 
135
135
  it "performs a get and builds an object" do
136
- connection = mock
136
+ connection = double
137
137
  instance = ApiClient::Scope.new(ApiClient::Base)
138
138
  instance.stub(:connection).and_return(connection)
139
139
  response = Faraday::Response.new(:body => '{"id": 42}')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.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: 2013-07-09 00:00:00.000000000 Z
12
+ date: 2013-07-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yajl-ruby
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: 1.2.0
53
+ version: 2.0.5
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2.0
61
+ version: 2.0.5
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: multi_json
64
64
  requirement: !ruby/object:Gem::Requirement