gillbus 0.18.13 → 0.18.14

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: 5b6eb7557d8bbbe297d8f391d4f0ba1a43f99c25
4
- data.tar.gz: a72bdec0416f4297fc1772da1dd508def568bdb7
3
+ metadata.gz: 3a7314c8cf6fe9167342a9fa5afa2a79f3c9d9d4
4
+ data.tar.gz: 41d2a8dcf95cbc8826e6e67d1718cc612b287b8e
5
5
  SHA512:
6
- metadata.gz: cb087d9f1d2ed195fa76b9eb065f2dcaf1701690525ddcf15c714d6c43cdee9934a2269ae00498f91c1dadc45763faeda388df6133c4421e5cfdab6cbaa0a167
7
- data.tar.gz: 7945e1bcad7972a706f0bb0614e0ba19a961273941020624a2945120ca5b943d28f745591f8ec7174f3cecf531105147339df0b9dd11f82f23fe5f4afa00c55c
6
+ metadata.gz: 044121e759ccbcd4d07a6ae1af71dc63fbea7b5c811e2bed2742c00e6cbef5f075c2f9c6949340dd10925711c63fd3a0b9b2dc54779f213c6ff5dbc615deb521
7
+ data.tar.gz: f656e036e42f486ed88cf5a1e690860c6b7eb163325a9f2d7be0360f1f8c6ec2876a5467658ea9b20d1f71d0c616c349ef0a1ba88079eb131d369f814ed6a7bb
data/lib/gillbus.rb CHANGED
@@ -26,7 +26,7 @@ class Gillbus
26
26
  response_class = klass::Response
27
27
  request = request_class.new(*args)
28
28
  headers = {}
29
- headers['Cookie'] = "JSESSIONID=#{session_id}" if session_id
29
+ headers['Cookie'] = self.class.make_cookies(session_id) if session_id
30
30
  headers['Accept-Encoding'] = 'gzip'
31
31
  request_time_start = Time.now
32
32
  http_response = driver.public_send(request.method, request.path, request.params, headers)
@@ -34,8 +34,7 @@ class Gillbus
34
34
  result = response_class.parse_string(http_response.body.force_encoding('utf-8'), timezone: timezone)
35
35
  cookie_string = http_response.headers['Set-Cookie']
36
36
  if cookie_string
37
- returned_session_id = CGI::Cookie.parse(cookie_string)['JSESSIONID'].first
38
- self.session_id = returned_session_id
37
+ self.session_id = self.class.make_session_id(CGI::Cookie.parse(cookie_string))
39
38
  end
40
39
  result.session_id = session_id
41
40
  result.request_time = request_time_end - request_time_start
@@ -43,6 +42,25 @@ class Gillbus
43
42
  end
44
43
  end
45
44
 
45
+ def self.make_cookies(session_id)
46
+ if session_id.include?('|')
47
+ session_id, gclb = session_id.split('|')
48
+ "JSESSIONID=#{session_id}; GCLB=#{gclb}"
49
+ else
50
+ "JSESSIONID=#{session_id}"
51
+ end
52
+ end
53
+
54
+ def self.make_session_id(parsed_cookies)
55
+ gclb = parsed_cookies['GCLB'].first
56
+ session_id = parsed_cookies['JSESSIONID'].first
57
+ if gclb.present?
58
+ [session_id, gclb].join('|')
59
+ else
60
+ session_id
61
+ end
62
+ end
63
+
46
64
  require 'monetize'
47
65
  require 'gillbus/helpers/fields'
48
66
  require 'gillbus/helpers/update_attrs'
@@ -1,3 +1,3 @@
1
1
  class Gillbus
2
- VERSION = '0.18.13'.freeze
2
+ VERSION = '0.18.14'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gillbus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.13
4
+ version: 0.18.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey "codesnik" Trofimenko
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-10-16 00:00:00.000000000 Z
12
+ date: 2019-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport