-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement NFL Play-By-Play #6
Comments
@RLovelett Hey, I am working on NFL Play by Play endpoint and wanted to get your opinion before I proceed. The problem with Play by Play is that it's collections are not homogenous, it means that there are "drive" type elements and "event" elements in the "pbp" array. They differ in their structure. I have three approaches in my mind that might work out, but they are all less than ideal.
I am curious, maybe you had other ideas in mind? |
+1 For mapping events to types. I think it's the best choice. We'll need to come up with a solid interface to extend from but I think duck typing from there would work well enough. |
I'll be honest this is one that I didn't really look at in any detail. @JanjiS it's easier for me to speak in code regarding proposals. Can you show a snippet for any of the ones you like the most? |
@RLovelett Sure, here is the code that I am working one, please note that it is a "Work in progress": https://github.com/DiatomEnterprises/sports_data_api/blob/master/lib/sports_data_api/nfl/play_by_play.rb |
Ok now that I've looked at some of the code. I think I'm starting to agree with @TheKidCoder. Making the events into types feels the cleanest to me. In my mind, the code I imagine writing with the type checking becomes the most readable. Exampleevents = game.pbp # events/php is an Enumerable?
case events.first.class
when EventA
# stuff
when EventB
# stuff
... or even events = game.pbp # events/php is an Enumerable?
if events.first.is_a?(EventA)
# do something great
end @janjiss I tried looking over the specs to get a feel for how you expect the interface to be used but I'm not sure I can see it. Can you provide just some notional examples here in the discussion? Maybe that would help me make up my mind. @TheKidCoder could I impose on you to do the same. I would like the implementation to support the usage and since I am not actually going to use it. I'm not sure I have a clear picture in my mind. |
Play-By-Play
Schema
Syntax:
http://api.sportsdatallc.org/nfl-[access_level][version]/schema/pbp-v1.0.xsd?api_key=[your_api_key]
Schema Example
Feed
Syntax:
http://api.sportsdatallc.org/nfl-[access_level][version]/[year]/[nfl_season]/[nfl_season_week]/[away_team]/[home_team]/pbp.[format]?api_key=[your_api_key]
Parameter Format Notes
[access_level] = Real-Time (rt), Premium (p), Standard (s), Basic (b), Trial (t)
[version] = whole number (sequential, starting with the number 1)
[year] = yyyy
[nfl_season] = Preseason (PRE), Regular Season (REG), Postseason (PST)
[nfl_season_week] = 1 - 17 (Week 0 of Preseason is Hall of Fame game)
[format] = xml
[home_team], [away_team] = <see schedule feed>
Feed Example
The text was updated successfully, but these errors were encountered: