httparty-cookies 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d702f85c0f80242e350b36950258fe6dbd79f3d
4
- data.tar.gz: 58ee468f9ae76497e9388fd05a4ef22ddfcec95b
3
+ metadata.gz: 8adba4b26445366e76b43092c516a96f223f42d7
4
+ data.tar.gz: 564ac260d86d2c4d94aafe797b0c50c3d167c8c6
5
5
  SHA512:
6
- metadata.gz: cd676da6cc0dde07d0683fda2de8cfb36b3ada03afc1b4a2c60adb477d552f747b5ea81ba906f06b2d817fed6839f3e896eff5961dbffb5002195be7f545de91
7
- data.tar.gz: 42e40e2ab26f7faa1feb65b2f8ab340c68f6e573153e8d1d2d18afa7b3b6ae85f79dfbbfe78e390ce337f34476a89dd6d1519c833edec7955c58038e8e55690c
6
+ metadata.gz: f6cd50739f85e35b2b08c485d8504eeffdd94978307b7b5c2da1b0e05ceca6fc126e529317624d2c64b290c3037305e582166e7a70a075ecebfd562715ef6b4c
7
+ data.tar.gz: 591577c02a0a10fa951533cf48aff81ae3438630bcedd3e7cedd84fc546cf46ac572724af6d53bf6aa75a72c8aec2cb3d8a367d40f2cf3e41ddb2ba55b768bd0
@@ -0,0 +1 @@
1
+ require 'httparty/cookies'
@@ -1,19 +1,21 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'httparty'
4
- require 'cookiejar'
4
+ require 'http-cookie'
5
5
 
6
6
  module HTTParty
7
7
  module Cookies
8
8
  def self.included base
9
+ # Include HTTParty first
9
10
  base.send :include, HTTParty
10
11
  base.extend ClassMethods
11
12
  base.send :mattr_inheritable, :cookie_jar
12
- base.instance_variable_set :@cookie_jar, CookieJar::Jar.new
13
+
14
+ # Create a new cookie jar
15
+ base.instance_variable_set :@cookie_jar, HTTP::CookieJar.new
13
16
  end
14
17
 
15
18
  module ClassMethods
16
- private
17
19
  def perform_request http_method, path, options, &block
18
20
  options = default_options.dup.merge options
19
21
 
@@ -22,10 +24,10 @@ module HTTParty
22
24
  response = request.perform(&block)
23
25
 
24
26
  # Read cookies from the headers.
25
- response.headers.get_fields('Set-Cookie').each do |cookie|
27
+ response.headers.get_fields('set-cookie').each do |value|
26
28
  uri = response.uri || response.request.uri
27
29
 
28
- @cookie_jar.set_cookie uri, cookie
30
+ @cookie_jar.parse value, uri
29
31
  end
30
32
 
31
33
  response
@@ -33,7 +35,7 @@ module HTTParty
33
35
 
34
36
  # Add cookies from the cookie jar.
35
37
  def process_cookies request
36
- cookie_header = @cookie_jar.get_cookie_header request.uri
38
+ cookie_header = HTTP::Cookie.cookie_value @cookie_jar.cookies request.uri
37
39
 
38
40
  unless cookie_header.empty?
39
41
  request.options[:headers] ||= {}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httparty-cookies
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikkel Kroman
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: cookiejar
28
+ name: http-cookie
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '>='
@@ -73,6 +73,7 @@ extensions: []
73
73
  extra_rdoc_files: []
74
74
  files:
75
75
  - library/httparty/cookies.rb
76
+ - library/httparty-cookies.rb
76
77
  homepage: https://github.com/mkroman/httparty-cookies
77
78
  licenses:
78
79
  - MIT