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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7888d534af8f1b766ec0bc236fc1268ffd9207944b9b155becdf04c2966732d
4
- data.tar.gz: 474180cb3c145b1b34324d4f7cbb85a6bb626b3d93749ad518a9b0f8e2985898
3
+ metadata.gz: 6d2f63843d67cbf04531f9e5c64d907f541e48649760625dba83600b9536e9fa
4
+ data.tar.gz: 74e267e93a286dd37ea1a7132715400f1d8d268a597f0a4ccfddf840efb60ef8
5
5
  SHA512:
6
- metadata.gz: cd6b71c5d75becfd73d5da79c0dab900f6eb30c40a909bdbc4176bcc66ad6c300b7c10bbc5e27721695e75f5207b7a90ac30a00f52582a4791fd2f7b2dc02dde
7
- data.tar.gz: 42aaae8f774c43f89fadbb592fa4aacdf67294488d027e9c9e2bc81dc179d84fa77a522df5e67ff82e405da55c8bbff5fdf25a03d1c24f41fd80ca29dbbe8778
6
+ metadata.gz: bd897ad52d14b7bbabb1b025875eaca22e650588e29d5d6092c33b5aea824997965ea6f49039c1ee3377190ba5052e408d39d647cb86dd2ebfe5a8ecdf7439fb
7
+ data.tar.gz: 12330be5c850620a7e60e41afb1345cc6956abf9b73c09dbdd87746b6795680505019257a79237885a047f3e38f0394f6d7429acb7cb23e104df93a76bff9b4d
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3.3
4
+ - 2.5.3
5
5
  before_install: gem install bundler -v 1.16.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- squash_matrix (1.0.3)
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.4)
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
 
@@ -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.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') { |http| http.request(req) }
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
@@ -1,3 +1,3 @@
1
1
  module SquashMatrix
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
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.3
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-08-28 00:00:00.000000000 Z
11
+ date: 2018-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler