lib/spaceship/client.rb in spaceship-0.19.2 vs lib/spaceship/client.rb in spaceship-0.19.3
- old
+ new
@@ -1,10 +1,10 @@
require 'faraday' # HTTP Client
require 'logger'
require 'faraday_middleware'
+require 'faraday-cookie_jar'
require 'spaceship/ui'
-require 'spaceship/helper/cookie_jar_middleware'
require 'spaceship/helper/plist_middleware'
require 'spaceship/helper/net_http_generic_request'
Faraday::Utils.default_params_encoder = Faraday::FlatParamsEncoder
@@ -64,16 +64,16 @@
def self.hostname
raise "You must implemented self.hostname"
end
def initialize
- @cookie_jar = CookieJar::Jar.new
+ @cookie = HTTP::CookieJar.new
@client = Faraday.new(self.class.hostname) do |c|
c.response :json, content_type: /\bjson$/
c.response :xml, content_type: /\bxml$/
c.response :plist, content_type: /\bplist$/
- c.use :cookie_jar, jar: @cookie_jar
+ c.use :cookie_jar, jar: @cookie
c.adapter Faraday.default_adapter
if ENV['DEBUG']
# for debugging only
# This enables tracking of networking requests using Charles Web Proxy
@@ -106,11 +106,10 @@
##
# Return the session cookie.
#
# @return (String) the cookie-string in the RFC6265 format: https://tools.ietf.org/html/rfc6265#section-4.2.1
def cookie
- # this gets the cookie for allowed under the entire apple domain
- @cookie_jar.get_cookie_header('https://apple.com/')
+ @cookie.map(&:to_s).join(';')
end
#####################################################
# @!group Automatic Paging
#####################################################