faraday_middleware 0.0.5 → 0.1.0

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,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- faraday_middleware (0.0.4)
4
+ faraday_middleware (0.1.0)
5
5
  faraday (~> 0.4.5)
6
6
  hashie (~> 0.4.0)
7
7
  multi_json (~> 0.0.4)
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,7 +1,7 @@
1
1
  require 'multi_json'
2
2
 
3
3
  module Faraday
4
- class Response::MultiJson < Response::Middleware
4
+ class Response::ParseJson < Response::Middleware
5
5
  def self.register_on_complete(env)
6
6
  env[:response].on_complete do |response|
7
7
  response[:body] = begin
@@ -1,6 +1,6 @@
1
1
  require 'faraday'
2
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')
3
+ faraday_middleware_files = Dir[File.join(File.dirname(__FILE__), "/faraday/**/*.rb")].sort
4
+ faraday_middleware_files.each do |file|
5
+ require file
6
+ end
@@ -1,3 +1,3 @@
1
1
  module FaradayMiddleware
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
data/test/helper.rb CHANGED
@@ -7,6 +7,3 @@ require 'faraday'
7
7
  $LOAD_PATH.unshift(File.dirname(__FILE__))
8
8
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
9
  require 'faraday_middleware'
10
-
11
- class Test::Unit::TestCase
12
- end
data/test/mashify_test.rb CHANGED
@@ -6,7 +6,7 @@ class MashifyTest < Test::Unit::TestCase
6
6
  @stubs = Faraday::Adapter::Test::Stubs.new
7
7
  @conn = Faraday::Connection.new do |builder|
8
8
  builder.adapter :test, @stubs
9
- builder.use Faraday::Response::MultiJson
9
+ builder.use Faraday::Response::ParseJson
10
10
  builder.use Faraday::Response::Mashify
11
11
  end
12
12
  end
@@ -1,12 +1,12 @@
1
1
  require 'helper'
2
2
 
3
- class Multi_Json_Test < Test::Unit::TestCase
3
+ class ParseJsonTest < Test::Unit::TestCase
4
4
  context 'when used' do
5
5
  setup do
6
6
  @stubs = Faraday::Adapter::Test::Stubs.new
7
7
  @conn = Faraday::Connection.new do |builder|
8
8
  builder.adapter :test, @stubs
9
- builder.use Faraday::Response::MultiJson
9
+ builder.use Faraday::Response::ParseJson
10
10
  end
11
11
  end
12
12
 
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: 21
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 5
10
- version: 0.0.5
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Wynn Netherland
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-27 00:00:00 -07:00
18
+ date: 2010-10-01 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -164,8 +164,8 @@ files:
164
164
  - Rakefile
165
165
  - faraday_middleware.gemspec
166
166
  - lib/faraday/mashify.rb
167
- - lib/faraday/multi_json.rb
168
167
  - lib/faraday/oauth2.rb
168
+ - lib/faraday/parse_json.rb
169
169
  - lib/faraday_middleware.rb
170
170
  - lib/faraday_middleware/version.rb
171
171
  - test/helper.rb