ahl_scraper 0.1.1

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.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +85 -0
  5. data/.ruby-version +1 -0
  6. data/.solargraph.yml +15 -0
  7. data/.travis.yml +6 -0
  8. data/.vscode/settings.json +11 -0
  9. data/CODE_OF_CONDUCT.md +74 -0
  10. data/Gemfile +25 -0
  11. data/Gemfile.lock +114 -0
  12. data/LICENSE.txt +21 -0
  13. data/README.md +235 -0
  14. data/Rakefile +8 -0
  15. data/ahl_scraper.gemspec +27 -0
  16. data/bin/console +16 -0
  17. data/bin/setup +8 -0
  18. data/lib/ahl_scraper.rb +55 -0
  19. data/lib/ahl_scraper/fetchers/division_data_fetcher.rb +19 -0
  20. data/lib/ahl_scraper/fetchers/game_data_fetcher.rb +29 -0
  21. data/lib/ahl_scraper/fetchers/game_event_data_fetcher.rb +19 -0
  22. data/lib/ahl_scraper/fetchers/player_data_fetcher.rb +25 -0
  23. data/lib/ahl_scraper/fetchers/player_games/data_fetcher.rb +30 -0
  24. data/lib/ahl_scraper/fetchers/playoff_bracket_data_fetcher.rb +19 -0
  25. data/lib/ahl_scraper/fetchers/season_data_fetcher.rb +15 -0
  26. data/lib/ahl_scraper/fetchers/season_end_date_fetcher.rb +34 -0
  27. data/lib/ahl_scraper/fetchers/season_game_ids_fetcher.rb +21 -0
  28. data/lib/ahl_scraper/fetchers/season_start_date_fetcher.rb +30 -0
  29. data/lib/ahl_scraper/fetchers/season_type_fetcher.rb +33 -0
  30. data/lib/ahl_scraper/fetchers/team_data_fetcher.rb +19 -0
  31. data/lib/ahl_scraper/fetchers/team_games/data_fetcher.rb +22 -0
  32. data/lib/ahl_scraper/fetchers/team_roster_data_fetcher.rb +67 -0
  33. data/lib/ahl_scraper/fixed_games/1001050.json +2182 -0
  34. data/lib/ahl_scraper/fixed_games/1018774.json +2573 -0
  35. data/lib/ahl_scraper/fixed_games/1020527.json +2483 -0
  36. data/lib/ahl_scraper/games.rb +46 -0
  37. data/lib/ahl_scraper/games/events.rb +8 -0
  38. data/lib/ahl_scraper/helpers/birthdate_helper.rb +27 -0
  39. data/lib/ahl_scraper/helpers/elapsed_time_helper.rb +24 -0
  40. data/lib/ahl_scraper/helpers/ice_time_helper.rb +18 -0
  41. data/lib/ahl_scraper/helpers/parameterize_helper.rb +35 -0
  42. data/lib/ahl_scraper/helpers/period_time_helper.rb +25 -0
  43. data/lib/ahl_scraper/helpers/season_dates_helper.rb +14 -0
  44. data/lib/ahl_scraper/player_games.rb +19 -0
  45. data/lib/ahl_scraper/players.rb +12 -0
  46. data/lib/ahl_scraper/playoff_brackets.rb +17 -0
  47. data/lib/ahl_scraper/resource.rb +38 -0
  48. data/lib/ahl_scraper/resources/game.rb +373 -0
  49. data/lib/ahl_scraper/resources/game_list_item.rb +57 -0
  50. data/lib/ahl_scraper/resources/games/coach.rb +23 -0
  51. data/lib/ahl_scraper/resources/games/events/shot.rb +10 -0
  52. data/lib/ahl_scraper/resources/games/goal.rb +161 -0
  53. data/lib/ahl_scraper/resources/games/goalie.rb +106 -0
  54. data/lib/ahl_scraper/resources/games/info.rb +83 -0
  55. data/lib/ahl_scraper/resources/games/on_ice_skater.rb +35 -0
  56. data/lib/ahl_scraper/resources/games/overtime.rb +48 -0
  57. data/lib/ahl_scraper/resources/games/penalty.rb +101 -0
  58. data/lib/ahl_scraper/resources/games/penalty_shot.rb +82 -0
  59. data/lib/ahl_scraper/resources/games/period.rb +31 -0
  60. data/lib/ahl_scraper/resources/games/referee.rb +23 -0
  61. data/lib/ahl_scraper/resources/games/shootout_attempt.rb +61 -0
  62. data/lib/ahl_scraper/resources/games/skater.rb +94 -0
  63. data/lib/ahl_scraper/resources/games/star.rb +47 -0
  64. data/lib/ahl_scraper/resources/games/team.rb +85 -0
  65. data/lib/ahl_scraper/resources/goalie_game_list_item.rb +69 -0
  66. data/lib/ahl_scraper/resources/player.rb +71 -0
  67. data/lib/ahl_scraper/resources/playoff_bracket.rb +21 -0
  68. data/lib/ahl_scraper/resources/playoff_brackets/game.rb +43 -0
  69. data/lib/ahl_scraper/resources/playoff_brackets/round.rb +31 -0
  70. data/lib/ahl_scraper/resources/playoff_brackets/series.rb +73 -0
  71. data/lib/ahl_scraper/resources/playoff_brackets/team.rb +39 -0
  72. data/lib/ahl_scraper/resources/roster_player.rb +71 -0
  73. data/lib/ahl_scraper/resources/season.rb +93 -0
  74. data/lib/ahl_scraper/resources/season_list_item.rb +30 -0
  75. data/lib/ahl_scraper/resources/seasons/team.rb +77 -0
  76. data/lib/ahl_scraper/resources/skater_game_list_item.rb +65 -0
  77. data/lib/ahl_scraper/resources/team_game_list_item.rb +64 -0
  78. data/lib/ahl_scraper/resources/team_list_item.rb +20 -0
  79. data/lib/ahl_scraper/roster_players.rb +11 -0
  80. data/lib/ahl_scraper/seasons.rb +31 -0
  81. data/lib/ahl_scraper/services/games/create_skaters_service.rb +72 -0
  82. data/lib/ahl_scraper/services/games/on_ice_statlines_service.rb +117 -0
  83. data/lib/ahl_scraper/services/games/penalty_shot_statlines_service.rb +38 -0
  84. data/lib/ahl_scraper/services/games/penalty_shots_service.rb +30 -0
  85. data/lib/ahl_scraper/services/games/penalty_statlines_service.rb +62 -0
  86. data/lib/ahl_scraper/services/games/scoring_statlines_service.rb +115 -0
  87. data/lib/ahl_scraper/services/games/shootout_statlines_service.rb +42 -0
  88. data/lib/ahl_scraper/services/games/team_on_ice_goals_service.rb +152 -0
  89. data/lib/ahl_scraper/services/games/time_splits_service.rb +70 -0
  90. data/lib/ahl_scraper/services/seasons/teams_service.rb +20 -0
  91. data/lib/ahl_scraper/team_games.rb +17 -0
  92. data/lib/ahl_scraper/teams.rb +11 -0
  93. data/lib/ahl_scraper/version.rb +5 -0
  94. metadata +138 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f6e565f0a3b14eb3c5d568b3012407bbcb3439dc4d1447938e6f4c2618ebf65f
4
+ data.tar.gz: ff93eaf9c4ae5fd738f2445ab2644162411679a07b00912e5bde5a35a31079e5
5
+ SHA512:
6
+ metadata.gz: 34b7c1208b927e5801670427ee12642e86d31ff078463ba188ff5a31e431b5c6e7ea65d9705371c7a87dc77a1b7f2b13e37992a156494e0e2b73372accc00b9d
7
+ data.tar.gz: 48f9dfc8a50cc7dcf5cf7be3944eb965f14e34d3d991e65163a9f030894a29015bcab485214488178bce2a4bcccf904253d9c2b7132e1c8230cd8bec6974df88
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .byebug_history
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,85 @@
1
+ Metrics/AbcSize:
2
+ Max: 51
3
+
4
+ Metrics/CyclomaticComplexity:
5
+ Max: 15
6
+
7
+ Metrics/ParameterLists:
8
+ Max: 7
9
+
10
+ Metrics/PerceivedComplexity:
11
+ Max: 17
12
+
13
+ Style/Documentation:
14
+ Enabled: false
15
+
16
+ AllCops:
17
+ DisplayCopNames: true
18
+ TargetRubyVersion: 2.7
19
+
20
+ Layout/ArgumentAlignment:
21
+ EnforcedStyle: with_fixed_indentation
22
+
23
+ Layout/CaseIndentation:
24
+ EnforcedStyle: end
25
+
26
+ Layout/FirstArrayElementIndentation:
27
+ EnforcedStyle: consistent
28
+
29
+ Layout/FirstHashElementIndentation:
30
+ EnforcedStyle: consistent
31
+
32
+ Layout/HeredocIndentation:
33
+ Enabled: false
34
+
35
+ Layout/LineLength:
36
+ Max: 150
37
+ Exclude:
38
+ - "lib/stripe/resources/**/*.rb"
39
+ - "spec/**/*.rb"
40
+
41
+ Metrics/BlockLength:
42
+ Max: 40
43
+ Exclude:
44
+ - "spec/**/*.rb"
45
+
46
+ Metrics/ClassLength:
47
+ Max: 125
48
+ Exclude:
49
+ - "spec/**/*.rb"
50
+
51
+ Metrics/MethodLength:
52
+ Max: 55
53
+
54
+ Metrics/ModuleLength:
55
+ Enabled: false
56
+
57
+ Style/FrozenStringLiteralComment:
58
+ EnforcedStyle: always
59
+
60
+ Style/HashEachMethods:
61
+ Enabled: true
62
+
63
+ Style/HashTransformKeys:
64
+ Enabled: true
65
+
66
+ Style/HashTransformValues:
67
+ Enabled: true
68
+
69
+ Style/NumericPredicate:
70
+ Enabled: false
71
+
72
+ Style/StringLiterals:
73
+ EnforcedStyle: double_quotes
74
+
75
+ Style/TrailingCommaInArrayLiteral:
76
+ EnforcedStyleForMultiline: consistent_comma
77
+
78
+ Style/TrailingCommaInHashLiteral:
79
+ EnforcedStyleForMultiline: consistent_comma
80
+
81
+ Layout/MultilineMethodCallIndentation:
82
+ EnforcedStyle: indented
83
+
84
+ Layout/MultilineAssignmentLayout:
85
+ EnforcedStyle: new_line
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.7.2
data/.solargraph.yml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ include:
3
+ - "**/*.rb"
4
+ exclude:
5
+ - spec/**/*
6
+ - test/**/*
7
+ - vendor/**/*
8
+ - ".bundle/**/*"
9
+ require: []
10
+ domains: []
11
+ reporters:
12
+ - rubocop
13
+ require_paths: []
14
+ plugins: []
15
+ max_files: 5000
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.1
6
+ before_install: gem install bundler -v 2.1.4
@@ -0,0 +1,11 @@
1
+ {
2
+ "solargraph.autoformat": true,
3
+ "solargraph.completion": true,
4
+ "solargraph.formatting": true,
5
+ "solargraph.diagnostics": true,
6
+ "[ruby]": {
7
+ "editor.insertSpaces": true,
8
+ "editor.formatOnSave": true,
9
+ "editor.tabSize": 2
10
+ }
11
+ }
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ - Using welcoming and inclusive language
18
+ - Being respectful of differing viewpoints and experiences
19
+ - Gracefully accepting constructive criticism
20
+ - Focusing on what is best for the community
21
+ - Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ - The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ - Trolling, insulting/derogatory comments, and personal or political attacks
28
+ - Public or private harassment
29
+ - Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ - Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ahltracker@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in ahl_scraper.gemspec
6
+ gemspec
7
+
8
+ gem "json"
9
+ gem "nokogiri"
10
+ gem "rake", "~> 12.0"
11
+
12
+ group :development do
13
+ gem "rubocop", "~> 0.89.0", require: false
14
+ gem "rubocop-performance", "~> 1.8.1", require: false
15
+ gem "solargraph"
16
+ end
17
+
18
+ group :development, :test do
19
+ gem "byebug"
20
+ gem "pry"
21
+ gem "pry-byebug"
22
+ gem "rspec", "~> 3.0"
23
+ gem "vcr"
24
+ gem "webmock", ">= 3.8.0"
25
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,114 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ahl_scraper (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.7.0)
10
+ public_suffix (>= 2.0.2, < 5.0)
11
+ ast (2.4.1)
12
+ backport (1.1.2)
13
+ benchmark (0.1.0)
14
+ byebug (11.1.3)
15
+ coderay (1.1.3)
16
+ crack (0.4.4)
17
+ diff-lcs (1.4.4)
18
+ e2mmap (0.1.0)
19
+ hashdiff (1.0.1)
20
+ jaro_winkler (1.5.4)
21
+ json (2.3.1)
22
+ maruku (0.7.3)
23
+ method_source (1.0.0)
24
+ mini_portile2 (2.4.0)
25
+ nokogiri (1.10.10)
26
+ mini_portile2 (~> 2.4.0)
27
+ parallel (1.20.1)
28
+ parser (2.7.2.0)
29
+ ast (~> 2.4.1)
30
+ pry (0.13.1)
31
+ coderay (~> 1.1)
32
+ method_source (~> 1.0)
33
+ pry-byebug (3.9.0)
34
+ byebug (~> 11.0)
35
+ pry (~> 0.13.0)
36
+ public_suffix (4.0.6)
37
+ rainbow (3.0.0)
38
+ rake (12.3.3)
39
+ regexp_parser (2.0.0)
40
+ reverse_markdown (2.0.0)
41
+ nokogiri
42
+ rexml (3.2.4)
43
+ rspec (3.10.0)
44
+ rspec-core (~> 3.10.0)
45
+ rspec-expectations (~> 3.10.0)
46
+ rspec-mocks (~> 3.10.0)
47
+ rspec-core (3.10.0)
48
+ rspec-support (~> 3.10.0)
49
+ rspec-expectations (3.10.0)
50
+ diff-lcs (>= 1.2.0, < 2.0)
51
+ rspec-support (~> 3.10.0)
52
+ rspec-mocks (3.10.0)
53
+ diff-lcs (>= 1.2.0, < 2.0)
54
+ rspec-support (~> 3.10.0)
55
+ rspec-support (3.10.0)
56
+ rubocop (0.89.1)
57
+ parallel (~> 1.10)
58
+ parser (>= 2.7.1.1)
59
+ rainbow (>= 2.2.2, < 4.0)
60
+ regexp_parser (>= 1.7)
61
+ rexml
62
+ rubocop-ast (>= 0.3.0, < 1.0)
63
+ ruby-progressbar (~> 1.7)
64
+ unicode-display_width (>= 1.4.0, < 2.0)
65
+ rubocop-ast (0.8.0)
66
+ parser (>= 2.7.1.5)
67
+ rubocop-performance (1.8.1)
68
+ rubocop (>= 0.87.0)
69
+ rubocop-ast (>= 0.4.0)
70
+ ruby-progressbar (1.10.1)
71
+ solargraph (0.39.17)
72
+ backport (~> 1.1)
73
+ benchmark
74
+ bundler (>= 1.17.2)
75
+ e2mmap
76
+ jaro_winkler (~> 1.5)
77
+ maruku (~> 0.7, >= 0.7.3)
78
+ nokogiri (~> 1.9, >= 1.9.1)
79
+ parser (~> 2.3)
80
+ reverse_markdown (>= 1.0.5, < 3)
81
+ rubocop (~> 0.52)
82
+ thor (~> 1.0)
83
+ tilt (~> 2.0)
84
+ yard (~> 0.9, >= 0.9.24)
85
+ thor (1.0.1)
86
+ tilt (2.0.10)
87
+ unicode-display_width (1.7.0)
88
+ vcr (6.0.0)
89
+ webmock (3.10.0)
90
+ addressable (>= 2.3.6)
91
+ crack (>= 0.3.2)
92
+ hashdiff (>= 0.4.0, < 2.0.0)
93
+ yard (0.9.25)
94
+
95
+ PLATFORMS
96
+ ruby
97
+
98
+ DEPENDENCIES
99
+ ahl_scraper!
100
+ byebug
101
+ json
102
+ nokogiri
103
+ pry
104
+ pry-byebug
105
+ rake (~> 12.0)
106
+ rspec (~> 3.0)
107
+ rubocop (~> 0.89.0)
108
+ rubocop-performance (~> 1.8.1)
109
+ solargraph
110
+ vcr
111
+ webmock (>= 3.8.0)
112
+
113
+ BUNDLED WITH
114
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 jefftcraig
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,235 @@
1
+ # AhlScraper
2
+
3
+ This gem scrapes the AHL website for team, game, playoff bracket, player, or season data and returns it to you in an easy to use format.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ahl_scraper'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install ahl_scraper
20
+
21
+ ## Requirements
22
+
23
+ - Ruby 2.7+
24
+
25
+ ## Documentation
26
+
27
+ Check out the [Wiki page](https://github.com/notnotjeff/ahl_scraper/wiki) for additional documentation.
28
+
29
+ ## Usage
30
+
31
+ This gem is divided into multiple modules that provide you with an assortment of methods to access data from the AHL website:
32
+
33
+ - [Seasons](#seasons)
34
+ - `list`
35
+ - `retrieve`
36
+ - `retrieve_all`
37
+ - [Games](#games)
38
+ - `list`
39
+ - `retrieve`
40
+ - [Players](#players)
41
+ - `retrieve`
42
+ - [Teams](#teams)
43
+ - `list`
44
+ - [PlayoffBrackets](#playoffbrackets)
45
+ - `retrieve`
46
+ - [RosterPlayers](#rosterplayers)
47
+ - `retrieve_all`
48
+ - [PlayerGames](#playergames)
49
+ - `list`
50
+ - [TeamGames](#teamgames)
51
+ - `list`
52
+
53
+ ### Seasons
54
+
55
+ #### list
56
+
57
+ Returns a list of all seasons as an array of `SeasonListItem` objects:
58
+
59
+ ```ruby
60
+ require "ahl_scraper"
61
+ AhlScraper::Seasons.list
62
+
63
+ #=> [#<SeasonListItem:0x3c3c {:id=>72, :season_type=>:playoffs, :name=>"2021 Playoffs"}>,
64
+ #<SeasonListItem:0x3c50 {:id=>68, :season_type=>:regular, :name=>"2020-21 Regular Season"}>,
65
+ #<SeasonListItem:0x3c64 {:id=>67, :season_type=>:all_star, :name=>"2020 All-Star Challenge"}>,
66
+ #<SeasonListItem:0x3c78 {:id=>65, :season_type=>:regular, :name=>"2019-20 Regular Season"}>,
67
+ # ...
68
+ #]
69
+ ```
70
+
71
+ #### retrieve(season_id)
72
+
73
+ Returns a `Season` object which has full details on a single season by passing in the season id:
74
+
75
+ ```ruby
76
+ require "ahl_scraper"
77
+ AhlScraper::Seasons.retrieve(68)
78
+
79
+ #=> #<Season:0x4b28 {:id=>68, :season_type=>:regular, :start_year=>2020, :end_year=>2021, :start_date=>"Mon, Feb 1 2020", :end_date=>"Sat, Jun 8 2021", ... >
80
+ ```
81
+
82
+ #### retrieve_all
83
+
84
+ Get an array of `Season` objects with full details on each season:
85
+
86
+ ```ruby
87
+ require "ahl_scraper"
88
+ AhlScraper::Seasons.retrieve_all
89
+
90
+ #=> [#<Season:0x4b28>, #<Season:0x9k34>, #<Season:0x2a23> ...]
91
+ ```
92
+
93
+ ### Games
94
+
95
+ #### list(season_id)
96
+
97
+ Returns a list of `GameListItem` objects for all games in a season by passing in the season id:
98
+
99
+ ```ruby
100
+ require "ahl_scraper"
101
+ AhlScraper::Games.list(68)
102
+
103
+ #=> [#<GameListItem:0x4100 {:date=>"Fri, Feb 5", :id=>1022050, :status=>"Final", :game_sheet_url=>"https://lscluster.hockeytech.com/game_reports/official-game-report.php?client_code=ahl&game_id=1022050&lang_id=1", :game_center_url=>"https://theahl.com/stats/game-center/1022050", :home_team_city=>"Providence", :home_team_score=>4, :home_team_id=>309, :away_team_city=>"Bridgeport", :away_team_score=>1, :away_team_id=>317, :game_report_url=>"https://lscluster.hockeytech.com/game_reports/text-game-report.php?client_code=ahl&game_id=1022050&lang_id=1"}>,
104
+ #<GameListItem:0x4114 {:date=>"Fri, Feb 5", :id=>1022051, :status=>"Final", :game_sheet_url=>"https://lscluster.hockeytech.com/game_reports/official-game-report.php?client_code=ahl&game_id=1022051&lang_id=1", :game_center_url=>"https://theahl.com/stats/game-center/1022051", :home_team_city=>"Rochester", :home_team_score=>2, :home_team_id=>323, :away_team_city=>"Utica", :away_team_score=>3, :away_team_id=>390, :game_report_url=>"https://lscluster.hockeytech.com/game_reports/text-game-report.php?client_code=ahl&game_id=1022051&lang_id=1"}>,
105
+ #...
106
+ #]
107
+ ```
108
+
109
+ #### retrieve(game_id)
110
+
111
+ Get a `Game` object which has full details on a single game by passing in a game id:
112
+
113
+ ```ruby
114
+ require "ahl_scraper"
115
+ AhlScraper::Games.retrieve(1022050)
116
+
117
+ #=> #<Game:0x4d6c {:game_id=>1022050, :season_type=>:regular, :info=>#<Info:0x4d80 {:date=>"Friday, February 05, 2021", :name=>"BRI @ PRO", :id=>1022050, :end_time=>"3:15 pm", ... >
118
+ ```
119
+
120
+ You can also pass in a `season_type` symbol (`:regular`, `:all_star`, `:exhibition`, or `:playoffs`) as the second parameter to skip an additional HTTP request being made by the scraper in order to fetch it:
121
+
122
+ ```ruby
123
+ require "ahl_scraper"
124
+ AhlScraper::Games.retrieve(1022050, :regular)
125
+
126
+ #=> #<Game:0x4d6c {:game_id=>1022050, :season_type=>:regular, :info=>#<Info:0x4d80 {:date=>"Friday, February 05, 2021", :name=>"BRI @ PRO", :id=>1022050, :end_time=>"3:15 pm", ... >
127
+ ```
128
+
129
+ ### Players
130
+
131
+ #### retrieve(player_id)
132
+
133
+ Returns a `Player` object which has full details on a player by passing their id:
134
+
135
+ ```ruby
136
+ require "ahl_scraper"
137
+ AhlScraper::Players.retrieve(6845)
138
+
139
+ #=> #<Player:0x4b8c {:id=>6845, :current_age=>0.2534e2, :position=>"D", :first_name=>"Sebastian", :shoots=>"L", :last_name=>"Aho", :birthplace=>"Umea, Sweden", :height=>"5-11", :birthdate=>"1996-02-17", :draft_year=>2014, :weight=>177, :catches=>"R", :name=>"Sebastian Aho", :jersey_number=>28}>
140
+ ```
141
+
142
+ ### Teams
143
+
144
+ #### list(season_id)
145
+
146
+ Returns a list of `TeamListItem` objects for every team in a season by passing the season id:
147
+
148
+ ```ruby
149
+ require "ahl_scraper"
150
+ AhlScraper::Teams.list(68)
151
+
152
+ #=> [#<TeamListItem:0x4ba0 {:id=>309, :name=>"y - Providence Bruins", :season_id=>68}>,
153
+ #<TeamListItem:0x4bb4 {:id=>307, :name=>"Hartford Wolf Pack", :season_id=>68}>,
154
+ #<TeamListItem:0x4bc8 {:id=>317, :name=>"Bridgeport Sound Tigers", :season_id=>68}>,
155
+ #<TeamListItem:0x4bdc {:id=>319, :name=>"y - Hershey Bears", :season_id=>68}>,
156
+ #<TeamListItem:0x4bf0 {:id=>313, :name=>"Lehigh Valley Phantoms", :season_id=>68}>,
157
+ #<TeamListItem:0x4c04 {:id=>324, :name=>"Syracuse Crunch", :season_id=>68}>,
158
+ #...
159
+ #]
160
+ ```
161
+
162
+ ### PlayoffBrackets
163
+
164
+ #### retrieve(season_id)
165
+
166
+ Get a `PlayoffBracket` object which has series breakdowns for an entire playoff season by passing season id:
167
+
168
+ ```ruby
169
+ require "ahl_scraper"
170
+ AhlScraper::PlayoffBrackets.retrieve(64)
171
+
172
+ #=> #<PlayoffBracket:0x41c8 {:logo_url=>"https://lscluster.hockeytech.com/download.php?file_path=img/playoffs_64.jpg&client_code=ahl", :rounds=>[#<Round:0x41dc {:series=>[#<Series:0x41f0 {:id=>"A", :games=>[#<Game:0x4204 {:notes=>"", :id=>1019529, :home_team=>309, :status=>"Final", :home_score=>4, :away_score=>5, :away_team=>384, :if_necessary?=>false, :date=>"2019-04-20 19:05:00"}>, #<Game:0x4218 {:notes=>"", :id=>1019530, :home_team=>309, :status=>"Final", :home_score=>4, :away_score=>2, :away_team=>384, :if_necessary?=>false, :date=>"2019-04-21 17:05:00"}>,
173
+ ```
174
+
175
+ ### RosterPlayers
176
+
177
+ #### retrieve_all(team_id, season_id)
178
+
179
+ Returns an array of `RosterPlayer` objects which provide information on all of a teams roster players. Pass the team id and the season id:
180
+
181
+ ```ruby
182
+ require "ahl_scraper"
183
+ AhlScraper::RosterPlayers.retrieve_all(335, 68)
184
+
185
+ #=> [#<RosterPlayer:0x3c3c {:id=>6379, :current_age=>0.2521e2, :season_id=>68, :position=>"C", :shoots=>"L", :birthplace=>"Saskatoon, SK", :birthdate=>"1996-04-03", :height=>"6-0", :draft_year=>2014, :weight=>203, :rookie?=>false, :team_id=>335, :name=>"Rourke Chartier", :jersey_number=>15}>,
186
+ #<RosterPlayer:0x3c50 {:id=>1844, :current_age=>0.3416e2, :season_id=>68, :position=>"LW", :shoots=>"L", :birthplace=>"Toronto, ON", :birthdate=>"1987-04-25", :height=>"5-11", :draft_year=>2005, :weight=>207, :rookie?=>false, :team_id=>335, :name=>"Richard Clune", :jersey_number=>17}>,
187
+ #<RosterPlayer:0x3c64 {:id=>5660, :current_age=>0.2914e2, :season_id=>68, :position=>"LW", :shoots=>"L", :birthplace=>"Morristown, NJ", :birthdate=>"1992-04-30", :height=>"6-0", :draft_year=>2010, :weight=>200, :rookie?=>false, :team_id=>335, :name=>"Kenny Agostino", :jersey_number=>18}>,
188
+ #...
189
+ #]
190
+ ```
191
+
192
+ ### PlayerGames
193
+
194
+ #### list(player_id, season_id)
195
+
196
+ Returns an array of `SkaterGameListItem` or `GoalieGameListItem` objects (depending on player position) which provide information on each game a player has played that season. Pass the player id and the season id:
197
+
198
+ ```ruby
199
+ require "ahl_scraper"
200
+ AhlScraper::PlayerGames.list(304, 1)
201
+
202
+ #=> [#<SkaterGameListItem:0x3c3c {:date=>"2005-10-08", :game_id=>1001046, :shots=>2, :goals_sh=>0, :game_name=>"BNG @ PHI", :game_winning_goals=>0, :plus_minus=>-1, :assists=>1, :points=>1, :shootout_goals=>0, :penalty_minutes=>0, :shootout_attempts=>0, :goals=>0, :goals_pp=>0}>,
203
+ #<SkaterGameListItem:0x3c50 {:date=>"2005-10-15", :game_id=>1001069, :shots=>4, :goals_sh=>0, ... ]
204
+ ```
205
+
206
+ ### TeamGames
207
+
208
+ #### list(team_id, season_id)
209
+
210
+ Returns an array of `TeamGameListItem` objects which provide information on each game a team has played that season. Pass the team id and the season id:
211
+
212
+ ```ruby
213
+ require "ahl_scraper"
214
+ AhlScraper::TeamGames.list(335, 61)
215
+
216
+ #=> [#<TeamGameListItem:0x418c {:at_home?=>false, :status=>"Final", :game_id=>1018347, :away_team=>{:id=>335, :city=>"Toronto"}, :home_team=>{:id=>390, :city=>"Utica"}, :game_name=>"Toronto @ Utica", :game_report_url=>"https://lscluster.hockeytech.com/game_reports/text-game-report.php?client_code=ahl&game_id=1018347&lang_id=1", :game_sheet_url=>"https://lscluster.hockeytech.com/game_reports/official-game-report.php?client_code=ahl&game_id=1018347&lang_id=1", :game_center_url=>"https://theahl.com/stats/game-center/1018347", :home_score=>3, :away_score=>7, :date=>"Fri, Oct 5"}>, ...]
217
+ ```
218
+
219
+ ## Development
220
+
221
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
222
+
223
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
224
+
225
+ ## Contributing
226
+
227
+ Bug reports and pull requests are welcome on GitHub at https://github.com/notnotjeff/ahl_scraper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/ahl_scraper/blob/master/CODE_OF_CONDUCT.md).
228
+
229
+ ## License
230
+
231
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
232
+
233
+ ## Code of Conduct
234
+
235
+ Everyone interacting in the AhlScraper project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ahl_scraper/blob/master/CODE_OF_CONDUCT.md).