petems / riot_api

A Ruby wrapper for the Riot API for League of Legends - https://developer.riotgames.com/api/
MIT License
12 stars 3 forks source link

Implement methods to hit the league endpoint #12

Closed pcg79 closed 10 years ago

pcg79 commented 10 years ago

You should pull https://github.com/petems/riot_api/pull/11 first.

Froggen has an awful lot of league data. :frog:

This feature, I think, underscores the need to implement classes instead of using Hashie. I found some weirdness when testing the feature in irb:

>> entries["entries"].first
=> #<Hashie::Rash is_fresh_blood=false is_hot_streak=false is_inactive=false is_veteran=false last_played=0 league_name="Tryndamere's Inquisitors" league_points=74 losses=0 player_or_team_id="25301501" player_or_team_name="Tovvel" queue_type="RANKED_SOLO_5x5" rank="V" tier="DIAMOND" time_until_decay=-1 wins=333>

>> entries.entries.first
=> ["timestamp", 1386868370660]

Where all other API call results I could call a method on the Hashie result, here I have to use Array notation. I have no idea why, I've never used Hashie that much. And b/c I've never used Hashie that much I don't know how hard/easy it'll be to implement classes. I've done a little work with Virtus (https://github.com/solnic/virtus) so hopefully they are similar.

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling ccedf164f6b69a910b0e93fae82580b0cc4eb659 on pcg79:implement_league_methods into 5d9402e0ad32b6b69730fd529568d7159aac8925 on petems:master.

petems commented 10 years ago

Yeah as we get to the bigger returns from the API, it's going to be pretty unwieldy to get data out of it :+1:

Hashie can be a bit weird with it's implementations sometimes, and the data doesn't seem super consistant (Some is quoted, some isn't etc...)

It might be easier to use something else, it should be easy enough to switch up the middleware in Faraday, take the JSON output and then feed it into Virtus?

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling ccedf164f6b69a910b0e93fae82580b0cc4eb659 on pcg79:implement_league_methods into 5d9402e0ad32b6b69730fd529568d7159aac8925 on petems:master.