faraday_middleware 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/faraday_middleware.rb +13 -28
- data/lib/faraday_middleware/backwards_compatibility.rb +13 -28
- data/lib/faraday_middleware/request/oauth.rb +3 -0
- data/lib/faraday_middleware/request/oauth2.rb +3 -0
- data/lib/faraday_middleware/response/mashify.rb +7 -3
- data/lib/faraday_middleware/response/parse_json.rb +3 -0
- data/lib/faraday_middleware/response/parse_marshal.rb +3 -0
- data/lib/faraday_middleware/response/parse_xml.rb +3 -0
- data/lib/faraday_middleware/response/parse_yaml.rb +3 -0
- data/lib/faraday_middleware/response/rashify.rb +7 -3
- data/lib/faraday_middleware/version.rb +1 -1
- metadata +18 -18
data/lib/faraday_middleware.rb
CHANGED
@@ -1,34 +1,19 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
|
3
3
|
module FaradayMiddleware
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
:FollowRedirects => 'response/follow_redirects',
|
18
|
-
:Instrumentation => 'instrumentation'
|
19
|
-
}
|
20
|
-
|
21
|
-
# autoload without the autoload
|
22
|
-
define_method(:const_missing) { |const|
|
23
|
-
if middleware.member? const
|
24
|
-
require "faraday_middleware/#{middleware[const]}"
|
25
|
-
raise NameError, "missing #{const} middleware" unless const_defined? const
|
26
|
-
const_get const
|
27
|
-
else
|
28
|
-
super
|
29
|
-
end
|
30
|
-
}
|
31
|
-
end
|
4
|
+
autoload :OAuth, 'faraday_middleware/request/oauth'
|
5
|
+
autoload :OAuth2, 'faraday_middleware/request/oauth2'
|
6
|
+
autoload :EncodeJson, 'faraday_middleware/request/encode_json'
|
7
|
+
autoload :Mashify, 'faraday_middleware/response/mashify'
|
8
|
+
autoload :Rashify, 'faraday_middleware/response/rashify'
|
9
|
+
autoload :ParseJson, 'faraday_middleware/response/parse_json'
|
10
|
+
autoload :ParseXml, 'faraday_middleware/response/parse_xml'
|
11
|
+
autoload :ParseMarshal, 'faraday_middleware/response/parse_marshal'
|
12
|
+
autoload :ParseYaml, 'faraday_middleware/response/parse_yaml'
|
13
|
+
autoload :Caching, 'faraday_middleware/response/caching'
|
14
|
+
autoload :RackCompatible, 'faraday_middleware/rack_compatible'
|
15
|
+
autoload :FollowRedirects, 'faraday_middleware/response/follow_redirects'
|
16
|
+
autoload :Instrumentation, 'faraday_middleware/instrumentation'
|
32
17
|
|
33
18
|
if Faraday.respond_to? :register_middleware
|
34
19
|
Faraday.register_middleware :request,
|
@@ -1,30 +1,15 @@
|
|
1
|
-
|
2
|
-
warn "Deprecation warning: #{old} is deprecated; use #{new}"
|
3
|
-
warn trace[0,10].join("\n") if $DEBUG
|
4
|
-
}
|
1
|
+
# deprecated constants
|
5
2
|
|
6
|
-
Faraday::Request.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
klass = FaradayMiddleware.const_get(const)
|
11
|
-
deprecation_warning.call "Faraday::Request::#{const}", klass.name, caller
|
12
|
-
const_set const, klass
|
13
|
-
else
|
14
|
-
super
|
15
|
-
end
|
16
|
-
}
|
17
|
-
}
|
3
|
+
Faraday::Request.class_eval do
|
4
|
+
autoload :OAuth, 'faraday_middleware/request/oauth'
|
5
|
+
autoload :OAuth2, 'faraday_middleware/request/oauth2'
|
6
|
+
end
|
18
7
|
|
19
|
-
Faraday::Response.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
super
|
28
|
-
end
|
29
|
-
}
|
30
|
-
}
|
8
|
+
Faraday::Response.class_eval do
|
9
|
+
autoload :Mashify, 'faraday_middleware/response/mashify'
|
10
|
+
autoload :Rashify, 'faraday_middleware/response/rashify'
|
11
|
+
autoload :ParseJson, 'faraday_middleware/response/parse_json'
|
12
|
+
autoload :ParseXml, 'faraday_middleware/response/parse_xml'
|
13
|
+
autoload :ParseMarshal, 'faraday_middleware/response/parse_marshal'
|
14
|
+
autoload :ParseYaml, 'faraday_middleware/response/parse_yaml'
|
15
|
+
end
|
@@ -2,13 +2,14 @@ require 'faraday'
|
|
2
2
|
|
3
3
|
module FaradayMiddleware
|
4
4
|
class Mashify < Faraday::Response::Middleware
|
5
|
-
dependency 'hashie/mash'
|
6
|
-
|
7
5
|
class << self
|
8
6
|
attr_accessor :mash_class
|
9
7
|
end
|
10
8
|
|
11
|
-
|
9
|
+
dependency do
|
10
|
+
require 'hashie/mash'
|
11
|
+
self.mash_class = ::Hashie::Mash
|
12
|
+
end
|
12
13
|
|
13
14
|
def parse(body)
|
14
15
|
case body
|
@@ -22,3 +23,6 @@ module FaradayMiddleware
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
26
|
+
|
27
|
+
# deprecated alias
|
28
|
+
Faraday::Response::Mashify = FaradayMiddleware::Mashify
|
@@ -2,8 +2,12 @@ require 'faraday_middleware/response/mashify'
|
|
2
2
|
|
3
3
|
module FaradayMiddleware
|
4
4
|
class Rashify < Mashify
|
5
|
-
dependency
|
6
|
-
|
7
|
-
|
5
|
+
dependency do
|
6
|
+
require 'rash'
|
7
|
+
self.mash_class = ::Hashie::Rash
|
8
|
+
end
|
8
9
|
end
|
9
10
|
end
|
11
|
+
|
12
|
+
# deprecated alias
|
13
|
+
Faraday::Response::Rashify = FaradayMiddleware::Rashify
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday_middleware
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-01-
|
13
|
+
date: 2012-01-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
17
|
-
requirement: &
|
17
|
+
requirement: &70166886053120 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -25,10 +25,10 @@ dependencies:
|
|
25
25
|
version: '0.9'
|
26
26
|
type: :runtime
|
27
27
|
prerelease: false
|
28
|
-
version_requirements: *
|
28
|
+
version_requirements: *70166886053120
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: multi_xml
|
31
|
-
requirement: &
|
31
|
+
requirement: &70166886068140 !ruby/object:Gem::Requirement
|
32
32
|
none: false
|
33
33
|
requirements:
|
34
34
|
- - ~>
|
@@ -36,10 +36,10 @@ dependencies:
|
|
36
36
|
version: '0.2'
|
37
37
|
type: :development
|
38
38
|
prerelease: false
|
39
|
-
version_requirements: *
|
39
|
+
version_requirements: *70166886068140
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rake
|
42
|
-
requirement: &
|
42
|
+
requirement: &70166886066400 !ruby/object:Gem::Requirement
|
43
43
|
none: false
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
@@ -47,10 +47,10 @@ dependencies:
|
|
47
47
|
version: '0.9'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
|
-
version_requirements: *
|
50
|
+
version_requirements: *70166886066400
|
51
51
|
- !ruby/object:Gem::Dependency
|
52
52
|
name: hashie
|
53
|
-
requirement: &
|
53
|
+
requirement: &70166886064880 !ruby/object:Gem::Requirement
|
54
54
|
none: false
|
55
55
|
requirements:
|
56
56
|
- - ~>
|
@@ -58,10 +58,10 @@ dependencies:
|
|
58
58
|
version: '1.2'
|
59
59
|
type: :development
|
60
60
|
prerelease: false
|
61
|
-
version_requirements: *
|
61
|
+
version_requirements: *70166886064880
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: rash
|
64
|
-
requirement: &
|
64
|
+
requirement: &70166886062240 !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
@@ -69,10 +69,10 @@ dependencies:
|
|
69
69
|
version: '0.3'
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
|
-
version_requirements: *
|
72
|
+
version_requirements: *70166886062240
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: rspec
|
75
|
-
requirement: &
|
75
|
+
requirement: &70166886080220 !ruby/object:Gem::Requirement
|
76
76
|
none: false
|
77
77
|
requirements:
|
78
78
|
- - ~>
|
@@ -80,10 +80,10 @@ dependencies:
|
|
80
80
|
version: '2.6'
|
81
81
|
type: :development
|
82
82
|
prerelease: false
|
83
|
-
version_requirements: *
|
83
|
+
version_requirements: *70166886080220
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: simple_oauth
|
86
|
-
requirement: &
|
86
|
+
requirement: &70166886078240 !ruby/object:Gem::Requirement
|
87
87
|
none: false
|
88
88
|
requirements:
|
89
89
|
- - ~>
|
@@ -91,10 +91,10 @@ dependencies:
|
|
91
91
|
version: '0.1'
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
|
-
version_requirements: *
|
94
|
+
version_requirements: *70166886078240
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
name: rack-cache
|
97
|
-
requirement: &
|
97
|
+
requirement: &70166886075580 !ruby/object:Gem::Requirement
|
98
98
|
none: false
|
99
99
|
requirements:
|
100
100
|
- - ~>
|
@@ -102,7 +102,7 @@ dependencies:
|
|
102
102
|
version: '1.1'
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
|
-
version_requirements: *
|
105
|
+
version_requirements: *70166886075580
|
106
106
|
description: Various middleware for Faraday
|
107
107
|
email:
|
108
108
|
- sferik@gmail.com
|