squash_matrix 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile.lock +2 -2
- data/README.md +7 -0
- data/lib/squash_matrix/client.rb +9 -3
- data/lib/squash_matrix/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d2f63843d67cbf04531f9e5c64d907f541e48649760625dba83600b9536e9fa
|
4
|
+
data.tar.gz: 74e267e93a286dd37ea1a7132715400f1d8d268a597f0a4ccfddf840efb60ef8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd897ad52d14b7bbabb1b025875eaca22e650588e29d5d6092c33b5aea824997965ea6f49039c1ee3377190ba5052e408d39d647cb86dd2ebfe5a8ecdf7439fb
|
7
|
+
data.tar.gz: 12330be5c850620a7e60e41afb1345cc6956abf9b73c09dbdd87746b6795680505019257a79237885a047f3e38f0394f6d7429acb7cb23e104df93a76bff9b4d
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
squash_matrix (1.0.
|
4
|
+
squash_matrix (1.0.4)
|
5
5
|
http-cookie (~> 1.0, >= 1.0.3)
|
6
6
|
nokogiri (~> 1.8, >= 1.8.4)
|
7
7
|
user-agent-randomizer (~> 0.2)
|
@@ -17,7 +17,7 @@ GEM
|
|
17
17
|
domain_name (~> 0.5)
|
18
18
|
method_source (0.8.2)
|
19
19
|
mini_portile2 (2.3.0)
|
20
|
-
nokogiri (1.8.
|
20
|
+
nokogiri (1.8.5)
|
21
21
|
mini_portile2 (~> 2.3.0)
|
22
22
|
pry (0.10.4)
|
23
23
|
coderay (~> 1.1.0)
|
data/README.md
CHANGED
@@ -136,6 +136,13 @@ p => {
|
|
136
136
|
}
|
137
137
|
replica_client = SquashMatrix::Client.new(p)
|
138
138
|
=> SquashMatrix::Client
|
139
|
+
# Don't want to use credentials, use a proxy instead
|
140
|
+
client_behind_proxy = SquashMatrix::Client.new(proxy_addr: '78.186.111.109', proxy_port: 8080)
|
141
|
+
begin
|
142
|
+
(100..1000).each { |i| client_behind_proxy.get_club_info(336) }
|
143
|
+
rescue SquashMatrix::Errors::ForbiddenError => e
|
144
|
+
puts "Time to change proxy address!"
|
145
|
+
end
|
139
146
|
```
|
140
147
|
*Note: in previous example `client` and `replica_client` authentication will expire at `2018-08-25 17:05:04 UTC` and make separate calls for re-authentication and thereafter will have separate instance states*
|
141
148
|
|
data/lib/squash_matrix/client.rb
CHANGED
@@ -28,7 +28,9 @@ module SquashMatrix
|
|
28
28
|
timeout: @timeout,
|
29
29
|
user_agent: @user_agent,
|
30
30
|
cookie: get_cookie_string,
|
31
|
-
expires: @expires.to_s
|
31
|
+
expires: @expires.to_s,
|
32
|
+
proxy_addr: @proxy_addr,
|
33
|
+
proxy_port: @proxy_port
|
32
34
|
}.delete_if { |_k, v| v.nil? }
|
33
35
|
end
|
34
36
|
|
@@ -44,11 +46,15 @@ module SquashMatrix
|
|
44
46
|
timeout: 60,
|
45
47
|
user_agent: nil,
|
46
48
|
cookie: nil,
|
47
|
-
expires: nil
|
49
|
+
expires: nil,
|
50
|
+
proxy_addr: nil,
|
51
|
+
proxy_port: nil)
|
48
52
|
@user_agent = user_agent || UserAgentRandomizer::UserAgent.fetch(type: 'desktop_browser').string
|
49
53
|
@squash_matrix_home_uri = URI::HTTP.build(host: SquashMatrix::Constants::SQUASH_MATRIX_URL)
|
50
54
|
@suppress_errors = suppress_errors
|
51
55
|
@timeout = timeout
|
56
|
+
@proxy_addr = proxy_addr
|
57
|
+
@proxy_port = proxy_port
|
52
58
|
return unless [player || email, password].none?(&:nil?)
|
53
59
|
@cookie_jar = HTTP::CookieJar.new
|
54
60
|
@player = player&.to_i
|
@@ -170,7 +176,7 @@ module SquashMatrix
|
|
170
176
|
set_headers(req, headers: headers)
|
171
177
|
req.set_form(form_data, SquashMatrix::Constants::MULTIPART_FORM_DATA)
|
172
178
|
end
|
173
|
-
res = Net::HTTP.
|
179
|
+
res = Net::HTTP.new(uri.hostname, uri.port, @proxy_addr, @proxy_port&.to_i, use_ssl: uri.scheme == 'https').start { |http| http.request(req) }
|
174
180
|
case res
|
175
181
|
when Net::HTTPSuccess, Net::HTTPFound
|
176
182
|
return success_proc&.call(res) || res
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squash_matrix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Wilkosz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|