faraday_middleware 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,24 +1,24 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
- *.gem
21
- .yardopts
22
- .yardoc
23
-
24
- ## PROJECT::SPECIFIC
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+ *.gem
21
+ .yardopts
22
+ .yardoc
23
+
24
+ ## PROJECT::SPECIFIC
data/CHANGELOG.md CHANGED
@@ -1,10 +1,10 @@
1
- # Changelog
2
-
3
- ### 0.0.2 September 25, 2010
4
-
5
- * Mashify now handles arrays of non-hashes
6
-
7
- ### 0.0.1 June 27, 2010
8
-
9
- * MultiJSON
1
+ # Changelog
2
+
3
+ ### 0.0.2 September 25, 2010
4
+
5
+ * Mashify now handles arrays of non-hashes
6
+
7
+ ### 0.0.1 June 27, 2010
8
+
9
+ * MultiJSON
10
10
  * Mashify
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source "http://rubygems.org"
2
-
3
- gemspec
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,29 +1,38 @@
1
- PATH
2
- remote: .
3
- specs:
4
- faraday_middleware (0.0.3)
5
- faraday (~> 0.4.5)
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- addressable (2.2.1)
11
- faraday (0.4.6)
12
- addressable (>= 2.1.1)
13
- rack (>= 1.0.1)
14
- hashie (0.4.0)
15
- mcmire-matchy (0.5.2)
16
- multi_json (0.0.4)
17
- rack (1.2.1)
18
- shoulda (2.11.3)
19
-
20
- PLATFORMS
21
- ruby
22
-
23
- DEPENDENCIES
24
- faraday (~> 0.4.5)
25
- faraday_middleware!
26
- hashie (~> 0.4.0)
27
- mcmire-matchy (~> 0.5.2)
28
- multi_json (~> 0.0.4)
29
- shoulda (~> 2.11.3)
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ faraday_middleware (0.0.4)
5
+ faraday (~> 0.4.5)
6
+ hashie (~> 0.4.0)
7
+ multi_json (~> 0.0.4)
8
+ oauth2 (~> 0.0.13)
9
+
10
+ GEM
11
+ remote: http://rubygems.org/
12
+ specs:
13
+ addressable (2.2.1)
14
+ faraday (0.4.6)
15
+ addressable (>= 2.1.1)
16
+ rack (>= 1.0.1)
17
+ hashie (0.4.0)
18
+ json (1.4.6)
19
+ multi_json (0.0.4)
20
+ oauth2 (0.0.13)
21
+ faraday (~> 0.4.1)
22
+ multi_json (>= 0.0.4)
23
+ rack (1.2.1)
24
+ rake (0.8.7)
25
+ shoulda (2.11.3)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ faraday (~> 0.4.5)
32
+ faraday_middleware!
33
+ hashie (~> 0.4.0)
34
+ json (~> 1.4.6)
35
+ multi_json (~> 0.0.4)
36
+ oauth2 (~> 0.0.13)
37
+ rake (~> 0.8.7)
38
+ shoulda (~> 2.11.3)
data/README.md CHANGED
@@ -1,43 +1,43 @@
1
- # Faraday Middleware
2
-
3
- Collection of [Faraday](http://github.com/technoweenie/faraday) middlewares I've been using in some of my API wrappers
4
-
5
-
6
- ## Installation
7
-
8
- sudo gem install faraday-middleware
9
-
10
-
11
- #### Some examples
12
-
13
- Let's decode the response body with [MultiJson](http://github.com/intridea/multi_json)
14
-
15
- conn = Faraday::Connection.new(:url => 'http://api.twitter.com/1') do |builder|
16
- builder.adapter Faraday.default_adapter
17
- builder.use Faraday::Response::MultiJson
18
- end
19
-
20
- resp = conn.get do |req|
21
- req.url '/users/show.json', :screen_name => 'pengwynn'
22
- end
23
-
24
- u = resp.body
25
- u['name']
26
- # => "Wynn Netherland"
27
-
28
-
29
- Want to ditch the brackets and use dot notation? [Mashify](http://github.com/intridea/hashie) it!
30
-
31
- conn = Faraday::Connection.new(:url => 'http://api.twitter.com/1') do |builder|
32
- builder.adapter Faraday.default_adapter
33
- builder.use Faraday::Response::MultiJson
34
- builder.use Faraday::Response::Mashify
35
- end
36
-
37
- resp = conn.get do |req|
38
- req.url '/users/show.json', :screen_name => 'pengwynn'
39
- end
40
-
41
- u = resp.body
42
- u.name
1
+ # Faraday Middleware
2
+
3
+ Collection of [Faraday](http://github.com/technoweenie/faraday) middlewares I've been using in some of my API wrappers
4
+
5
+
6
+ ## Installation
7
+
8
+ sudo gem install faraday-middleware
9
+
10
+
11
+ #### Some examples
12
+
13
+ Let's decode the response body with [MultiJson](http://github.com/intridea/multi_json)
14
+
15
+ conn = Faraday::Connection.new(:url => 'http://api.twitter.com/1') do |builder|
16
+ builder.adapter Faraday.default_adapter
17
+ builder.use Faraday::Response::MultiJson
18
+ end
19
+
20
+ resp = conn.get do |req|
21
+ req.url '/users/show.json', :screen_name => 'pengwynn'
22
+ end
23
+
24
+ u = resp.body
25
+ u['name']
26
+ # => "Wynn Netherland"
27
+
28
+
29
+ Want to ditch the brackets and use dot notation? [Mashify](http://github.com/intridea/hashie) it!
30
+
31
+ conn = Faraday::Connection.new(:url => 'http://api.twitter.com/1') do |builder|
32
+ builder.adapter Faraday.default_adapter
33
+ builder.use Faraday::Response::MultiJson
34
+ builder.use Faraday::Response::Mashify
35
+ end
36
+
37
+ resp = conn.get do |req|
38
+ req.url '/users/show.json', :screen_name => 'pengwynn'
39
+ end
40
+
41
+ u = resp.body
42
+ u.name
43
43
  # => "Wynn Netherland"
data/Rakefile CHANGED
@@ -1,14 +1,14 @@
1
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
- require 'rake'
3
- require 'rake/testtask'
4
- require 'bundler'
5
-
6
- Bundler::GemHelper.install_tasks
7
-
8
- Rake::TestTask.new(:test) do |test|
9
- test.ruby_opts = ["-rubygems"] if defined? Gem
10
- test.libs << "lib" << "test"
11
- test.pattern = "test/**/*_test.rb"
12
- end
13
-
14
- task :default => :test
1
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+ require 'bundler'
5
+
6
+ Bundler::GemHelper.install_tasks
7
+
8
+ Rake::TestTask.new(:test) do |test|
9
+ test.ruby_opts = ["-rubygems"] if defined? Gem
10
+ test.libs << "lib" << "test"
11
+ test.pattern = "test/**/*_test.rb"
12
+ end
13
+
14
+ task :default => :test
@@ -1,24 +1,27 @@
1
- require File.expand_path("../lib/faraday_middleware/version", __FILE__)
2
-
3
- Gem::Specification.new do |s|
4
- s.add_development_dependency('hashie', ['~> 0.4.0'])
5
- s.add_development_dependency('mcmire-matchy', ['~> 0.5.2'])
6
- s.add_development_dependency('multi_json', ['~> 0.0.4'])
7
- s.add_development_dependency('shoulda', ['~> 2.11.3'])
8
- s.add_runtime_dependency('faraday', ['~> 0.4.5'])
9
- s.authors = ["Wynn Netherland"]
10
- s.description = %q{Various middleware for Faraday}
11
- s.email = ['wynn.netherland@gmail.com']
12
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
- s.extra_rdoc_files = ["README.md"]
14
- s.files = `git ls-files`.split("\n")
15
- s.homepage = 'http://wynnnetherland.com/projects/faraday-middleware/'
16
- s.name = 'faraday_middleware'
17
- s.platform = Gem::Platform::RUBY
18
- s.rdoc_options = ["--charset=UTF-8"]
19
- s.require_paths = ["lib"]
20
- s.required_rubygems_version = ">= 1.3.6"
21
- s.summary = %q{Various middleware for Faraday}
22
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
- s.version = FaradayMiddleware::VERSION
24
- end
1
+ require File.expand_path("../lib/faraday_middleware/version", __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.add_development_dependency('hashie', ['~> 0.4.0'])
5
+ s.add_development_dependency('json', ['~> 1.4.6'])
6
+ s.add_development_dependency('shoulda', ['~> 2.11.3'])
7
+ s.add_development_dependency('rake', ['~> 0.8.7'])
8
+ s.add_runtime_dependency('faraday', ['~> 0.4.5'])
9
+ s.add_runtime_dependency('hashie', ['~> 0.4.0'])
10
+ s.add_runtime_dependency('multi_json', ['~> 0.0.4'])
11
+ s.add_runtime_dependency('oauth2', ['~> 0.0.13'])
12
+ s.authors = ["Wynn Netherland"]
13
+ s.description = %q{Various middleware for Faraday}
14
+ s.email = ['wynn.netherland@gmail.com']
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ s.extra_rdoc_files = ["README.md"]
17
+ s.files = `git ls-files`.split("\n")
18
+ s.homepage = 'http://wynnnetherland.com/projects/faraday-middleware/'
19
+ s.name = 'faraday_middleware'
20
+ s.platform = Gem::Platform::RUBY
21
+ s.rdoc_options = ["--charset=UTF-8"]
22
+ s.require_paths = ["lib"]
23
+ s.required_rubygems_version = ">= 1.3.6"
24
+ s.summary = %q{Various middleware for Faraday}
25
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
26
+ s.version = FaradayMiddleware::VERSION
27
+ end
@@ -1,25 +1,21 @@
1
- module Faraday
2
- class Response::Mashify < Response::Middleware
3
- begin
4
- require 'hashie'
5
-
6
- def self.register_on_complete(env)
7
- env[:response].on_complete do |finished_env|
8
- json = finished_env[:body]
9
- if json.is_a?(Hash)
10
- finished_env[:body] = Hashie::Mash.new(json)
11
- elsif json.is_a?(Array) and json.first.is_a?(Hash)
12
- finished_env[:body] = json.map{|item| Hashie::Mash.new(item) }
13
- end
14
- end
15
- end
16
- rescue LoadError, NameError => e
17
- self.load_error = e
18
- end
19
-
20
- def initialize(app)
21
- super
22
- @parser = nil
23
- end
24
- end
25
- end
1
+ require 'hashie'
2
+
3
+ module Faraday
4
+ class Response::Mashify < Response::Middleware
5
+ def self.register_on_complete(env)
6
+ env[:response].on_complete do |response|
7
+ json = response[:body]
8
+ if json.is_a?(Hash)
9
+ response[:body] = Hashie::Mash.new(json)
10
+ elsif json.is_a?(Array) and json.first.is_a?(Hash)
11
+ response[:body] = json.map{|item| Hashie::Mash.new(item) }
12
+ end
13
+ end
14
+ end
15
+
16
+ def initialize(app)
17
+ super
18
+ @parser = nil
19
+ end
20
+ end
21
+ end
@@ -1,31 +1,27 @@
1
- module Faraday
2
- class Response::MultiJson < Response::Middleware
3
- begin
4
- require 'multi_json'
5
-
6
- def self.register_on_complete(env)
7
- env[:response].on_complete do |finished_env|
8
- finished_env[:body] = begin
9
- case finished_env[:body]
10
- when ""
11
- nil
12
- when "true"
13
- true
14
- when "false"
15
- false
16
- else
17
- MultiJson.decode(finished_env[:body])
18
- end
19
- end
20
- end
21
- end
22
- rescue LoadError, NameError => e
23
- self.load_error = e
24
- end
25
-
26
- def initialize(app)
27
- super
28
- @parser = nil
29
- end
30
- end
31
- end
1
+ require 'multi_json'
2
+
3
+ module Faraday
4
+ class Response::MultiJson < Response::Middleware
5
+ def self.register_on_complete(env)
6
+ env[:response].on_complete do |response|
7
+ response[:body] = begin
8
+ case response[:body]
9
+ when ""
10
+ nil
11
+ when "true"
12
+ true
13
+ when "false"
14
+ false
15
+ else
16
+ MultiJson.decode(response[:body])
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ def initialize(app)
23
+ super
24
+ @parser = nil
25
+ end
26
+ end
27
+ end
@@ -1,21 +1,18 @@
1
- module Faraday
2
- class Request::OAuth2 < Faraday::Middleware
3
- begin
4
- require 'oauth2'
5
- rescue LoadError, NameError => e
6
- self.load_error = e
7
- end
8
- def initialize(app, *args)
9
- @app = app
10
- @token = args.shift
11
- end
12
-
13
- def call(env)
14
- params = env[:url].query_values || {}
15
- env[:url].query_values = params.merge('access_token' => @token)
16
- env[:request_headers].merge!('Authorization' => "Token token=\"#{@token}\"")
17
-
18
- @app.call env
19
- end
20
- end
21
- end
1
+ require 'oauth2'
2
+
3
+ module Faraday
4
+ class Request::OAuth2 < Faraday::Middleware
5
+ def initialize(app, *args)
6
+ @app = app
7
+ @token = args.shift
8
+ end
9
+
10
+ def call(env)
11
+ params = env[:url].query_values || {}
12
+ env[:url].query_values = params.merge('access_token' => @token)
13
+ env[:request_headers].merge!('Authorization' => "Token token=\"#{@token}\"")
14
+
15
+ @app.call env
16
+ end
17
+ end
18
+ end
@@ -1,6 +1,6 @@
1
- require 'faraday'
2
-
3
- directory = File.expand_path(File.dirname(__FILE__))
4
- require File.join(directory, 'faraday', 'oauth2')
5
- require File.join(directory, 'faraday', 'multi_json')
6
- require File.join(directory, 'faraday', 'mashify')
1
+ require 'faraday'
2
+
3
+ directory = File.expand_path(File.dirname(__FILE__))
4
+ require File.join(directory, 'faraday', 'oauth2')
5
+ require File.join(directory, 'faraday', 'multi_json')
6
+ require File.join(directory, 'faraday', 'mashify')
@@ -1,3 +1,3 @@
1
- module FaradayMiddleware
2
- VERSION = "0.0.4".freeze
3
- end
1
+ module FaradayMiddleware
2
+ VERSION = "0.0.5"
3
+ end
data/test/helper.rb CHANGED
@@ -1,12 +1,12 @@
1
- require 'test/unit'
2
- require 'pathname'
3
- require 'rubygems'
4
- require 'shoulda'
5
- require 'faraday'
6
-
7
- $LOAD_PATH.unshift(File.dirname(__FILE__))
8
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
- require 'faraday_middleware'
10
-
11
- class Test::Unit::TestCase
12
- end
1
+ require 'test/unit'
2
+ require 'pathname'
3
+ require 'rubygems'
4
+ require 'shoulda'
5
+ require 'faraday'
6
+
7
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
8
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
+ require 'faraday_middleware'
10
+
11
+ class Test::Unit::TestCase
12
+ end
data/test/mashify_test.rb CHANGED
@@ -1,35 +1,35 @@
1
- require 'helper'
2
-
3
- class MashifyTest < Test::Unit::TestCase
4
- context 'when used' do
5
- setup do
6
- @stubs = Faraday::Adapter::Test::Stubs.new
7
- @conn = Faraday::Connection.new do |builder|
8
- builder.adapter :test, @stubs
9
- builder.use Faraday::Response::MultiJson
10
- builder.use Faraday::Response::Mashify
11
- end
12
- end
13
-
14
- should 'create a Hashie::Mash from the body' do
15
- @stubs.get('/hash') { [200, {}, "{\"name\":\"Wynn Netherland\",\"username\":\"pengwynn\"}"] }
16
- me = @conn.get("/hash").body
17
- assert_equal 'Wynn Netherland', me.name
18
- assert_equal 'pengwynn', me.username
19
- end
20
-
21
- should 'handle arrays' do
22
- @stubs.get('/array') { [200, {}, "[{\"username\":\"pengwynn\"},{\"username\":\"jnunemaker\"}]" ] }
23
- us = @conn.get("/array").body
24
- assert_equal 'pengwynn', us.first.username
25
- assert_equal 'jnunemaker', us.last.username
26
- end
27
-
28
- should 'handle arrays of non-hashes' do
29
- @stubs.get('/array/simple') { [200, {}, "[123, 456]" ] }
30
- values = @conn.get("/array/simple").body
31
- assert_equal 123, values.first
32
- assert_equal 456, values.last
33
- end
34
- end
35
- end
1
+ require 'helper'
2
+
3
+ class MashifyTest < Test::Unit::TestCase
4
+ context 'when used' do
5
+ setup do
6
+ @stubs = Faraday::Adapter::Test::Stubs.new
7
+ @conn = Faraday::Connection.new do |builder|
8
+ builder.adapter :test, @stubs
9
+ builder.use Faraday::Response::MultiJson
10
+ builder.use Faraday::Response::Mashify
11
+ end
12
+ end
13
+
14
+ should 'create a Hashie::Mash from the body' do
15
+ @stubs.get('/hash') { [200, {}, "{\"name\":\"Wynn Netherland\",\"username\":\"pengwynn\"}"] }
16
+ me = @conn.get("/hash").body
17
+ assert_equal 'Wynn Netherland', me.name
18
+ assert_equal 'pengwynn', me.username
19
+ end
20
+
21
+ should 'handle arrays' do
22
+ @stubs.get('/array') { [200, {}, "[{\"username\":\"pengwynn\"},{\"username\":\"jnunemaker\"}]" ] }
23
+ us = @conn.get("/array").body
24
+ assert_equal 'pengwynn', us.first.username
25
+ assert_equal 'jnunemaker', us.last.username
26
+ end
27
+
28
+ should 'handle arrays of non-hashes' do
29
+ @stubs.get('/array/simple') { [200, {}, "[123, 456]" ] }
30
+ values = @conn.get("/array/simple").body
31
+ assert_equal 123, values.first
32
+ assert_equal 456, values.last
33
+ end
34
+ end
35
+ end
@@ -1,75 +1,75 @@
1
- require 'helper'
2
-
3
- class Multi_Json_Test < Test::Unit::TestCase
4
- context 'when used' do
5
- setup do
6
- @stubs = Faraday::Adapter::Test::Stubs.new
7
- @conn = Faraday::Connection.new do |builder|
8
- builder.adapter :test, @stubs
9
- builder.use Faraday::Response::MultiJson
10
- end
11
- end
12
-
13
- context "when there is a JSON body" do
14
- setup do
15
- @stubs.get('/me') { [200, {}, "{\"name\":\"Wynn Netherland\",\"username\":\"pengwynn\"}"] }
16
- end
17
-
18
- should 'parse the body as JSON' do
19
- me = @conn.get("/me").body
20
- assert me.is_a?(Hash)
21
- assert_equal 'Wynn Netherland', me['name']
22
- assert_equal 'pengwynn', me['username']
23
- end
24
- end
25
-
26
- context "when the JSON body is empty" do
27
- setup do
28
- @stubs.get('/me') { [200, {}, ""] }
29
- end
30
-
31
- should 'still have the status code' do
32
- response = @conn.get("/me")
33
- assert_equal 200, response.status
34
- end
35
-
36
- should 'set body to nil' do
37
- response = @conn.get("/me")
38
- assert_equal response.body, nil
39
- end
40
- end
41
-
42
- context "when the JSON body is 'true'" do
43
- setup do
44
- @stubs.get('/me') { [200, {}, "true"] }
45
- end
46
-
47
- should 'still have the status code' do
48
- response = @conn.get("/me")
49
- assert_equal 200, response.status
50
- end
51
-
52
- should 'set body to nil' do
53
- response = @conn.get("/me")
54
- assert_equal response.body, true
55
- end
56
- end
57
-
58
- context "when the JSON body is 'false'" do
59
- setup do
60
- @stubs.get('/me') { [200, {}, "false"] }
61
- end
62
-
63
- should 'still have the status code' do
64
- response = @conn.get("/me")
65
- assert_equal 200, response.status
66
- end
67
-
68
- should 'set body to nil' do
69
- response = @conn.get("/me")
70
- assert_equal response.body, false
71
- end
72
- end
73
-
74
- end
75
- end
1
+ require 'helper'
2
+
3
+ class Multi_Json_Test < Test::Unit::TestCase
4
+ context 'when used' do
5
+ setup do
6
+ @stubs = Faraday::Adapter::Test::Stubs.new
7
+ @conn = Faraday::Connection.new do |builder|
8
+ builder.adapter :test, @stubs
9
+ builder.use Faraday::Response::MultiJson
10
+ end
11
+ end
12
+
13
+ context "when there is a JSON body" do
14
+ setup do
15
+ @stubs.get('/me') { [200, {}, "{\"name\":\"Wynn Netherland\",\"username\":\"pengwynn\"}"] }
16
+ end
17
+
18
+ should 'parse the body as JSON' do
19
+ me = @conn.get("/me").body
20
+ assert me.is_a?(Hash)
21
+ assert_equal 'Wynn Netherland', me['name']
22
+ assert_equal 'pengwynn', me['username']
23
+ end
24
+ end
25
+
26
+ context "when the JSON body is empty" do
27
+ setup do
28
+ @stubs.get('/me') { [200, {}, ""] }
29
+ end
30
+
31
+ should 'still have the status code' do
32
+ response = @conn.get("/me")
33
+ assert_equal 200, response.status
34
+ end
35
+
36
+ should 'set body to nil' do
37
+ response = @conn.get("/me")
38
+ assert_equal response.body, nil
39
+ end
40
+ end
41
+
42
+ context "when the JSON body is 'true'" do
43
+ setup do
44
+ @stubs.get('/me') { [200, {}, "true"] }
45
+ end
46
+
47
+ should 'still have the status code' do
48
+ response = @conn.get("/me")
49
+ assert_equal 200, response.status
50
+ end
51
+
52
+ should 'set body to nil' do
53
+ response = @conn.get("/me")
54
+ assert_equal response.body, true
55
+ end
56
+ end
57
+
58
+ context "when the JSON body is 'false'" do
59
+ setup do
60
+ @stubs.get('/me') { [200, {}, "false"] }
61
+ end
62
+
63
+ should 'still have the status code' do
64
+ response = @conn.get("/me")
65
+ assert_equal 200, response.status
66
+ end
67
+
68
+ should 'set body to nil' do
69
+ response = @conn.get("/me")
70
+ assert_equal response.body, false
71
+ end
72
+ end
73
+
74
+ end
75
+ end
data/test/oauth2_test.rb CHANGED
@@ -1,18 +1,18 @@
1
- require 'helper'
2
-
3
- class OAuth2Test < Test::Unit::TestCase
4
- context 'when used' do
5
- setup do
6
- @stubs = Faraday::Adapter::Test::Stubs.new
7
- @stubs.get('/me?access_token=OU812') { [200, {}, 'pengwynn'] }
8
- end
9
-
10
- should 'add the access token to the request' do
11
- do_you = Faraday::Connection.new do |builder|
12
- builder.use Faraday::Request::OAuth2, 'OU812'
13
- builder.adapter :test, @stubs
14
- end
15
- do_you.get("/me")
16
- end
17
- end
18
- end
1
+ require 'helper'
2
+
3
+ class OAuth2Test < Test::Unit::TestCase
4
+ context 'when used' do
5
+ setup do
6
+ @stubs = Faraday::Adapter::Test::Stubs.new
7
+ @stubs.get('/me?access_token=OU812') { [200, {}, 'pengwynn'] }
8
+ end
9
+
10
+ should 'add the access token to the request' do
11
+ do_you = Faraday::Connection.new do |builder|
12
+ builder.use Faraday::Request::OAuth2, 'OU812'
13
+ builder.adapter :test, @stubs
14
+ end
15
+ do_you.get("/me")
16
+ end
17
+ end
18
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday_middleware
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Wynn Netherland
@@ -35,51 +35,51 @@ dependencies:
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- name: mcmire-matchy
38
+ name: json
39
39
  prerelease: false
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- hash: 15
45
+ hash: 11
46
46
  segments:
47
- - 0
48
- - 5
49
- - 2
50
- version: 0.5.2
47
+ - 1
48
+ - 4
49
+ - 6
50
+ version: 1.4.6
51
51
  type: :development
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
54
- name: multi_json
54
+ name: shoulda
55
55
  prerelease: false
56
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- hash: 23
61
+ hash: 37
62
62
  segments:
63
- - 0
64
- - 0
65
- - 4
66
- version: 0.0.4
63
+ - 2
64
+ - 11
65
+ - 3
66
+ version: 2.11.3
67
67
  type: :development
68
68
  version_requirements: *id003
69
69
  - !ruby/object:Gem::Dependency
70
- name: shoulda
70
+ name: rake
71
71
  prerelease: false
72
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- hash: 37
77
+ hash: 49
78
78
  segments:
79
- - 2
80
- - 11
81
- - 3
82
- version: 2.11.3
79
+ - 0
80
+ - 8
81
+ - 7
82
+ version: 0.8.7
83
83
  type: :development
84
84
  version_requirements: *id004
85
85
  - !ruby/object:Gem::Dependency
@@ -98,6 +98,54 @@ dependencies:
98
98
  version: 0.4.5
99
99
  type: :runtime
100
100
  version_requirements: *id005
101
+ - !ruby/object:Gem::Dependency
102
+ name: hashie
103
+ prerelease: false
104
+ requirement: &id006 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ hash: 15
110
+ segments:
111
+ - 0
112
+ - 4
113
+ - 0
114
+ version: 0.4.0
115
+ type: :runtime
116
+ version_requirements: *id006
117
+ - !ruby/object:Gem::Dependency
118
+ name: multi_json
119
+ prerelease: false
120
+ requirement: &id007 !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ hash: 23
126
+ segments:
127
+ - 0
128
+ - 0
129
+ - 4
130
+ version: 0.0.4
131
+ type: :runtime
132
+ version_requirements: *id007
133
+ - !ruby/object:Gem::Dependency
134
+ name: oauth2
135
+ prerelease: false
136
+ requirement: &id008 !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ hash: 5
142
+ segments:
143
+ - 0
144
+ - 0
145
+ - 13
146
+ version: 0.0.13
147
+ type: :runtime
148
+ version_requirements: *id008
101
149
  description: Various middleware for Faraday
102
150
  email:
103
151
  - wynn.netherland@gmail.com