faraday-cookie_jar 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
+ ## 0.0.3 Sun Apr 21 08:14:32 CST 2013
2
+
3
+ - Switch to http-cookie gem (knu) #2
4
+
1
5
  ## 0.0.2
2
6
 
3
7
  - Repackaging
4
- - Typo in README
8
+ - Typo in README (tmaesaka) #1
5
9
 
6
10
  ## 0.0.1
7
11
 
data/README.md CHANGED
@@ -4,7 +4,7 @@ Faraday middleware to manage client-side cookies
4
4
 
5
5
  ## Description
6
6
 
7
- This gem is a piece of Faraday middleware that adds client-side Cookies management, using [cookiejar gem](https://github.com/dwaite/cookiejar).
7
+ This gem is a piece of Faraday middleware that adds client-side Cookies management, using [http-cookie gem](https://github.com/sparklemotion/http-cookie).
8
8
 
9
9
  ## Installation
10
10
 
data/Rakefile CHANGED
@@ -1 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "faraday", ">= 0.7.4"
22
- spec.add_dependency "cookiejar"
22
+ spec.add_dependency "http-cookie", "~> 1.0.0"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
25
25
  spec.add_development_dependency "rake"
@@ -1,21 +1,23 @@
1
1
  require "faraday"
2
- require "cookiejar"
2
+ require "http/cookie_jar"
3
3
 
4
4
  module Faraday
5
5
  class CookieJar < Faraday::Middleware
6
6
  def initialize(app, options = {})
7
7
  super(app)
8
- @jar = ::CookieJar::Jar.new
8
+ @jar = HTTP::CookieJar.new
9
9
  end
10
10
 
11
11
  def call(env)
12
- cookie = @jar.get_cookie_header(env[:url])
13
- unless cookie.empty?
14
- env[:request_headers]["Cookie"] = cookie
12
+ cookies = @jar.cookies(env[:url])
13
+ unless cookies.empty?
14
+ env[:request_headers]["Cookie"] = HTTP::Cookie.cookie_value(cookies)
15
15
  end
16
16
 
17
17
  @app.call(env).on_complete do |res|
18
- @jar.set_cookies_from_headers(env[:url], res[:response_headers])
18
+ if set_cookie = res[:response_headers]["Set-Cookie"]
19
+ @jar.parse(set_cookie, env[:url])
20
+ end
19
21
  end
20
22
  end
21
23
  end
@@ -1,5 +1,5 @@
1
1
  module Faraday
2
2
  module CookieJarVersion
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-cookie_jar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-11 00:00:00.000000000 Z
12
+ date: 2013-04-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -28,21 +28,21 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: 0.7.4
30
30
  - !ruby/object:Gem::Dependency
31
- name: cookiejar
31
+ name: http-cookie
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ! '>='
35
+ - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 1.0.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ! '>='
43
+ - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '0'
45
+ version: 1.0.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: bundler
48
48
  requirement: !ruby/object:Gem::Requirement