squash_matrix 1.0.1 → 1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14e559246c6a92e015ce8a76917ebbf825c34ef3cae0694ec1c8a89fb67856b9
4
- data.tar.gz: d5d6347fde23dd27cb1b2ed8eca63ea1c06e9b11f8efaecede84711b708b986f
3
+ metadata.gz: e8c848420ef0f941bdaeb1f28133e3c298961e7fd8a5e7ff9ae0eba5fa9501a3
4
+ data.tar.gz: 84900d15bcfd2498449e5a4427c179a5569ad06414e5550de7d17ec048919baf
5
5
  SHA512:
6
- metadata.gz: d9e4300e547a26cc3d8b9c7dad8226dacb0ac3db4d28a2da8545e4681c68dece3d47cedb378fcb84eeb0742aedc9987840190fea09df769424143af6d4d04323
7
- data.tar.gz: e62b6aaa4ca9561b379f21e9fe6514771dc400734ae67771207f2f8f01d4062e5deec56c95b99a6097d1fd0ef43901f6c46d811393e21302d30339a54f84198c
6
+ metadata.gz: a0148ad96b316a74a9c186864234566755375e95f4903a3f954c0a3478ad251b3151dfe27e4120591546d7c6535873bfb3cc1156b618069b144a2505f8404610
7
+ data.tar.gz: 1e39568edeaa1f761484bd893f9e66cf4ea3c4b99b898a7221c6f6adcd23d5ee0a112e741dfcd81e0168a85d13a30baf28fcb34dc79e0a638e63b2508377b545
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- squash_matrix (1.0.0)
4
+ squash_matrix (1.0.2)
5
5
  http-cookie (~> 1.0, >= 1.0.3)
6
6
  nokogiri (~> 1.8, >= 1.8.4)
7
7
  user-agent-randomizer (~> 0.2)
@@ -70,7 +70,7 @@ module SquashMatrix
70
70
  # @return [Hash] hash object containing club information
71
71
 
72
72
  def get_club_info(id = nil)
73
- return if id.nil?
73
+ return unless id.to_i.positive?
74
74
  uri = URI::HTTP.build(
75
75
  host: SquashMatrix::Constants::SQUASH_MATRIX_URL,
76
76
  path: SquashMatrix::Constants::CLUB_PATH.gsub(':id', id.to_s)
@@ -87,7 +87,7 @@ module SquashMatrix
87
87
  # @return [Array<Hash>] Array of player match results
88
88
 
89
89
  def get_player_results(id = nil)
90
- return if id.nil?
90
+ return unless id.to_i.positive?
91
91
  uri = URI::HTTP.build(
92
92
  host: SquashMatrix::Constants::SQUASH_MATRIX_URL,
93
93
  path: SquashMatrix::Constants::PLAYER_RESULTS_PATH.gsub(':id', id.to_s),
@@ -105,7 +105,7 @@ module SquashMatrix
105
105
  # @return [Hash] hash object containing player information
106
106
 
107
107
  def get_player_info(id = nil)
108
- return if id.nil?
108
+ return unless id.to_i.positive?
109
109
  uri = URI::HTTP.build(
110
110
  host: SquashMatrix::Constants::SQUASH_MATRIX_URL,
111
111
  path: SquashMatrix::Constants::PLAYER_HOME_PATH.gsub(':id', id.to_s)
@@ -124,7 +124,7 @@ module SquashMatrix
124
124
  def get_search_results(query = nil,
125
125
  squash_only: false,
126
126
  racquetball_only: false)
127
- return if query.blank?
127
+ return if query.to_s.empty?
128
128
  uri = URI::HTTP.build(
129
129
  host: SquashMatrix::Constants::SQUASH_MATRIX_URL,
130
130
  path: SquashMatrix::Constants::SEARCH_RESULTS_PATH
@@ -7,7 +7,7 @@ module SquashMatrix
7
7
  PLAYER_RESULTS_PATH = '/Home/PlayerResults/:id'
8
8
  PLAYER_HOME_PATH = '/Home/Player/:id'
9
9
  CLUB_PATH = '/Home/Club/:id'
10
- SEARCH_RESULTS_PATH = '/Home/get_search_results'
10
+ SEARCH_RESULTS_PATH = '/Home/Search'
11
11
  PLAYER_RSULTS_QUERY = 'max=0&X-Requested-With=XMLHttpRequest'
12
12
  SET_COOKIE_HEADER = 'set-cookie'
13
13
  COOKIE_HEADER = 'cookie'
@@ -6,7 +6,7 @@ require_relative 'constants'
6
6
  module SquashMatrix
7
7
  class NokogiriParser
8
8
  class << self
9
- def get_player_rsults(body)
9
+ def get_player_results(body)
10
10
  rtn = Nokogiri::HTML(body)&.xpath('//table[@id="results"]//tbody//tr')&.map do |r|
11
11
  date = r.at_css('td[1]')&.content
12
12
  opponent_id = r.at_css('td[10]//a')&.attribute('href')&.content
@@ -122,7 +122,7 @@ module SquashMatrix
122
122
  name: tr.css('td[1]')&.text,
123
123
  club_name: tr.css('td[2]')&.text
124
124
  }
125
- rtn[:id] = SquashMatrix::Constants::PLAYER_FROM_PATH_REGEX.match(id)[1].to_i if id.present?
125
+ rtn[:id] = SquashMatrix::Constants::PLAYER_FROM_PATH_REGEX.match(id)[1].to_i if id
126
126
  rtn[:rating] = rating.to_f if rating
127
127
  rtn
128
128
  end
@@ -1,3 +1,3 @@
1
1
  module SquashMatrix
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squash_matrix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Wilkosz