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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8c848420ef0f941bdaeb1f28133e3c298961e7fd8a5e7ff9ae0eba5fa9501a3
4
- data.tar.gz: 84900d15bcfd2498449e5a4427c179a5569ad06414e5550de7d17ec048919baf
3
+ metadata.gz: c7888d534af8f1b766ec0bc236fc1268ffd9207944b9b155becdf04c2966732d
4
+ data.tar.gz: 474180cb3c145b1b34324d4f7cbb85a6bb626b3d93749ad518a9b0f8e2985898
5
5
  SHA512:
6
- metadata.gz: a0148ad96b316a74a9c186864234566755375e95f4903a3f954c0a3478ad251b3151dfe27e4120591546d7c6535873bfb3cc1156b618069b144a2505f8404610
7
- data.tar.gz: 1e39568edeaa1f761484bd893f9e66cf4ea3c4b99b898a7221c6f6adcd23d5ee0a112e741dfcd81e0168a85d13a30baf28fcb34dc79e0a638e63b2508377b545
6
+ metadata.gz: cd6b71c5d75becfd73d5da79c0dab900f6eb30c40a909bdbc4176bcc66ad6c300b7c10bbc5e27721695e75f5207b7a90ac30a00f52582a4791fd2f7b2dc02dde
7
+ data.tar.gz: 42aaae8f774c43f89fadbb592fa4aacdf67294488d027e9c9e2bc81dc179d84fa77a522df5e67ff82e405da55c8bbff5fdf25a03d1c24f41fd80ca29dbbe8778
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- squash_matrix (1.0.2)
4
+ squash_matrix (1.0.3)
5
5
  http-cookie (~> 1.0, >= 1.0.3)
6
6
  nokogiri (~> 1.8, >= 1.8.4)
7
7
  user-agent-randomizer (~> 0.2)
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
  {
@@ -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&.to_i
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
- rows = Nokogiri::HTML(body)&.xpath('//table[@id="profile"]//tbody//tr')
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
@@ -1,3 +1,3 @@
1
1
  module SquashMatrix
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
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.2
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-24 00:00:00.000000000 Z
11
+ date: 2018-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler