Sha256: 0cded9c4ed70ce51200f8e8324bf956eb1e8310c3a6baca251c31e87d58573d3

Contents?: true

Size: 546 Bytes

Versions: 31

Compression:

Stored size: 546 Bytes

Contents

class HTTParty::CookieHash < Hash #:nodoc:

  CLIENT_COOKIES = %w{path expires domain path secure HTTPOnly}

  def add_cookies(value)
    case value
    when Hash
      merge!(value)
    when String
      value.split('; ').each do |cookie|
        array = cookie.split('=')
        self[array[0].to_sym] = array[1]
      end
    else
      raise "add_cookies only takes a Hash or a String"
    end
  end

  def to_cookie_string
    delete_if { |k, v| CLIENT_COOKIES.include?(k.to_s.downcase) }.collect { |k, v| "#{k}=#{v}" }.join("; ")
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
plyom_user-0.3.1 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.3.0 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.2.9 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.2.8 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.2.7 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.2.6 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.2.5 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.2.4 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.2.3 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.2.2 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.2.1 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.2.0 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.1.9 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.1.8 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.1.7 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.1.6 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.1.5 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.1.4 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.1.3 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb
plyom_user-0.1.2 vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb