faraday_middleware 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- faraday_middleware (0.2.0)
4
+ faraday_middleware (0.2.1)
5
5
  faraday (~> 0.5.1)
6
6
 
7
7
  GEM
@@ -15,7 +15,7 @@ GEM
15
15
  hashie (0.4.0)
16
16
  json (1.4.6)
17
17
  multi_json (0.0.4)
18
- multi_xml (0.1.4)
18
+ multi_xml (0.2.0)
19
19
  multipart-post (1.0.1)
20
20
  oauth2 (0.1.0)
21
21
  faraday (~> 0.5.0)
@@ -34,7 +34,7 @@ DEPENDENCIES
34
34
  hashie (~> 0.4)
35
35
  json (~> 1.4)
36
36
  multi_json (~> 0.0)
37
- multi_xml (~> 0.1)
37
+ multi_xml (~> 0.2)
38
38
  oauth2 (~> 0.1)
39
39
  rake (~> 0.8)
40
40
  shoulda (~> 2.11)
@@ -1,28 +1,28 @@
1
- require File.expand_path("../lib/faraday_middleware/version", __FILE__)
1
+ require File.expand_path('../lib/faraday_middleware/version', __FILE__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.add_development_dependency('hashie', '~> 0.4')
5
5
  s.add_development_dependency('json', '~> 1.4')
6
6
  s.add_development_dependency('multi_json', '~> 0.0')
7
- s.add_development_dependency('multi_xml', '~> 0.1')
7
+ s.add_development_dependency('multi_xml', '~> 0.2')
8
8
  s.add_development_dependency('oauth2', '~> 0.1')
9
9
  s.add_development_dependency('rake', '~> 0.8')
10
10
  s.add_development_dependency('shoulda', '~> 2.11')
11
- s.add_development_dependency("test-unit", "~> 2.1")
11
+ s.add_development_dependency('test-unit', '~> 2.1')
12
12
  s.add_runtime_dependency('faraday', '~> 0.5.1')
13
13
  s.authors = ["Wynn Netherland"]
14
14
  s.description = %q{Various middleware for Faraday}
15
15
  s.email = ['wynn.netherland@gmail.com']
16
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
17
17
  s.extra_rdoc_files = ["README.md"]
18
18
  s.files = `git ls-files`.split("\n")
19
19
  s.homepage = 'http://wynnnetherland.com/projects/faraday-middleware/'
20
20
  s.name = 'faraday_middleware'
21
21
  s.platform = Gem::Platform::RUBY
22
- s.rdoc_options = ["--charset=UTF-8"]
23
- s.require_paths = ["lib"]
24
- s.required_rubygems_version = ">= 1.3.6"
25
- s.summary = %q{Various middleware for Faraday}
22
+ s.rdoc_options = ['--charset=UTF-8']
23
+ s.require_paths = ['lib']
24
+ s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if s.respond_to? :required_rubygems_version=
25
+ s.summary = s.description
26
26
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
27
27
  s.version = FaradayMiddleware::VERSION
28
28
  end
@@ -12,18 +12,9 @@ module Faraday
12
12
  response[:body] = begin
13
13
  case response[:response_headers]['content-type']
14
14
  when /application\/json/
15
- case response[:body]
16
- when ''
17
- nil
18
- when 'true'
19
- true
20
- when 'false'
21
- false
22
- else
23
- ::MultiJson.decode(response[:body])
24
- end
15
+ parse_json(response[:body])
25
16
  when /application\/xml/
26
- ::MultiXml.parse(response[:body])
17
+ parse_xml(response[:body])
27
18
  else
28
19
  ''
29
20
  end
@@ -35,5 +26,24 @@ module Faraday
35
26
  super
36
27
  @parser = nil
37
28
  end
29
+
30
+ private
31
+
32
+ def self.parse_json(response_body)
33
+ case response_body
34
+ when ''
35
+ nil
36
+ when 'true'
37
+ true
38
+ when 'false'
39
+ false
40
+ else
41
+ ::MultiJson.decode(response_body)
42
+ end
43
+ end
44
+
45
+ def self.parse_xml(response_body)
46
+ ::MultiXml.parse(response_body)
47
+ end
38
48
  end
39
49
  end
@@ -1,3 +1,3 @@
1
1
  module FaradayMiddleware
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  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
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
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-10-20 00:00:00 -07:00
18
+ date: 2010-10-22 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -71,11 +71,11 @@ dependencies:
71
71
  requirements:
72
72
  - - ~>
73
73
  - !ruby/object:Gem::Version
74
- hash: 9
74
+ hash: 15
75
75
  segments:
76
76
  - 0
77
- - 1
78
- version: "0.1"
77
+ - 2
78
+ version: "0.2"
79
79
  type: :development
80
80
  version_requirements: *id004
81
81
  - !ruby/object:Gem::Dependency