phantom_client 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/phantom_client CHANGED
@@ -25,5 +25,5 @@ if url == nil
25
25
  return
26
26
  end
27
27
 
28
- client = PhantomJSProxy::PhantomJSClient.new(proxy_list, PhantomJSProxy::PhantomJSClientConnection.new, hmac_key)
28
+ client = PhantomJSProxy::PhantomJSClient.new(proxy_list, hmac_key, PhantomJSProxy::PhantomJSClientConnection.new)
29
29
  puts client.get_body(url, {:imageOnly => false, :withIframes => true})
@@ -16,7 +16,7 @@ module PhantomJSProxy
16
16
  attr_accessor :hmac
17
17
  attr_accessor :hmac_activated
18
18
 
19
- def initialize(addr_list=[], con = PhantomJSClientConnection.new, key=nil)
19
+ def initialize(addr_list=[], key=nil, con = PhantomJSClientConnection.new)
20
20
  @proxy_list = addr_list
21
21
  @connection = con
22
22
  @hmac_activated = key ? true : false
@@ -47,10 +47,7 @@ module PhantomJSProxy
47
47
  end
48
48
 
49
49
  if hmac_activated
50
- t = Time.now
51
- req['Hmac-Key'] = hmac.update(addr+t.to_s).hexdigest
52
- req['Hmac-Time'] = t
53
- puts "Encode: #{addr} to #{req['Hmac-Key']}"
50
+ update_hmac_head addr, req, hmac
54
51
  end
55
52
  #::Proxy(@proxy_addr, @proxy_port)
56
53
 
@@ -62,6 +59,14 @@ module PhantomJSProxy
62
59
  #end
63
60
  do_get(url, req, 10)
64
61
  end
62
+
63
+ private
64
+ def update_hmac_head(addr, req, hmac_keygen)
65
+ t = Time.now
66
+ req['Hmac-Key'] = hmac_keygen.update(addr+t.to_s).hexdigest
67
+ req['Hmac-Time'] = t
68
+ puts "Encode: #{addr} to #{req['Hmac-Key']}"
69
+ end
65
70
 
66
71
  def do_get(url, req, count)
67
72
  element = get_proxy()
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phantom_client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 1.1.0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Sudmann
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-02 00:00:00 +02:00
18
+ date: 2012-05-09 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency