squash_matrix 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/squash_matrix/client.rb +2 -2
- data/lib/squash_matrix/nokogiri-parser.rb +4 -1
- 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: c7888d534af8f1b766ec0bc236fc1268ffd9207944b9b155becdf04c2966732d
|
4
|
+
data.tar.gz: 474180cb3c145b1b34324d4f7cbb85a6bb626b3d93749ad518a9b0f8e2985898
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd6b71c5d75becfd73d5da79c0dab900f6eb30c40a909bdbc4176bcc66ad6c300b7c10bbc5e27721695e75f5207b7a90ac30a00f52582a4791fd2f7b2dc02dde
|
7
|
+
data.tar.gz: 42aaae8f774c43f89fadbb592fa4aacdf67294488d027e9c9e2bc81dc179d84fa77a522df5e67ff82e405da55c8bbff5fdf25a03d1c24f41fd80ca29dbbe8778
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -25,6 +25,7 @@ client = SquashMatrix::Client.new(player: 42547, password: "foo")# initialize cl
|
|
25
25
|
=> SquashMatrix::Client
|
26
26
|
client.get_player_info(42547) # retrieve player info for joshua wilkosz #42547
|
27
27
|
=> {
|
28
|
+
:name =>"Joshua Wilkosz"
|
28
29
|
:rating=>"250.202",
|
29
30
|
:clubs=>[
|
30
31
|
{
|
data/lib/squash_matrix/client.rb
CHANGED
@@ -48,7 +48,7 @@ module SquashMatrix
|
|
48
48
|
@user_agent = user_agent || UserAgentRandomizer::UserAgent.fetch(type: 'desktop_browser').string
|
49
49
|
@squash_matrix_home_uri = URI::HTTP.build(host: SquashMatrix::Constants::SQUASH_MATRIX_URL)
|
50
50
|
@suppress_errors = suppress_errors
|
51
|
-
@timeout = timeout
|
51
|
+
@timeout = timeout
|
52
52
|
return unless [player || email, password].none?(&:nil?)
|
53
53
|
@cookie_jar = HTTP::CookieJar.new
|
54
54
|
@player = player&.to_i
|
@@ -145,7 +145,7 @@ module SquashMatrix
|
|
145
145
|
private
|
146
146
|
|
147
147
|
def check_authentication
|
148
|
-
return unless @expires && @cookie_jar && @expires <= Time.now.utc
|
148
|
+
return unless @expires && @cookie_jar && @expires <= (Time.now.utc + @timeout)
|
149
149
|
@cookie_jar = HTTP::CookieJar.new
|
150
150
|
setup_authentication && sleep(5)
|
151
151
|
end
|
@@ -32,7 +32,9 @@ module SquashMatrix
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def get_player_info(body)
|
35
|
-
|
35
|
+
bc = Nokogiri::HTML(body)&.xpath('//div[@id="bodycontent"]')
|
36
|
+
name = bc.children[3].text
|
37
|
+
rows = bc.xpath('//div[@id="Summary"]//table[@id="profile"]//tbody//tr')
|
36
38
|
rating = rows[1]&.css('td[2]')&.text
|
37
39
|
clubs = rows[2]&.css('td[2]')&.css('ul//li')&.map do |c|
|
38
40
|
id = c&.css('a')&.attribute('href')&.text
|
@@ -51,6 +53,7 @@ module SquashMatrix
|
|
51
53
|
rtn
|
52
54
|
end
|
53
55
|
{
|
56
|
+
name: name,
|
54
57
|
rating: rating,
|
55
58
|
clubs: clubs,
|
56
59
|
teams: teams
|
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.3
|
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-
|
11
|
+
date: 2018-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|