faraday_middleware 0.0.5 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +24 -24
- data/CHANGELOG.md +9 -9
- data/Gemfile +3 -3
- data/Gemfile.lock +1 -1
- data/README.md +42 -42
- data/Rakefile +14 -14
- data/lib/faraday/{multi_json.rb → parse_json.rb} +1 -1
- data/lib/faraday_middleware.rb +4 -4
- data/lib/faraday_middleware/version.rb +1 -1
- data/test/helper.rb +0 -3
- data/test/mashify_test.rb +1 -1
- data/test/multi_json_test.rb +2 -2
- metadata +5 -5
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
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
|
data/lib/faraday_middleware.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
require
|
6
|
-
|
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
|
data/test/helper.rb
CHANGED
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::
|
9
|
+
builder.use Faraday::Response::ParseJson
|
10
10
|
builder.use Faraday::Response::Mashify
|
11
11
|
end
|
12
12
|
end
|
data/test/multi_json_test.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class
|
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::
|
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:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
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-
|
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
|