frenetic 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -123,6 +123,7 @@ Or install it yourself as:
123
123
 
124
124
  ```ruby
125
125
  MyAPI = Frenetic.new(
126
+ # 'adapter' => :net_http # Or some other Faraday-compatible Adapter. Defaults to `:patron`
126
127
  'url' => 'https://api.yoursite.com',
127
128
  'username' => 'yourname',
128
129
  'password' => 'yourpassword',
@@ -42,7 +42,7 @@ class Frenetic
42
42
  builder.use FaradayMiddleware::RackCompatible, Rack::Cache::Context, config.cache
43
43
  end
44
44
 
45
- builder.adapter :patron
45
+ builder.adapter config.adapter || :patron
46
46
  end
47
47
  end
48
48
 
@@ -7,6 +7,7 @@ class Frenetic
7
7
  class Configuration
8
8
 
9
9
  @@defaults = {
10
+ adapter: nil,
10
11
  cache: nil,
11
12
  url: nil,
12
13
  username: nil,
@@ -18,7 +19,7 @@ class Frenetic
18
19
  response: {}
19
20
  }
20
21
 
21
- attr_accessor :cache, :url, :username, :password
22
+ attr_accessor :adapter, :cache, :url, :username, :password
22
23
  attr_accessor :headers, :request, :response, :middleware
23
24
 
24
25
  def initialize( config = {} )
@@ -1,3 +1,3 @@
1
1
  class Frenetic
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
@@ -12,6 +12,7 @@ describe Frenetic::Configuration do
12
12
 
13
13
  subject { instance }
14
14
 
15
+ it { should respond_to(:adapter) }
15
16
  it { should respond_to(:cache) }
16
17
  it { should respond_to(:url) }
17
18
  it { should respond_to(:username) }
@@ -26,6 +27,7 @@ describe Frenetic::Configuration do
26
27
 
27
28
  subject { instance.attributes }
28
29
 
30
+ it { should include(:adapter) }
29
31
  it { should include(:cache) }
30
32
  it { should include(:url) }
31
33
  it { should include(:username) }
@@ -66,6 +66,26 @@ describe Frenetic do
66
66
  subject.should include MyMiddleware
67
67
  end
68
68
  end
69
+
70
+ describe 'Faraday adapter' do
71
+ subject { connection.builder.handlers }
72
+
73
+ context 'by default' do
74
+ it 'should be :patron' do
75
+ subject.should include Faraday::Adapter::Patron
76
+ end
77
+ end
78
+
79
+ context 'when explicitly set' do
80
+ before do
81
+ config.merge! adapter: :net_http
82
+ end
83
+
84
+ it 'should use the specified adapter' do
85
+ subject.should include Faraday::Adapter::NetHttp
86
+ end
87
+ end
88
+ end
69
89
  end
70
90
 
71
91
  describe "#description" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frenetic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
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-03-06 00:00:00.000000000 Z
12
+ date: 2013-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday