Skip to content

Commit

Permalink
Add additional odds query methods
Browse files Browse the repository at this point in the history
  • Loading branch information
radkomih committed Sep 5, 2020
1 parent 47b5257 commit e8f1ef9
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
football_api (0.1.0)
football_api (0.1.2)

GEM
remote: https://rubygems.org/
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,14 @@ FootballApi::Odds::Label.find(1)

FootballApi::Odds::Mapping.all(page: 2)

FootballApi::Odds::Odd.all_by_fixture(1066)
FootballApi::Odds::Odd.all_by_date(date)
FootballApi::Odds::Odd.all_by_fixture(569725)
FootballApi::Odds::Odd.all_by_date(date, page: 2)
FootballApi::Odds::Odd.all_by_date_and_bookmaker(date, 9)
FootballApi::Odds::Odd.all_by_fixture_and_bookmaker(608277, 9)
FootballApi::Odds::Odd.all_by_fixture_and_label(608277, 1)
FootballApi::Odds::Odd.all_by_league(1334, page: 2)
FootballApi::Odds::Odd.all_by_league_and_bookmaker(1334, 9)
FootballApi::Odds::Odd.all_by_league_and_label(1334, 1)
```

## TODO
Expand Down
24 changes: 24 additions & 0 deletions lib/football_api/odds/odd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,30 @@ def all_by_date(date, **options)
fetch("date/#{date}", options)
end

def all_by_date_and_bookmaker(date, bookmaker_id, **options)
fetch("date/#{date}/bookmaker/#{bookmaker_id}", options)
end

def all_by_fixture_and_bookmaker(fixture_id, bookmaker_id, **options)
fetch("fixture/#{fixture_id}/bookmaker/#{bookmaker_id}", options)
end

def all_by_fixture_and_label(fixture_id, label_id, **options)
fetch("fixture/#{fixture_id}/label/#{label_id}", options)
end

def all_by_league(league_id, **options)
fetch("league/#{league_id}", options)
end

def all_by_league_and_bookmaker(league_id, bookmaker_id, **options)
fetch("league/#{league_id}/bookmaker/#{bookmaker_id}", options)
end

def all_by_league_and_label(league_id, label_id, **options)
fetch("league/#{league_id}/label/#{label_id}", options)
end

private

def resource
Expand Down
2 changes: 1 addition & 1 deletion lib/football_api/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module FootballApi
VERSION = '0.1.1'
VERSION = '0.1.2'
end

0 comments on commit e8f1ef9

Please sign in to comment.