From e8f1ef9ca3991e917261aceadd27b6f38f6214d7 Mon Sep 17 00:00:00 2001 From: Radosvet Mihtarski Date: Sat, 5 Sep 2020 21:32:59 +0300 Subject: [PATCH] Add additional odds query methods --- Gemfile.lock | 2 +- README.md | 10 ++++++++-- lib/football_api/odds/odd.rb | 24 ++++++++++++++++++++++++ lib/football_api/version.rb | 2 +- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 589ebdb..e33792d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - football_api (0.1.0) + football_api (0.1.2) GEM remote: https://rubygems.org/ diff --git a/README.md b/README.md index 67c4b2b..20c6e2d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/football_api/odds/odd.rb b/lib/football_api/odds/odd.rb index 8e02090..c1364cb 100644 --- a/lib/football_api/odds/odd.rb +++ b/lib/football_api/odds/odd.rb @@ -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 diff --git a/lib/football_api/version.rb b/lib/football_api/version.rb index 4543b81..26aa5da 100644 --- a/lib/football_api/version.rb +++ b/lib/football_api/version.rb @@ -1,3 +1,3 @@ module FootballApi - VERSION = '0.1.1' + VERSION = '0.1.2' end