faraday_middleware 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +24 -24
- data/CHANGELOG.md +9 -9
- data/Gemfile.lock +1 -5
- data/Rakefile +14 -14
- data/faraday_middleware.gemspec +4 -5
- data/lib/faraday/mashify.rb +7 -2
- data/lib/faraday/oauth2.rb +11 -6
- data/lib/faraday/parse_json.rb +7 -2
- data/lib/faraday/parse_xml.rb +7 -2
- data/lib/faraday_middleware/version.rb +1 -1
- metadata +36 -52
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.lock
CHANGED
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/faraday_middleware.gemspec
CHANGED
@@ -3,13 +3,12 @@ require File.expand_path("../lib/faraday_middleware/version", __FILE__)
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.add_development_dependency('hashie', ['~> 0.4.0'])
|
5
5
|
s.add_development_dependency('json', ['~> 1.4.6'])
|
6
|
-
s.add_development_dependency('
|
6
|
+
s.add_development_dependency('multi_json', ['~> 0.0.4'])
|
7
|
+
s.add_development_dependency('multi_xml', ['~> 0.1.0'])
|
8
|
+
s.add_development_dependency('oauth2', ['~> 0.1.0'])
|
7
9
|
s.add_development_dependency('rake', ['~> 0.8.7'])
|
10
|
+
s.add_development_dependency('shoulda', ['~> 2.11.3'])
|
8
11
|
s.add_runtime_dependency('faraday', ['~> 0.5.0'])
|
9
|
-
s.add_runtime_dependency('hashie', ['~> 0.4.0'])
|
10
|
-
s.add_runtime_dependency('multi_json', ['~> 0.0.4'])
|
11
|
-
s.add_runtime_dependency('multi_xml', ['~> 0.1.0'])
|
12
|
-
s.add_runtime_dependency('oauth2', ['~> 0.1.0'])
|
13
12
|
s.authors = ["Wynn Netherland"]
|
14
13
|
s.description = %q{Various middleware for Faraday}
|
15
14
|
s.email = ['wynn.netherland@gmail.com']
|
data/lib/faraday/mashify.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
require 'hashie'
|
2
|
-
|
3
1
|
module Faraday
|
4
2
|
class Response::Mashify < Response::Middleware
|
3
|
+
begin
|
4
|
+
require 'hashie'
|
5
|
+
rescue LoadError, NameError => error
|
6
|
+
self.load_error = error
|
7
|
+
raise error
|
8
|
+
end
|
9
|
+
|
5
10
|
def self.register_on_complete(env)
|
6
11
|
env[:response].on_complete do |response|
|
7
12
|
json = response[:body]
|
data/lib/faraday/oauth2.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require 'oauth2'
|
2
|
-
|
3
1
|
module Faraday
|
4
2
|
class Request::OAuth2 < Faraday::Middleware
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
begin
|
4
|
+
require 'oauth2'
|
5
|
+
rescue LoadError, NameError => error
|
6
|
+
self.load_error = error
|
7
|
+
raise error
|
8
|
+
end
|
9
9
|
|
10
10
|
def call(env)
|
11
11
|
params = env[:url].query_values || {}
|
@@ -14,5 +14,10 @@ module Faraday
|
|
14
14
|
|
15
15
|
@app.call env
|
16
16
|
end
|
17
|
+
|
18
|
+
def initialize(app, *args)
|
19
|
+
@app = app
|
20
|
+
@token = args.shift
|
21
|
+
end
|
17
22
|
end
|
18
23
|
end
|
data/lib/faraday/parse_json.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
require 'multi_json'
|
2
|
-
|
3
1
|
module Faraday
|
4
2
|
class Response::ParseJson < Response::Middleware
|
3
|
+
begin
|
4
|
+
require 'multi_json'
|
5
|
+
rescue LoadError, NameError => error
|
6
|
+
self.load_error = error
|
7
|
+
raise error
|
8
|
+
end
|
9
|
+
|
5
10
|
def self.register_on_complete(env)
|
6
11
|
env[:response].on_complete do |response|
|
7
12
|
response[:body] = begin
|
data/lib/faraday/parse_xml.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
require 'multi_xml'
|
2
|
-
|
3
1
|
module Faraday
|
4
2
|
class Response::ParseXml < Response::Middleware
|
3
|
+
begin
|
4
|
+
require 'multi_xml'
|
5
|
+
rescue LoadError, NameError => error
|
6
|
+
self.load_error = error
|
7
|
+
raise error
|
8
|
+
end
|
9
|
+
|
5
10
|
def self.register_on_complete(env)
|
6
11
|
env[:response].on_complete do |response|
|
7
12
|
response[:body] = begin
|
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: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Wynn Netherland
|
@@ -51,117 +51,101 @@ dependencies:
|
|
51
51
|
type: :development
|
52
52
|
version_requirements: *id002
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
54
|
+
name: multi_json
|
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:
|
61
|
+
hash: 23
|
62
62
|
segments:
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
version:
|
63
|
+
- 0
|
64
|
+
- 0
|
65
|
+
- 4
|
66
|
+
version: 0.0.4
|
67
67
|
type: :development
|
68
68
|
version_requirements: *id003
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: multi_xml
|
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:
|
77
|
+
hash: 27
|
78
78
|
segments:
|
79
79
|
- 0
|
80
|
-
-
|
81
|
-
-
|
82
|
-
version: 0.
|
80
|
+
- 1
|
81
|
+
- 0
|
82
|
+
version: 0.1.0
|
83
83
|
type: :development
|
84
84
|
version_requirements: *id004
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
86
|
+
name: oauth2
|
87
87
|
prerelease: false
|
88
88
|
requirement: &id005 !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
hash:
|
93
|
+
hash: 27
|
94
94
|
segments:
|
95
95
|
- 0
|
96
|
-
-
|
96
|
+
- 1
|
97
97
|
- 0
|
98
|
-
version: 0.
|
99
|
-
type: :
|
98
|
+
version: 0.1.0
|
99
|
+
type: :development
|
100
100
|
version_requirements: *id005
|
101
101
|
- !ruby/object:Gem::Dependency
|
102
|
-
name:
|
102
|
+
name: rake
|
103
103
|
prerelease: false
|
104
104
|
requirement: &id006 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
hash:
|
109
|
+
hash: 49
|
110
110
|
segments:
|
111
111
|
- 0
|
112
|
-
-
|
113
|
-
-
|
114
|
-
version: 0.
|
115
|
-
type: :
|
112
|
+
- 8
|
113
|
+
- 7
|
114
|
+
version: 0.8.7
|
115
|
+
type: :development
|
116
116
|
version_requirements: *id006
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
118
|
+
name: shoulda
|
119
119
|
prerelease: false
|
120
120
|
requirement: &id007 !ruby/object:Gem::Requirement
|
121
121
|
none: false
|
122
122
|
requirements:
|
123
123
|
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
hash:
|
125
|
+
hash: 37
|
126
126
|
segments:
|
127
|
-
-
|
128
|
-
-
|
129
|
-
-
|
130
|
-
version:
|
131
|
-
type: :
|
127
|
+
- 2
|
128
|
+
- 11
|
129
|
+
- 3
|
130
|
+
version: 2.11.3
|
131
|
+
type: :development
|
132
132
|
version_requirements: *id007
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
|
-
name:
|
134
|
+
name: faraday
|
135
135
|
prerelease: false
|
136
136
|
requirement: &id008 !ruby/object:Gem::Requirement
|
137
137
|
none: false
|
138
138
|
requirements:
|
139
139
|
- - ~>
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
hash:
|
141
|
+
hash: 11
|
142
142
|
segments:
|
143
143
|
- 0
|
144
|
-
-
|
144
|
+
- 5
|
145
145
|
- 0
|
146
|
-
version: 0.
|
146
|
+
version: 0.5.0
|
147
147
|
type: :runtime
|
148
148
|
version_requirements: *id008
|
149
|
-
- !ruby/object:Gem::Dependency
|
150
|
-
name: oauth2
|
151
|
-
prerelease: false
|
152
|
-
requirement: &id009 !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ~>
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
hash: 27
|
158
|
-
segments:
|
159
|
-
- 0
|
160
|
-
- 1
|
161
|
-
- 0
|
162
|
-
version: 0.1.0
|
163
|
-
type: :runtime
|
164
|
-
version_requirements: *id009
|
165
149
|
description: Various middleware for Faraday
|
166
150
|
email:
|
167
151
|
- wynn.netherland@gmail.com
|