Class: FootballApi::Match
- Inherits:
-
BaseRequest
- Object
- BaseRequest
- FootballApi::Match
- Includes:
- Requestable
- Defined in:
- lib/football_api/match.rb
Constant Summary
Constants inherited from BaseRequest
Constants included from Symbolizer
Symbolizer::HASH_OR_ARRAY_KEYS
Class Attribute Summary collapse
-
.competition_id ⇒ Object
Returns the value of attribute competition_id.
Instance Attribute Summary collapse
-
#match_commentary_available ⇒ Object
Returns the value of attribute match_commentary_available.
-
#match_comp_id ⇒ Object
Returns the value of attribute match_comp_id.
-
#match_date ⇒ Object
Returns the value of attribute match_date.
-
#match_et_score ⇒ Object
Returns the value of attribute match_et_score.
-
#match_events ⇒ Object
Returns the value of attribute match_events.
-
#match_formatted_date ⇒ Object
Returns the value of attribute match_formatted_date.
-
#match_ft_score ⇒ Object
Returns the value of attribute match_ft_score.
-
#match_ht_score ⇒ Object
Returns the value of attribute match_ht_score.
-
#match_id ⇒ Object
Returns the value of attribute match_id.
-
#match_localteam_id ⇒ Object
Returns the value of attribute match_localteam_id.
-
#match_localteam_name ⇒ Object
Returns the value of attribute match_localteam_name.
-
#match_localteam_score ⇒ Object
Returns the value of attribute match_localteam_score.
-
#match_season_beta ⇒ Object
Returns the value of attribute match_season_beta.
-
#match_status ⇒ Object
Returns the value of attribute match_status.
-
#match_time ⇒ Object
Returns the value of attribute match_time.
-
#match_venue_beta ⇒ Object
Returns the value of attribute match_venue_beta.
-
#match_venue_city_beta ⇒ Object
Returns the value of attribute match_venue_city_beta.
-
#match_venue_id_beta ⇒ Object
Returns the value of attribute match_venue_id_beta.
-
#match_visitorteam_id ⇒ Object
Returns the value of attribute match_visitorteam_id.
-
#match_visitorteam_name ⇒ Object
Returns the value of attribute match_visitorteam_name.
-
#match_visitorteam_score ⇒ Object
Returns the value of attribute match_visitorteam_score.
-
#match_week_beta ⇒ Object
Returns the value of attribute match_week_beta.
-
#static_id ⇒ Object
Returns the value of attribute static_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ Match
constructor
A new instance of Match.
- #parse_match_events(arr = []) ⇒ Object
Methods included from Requestable
Methods inherited from BaseRequest
action_query, get!, get_parameters, response
Methods included from Symbolizer
Constructor Details
#initialize(hash = {}) ⇒ Match
Returns a new instance of Match.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/football_api/match.rb', line 39 def initialize(hash = {}) @match_id = hash[:match_id] @static_id = hash[:match_static_id] @match_comp_id = hash[:match_comp_id] @match_date = hash[:match_date] @match_formatted_date = hash[:match_formatted_date] @match_status = hash[:match_status] @match_time = hash[:match_time] @match_commentary_available = hash[:match_commentary_available] @match_localteam_id = hash[:match_localteam_id] @match_localteam_name = hash[:match_localteam_name] @match_localteam_score = hash[:match_localteam_score] @match_visitorteam_id = hash[:match_visitorteam_id] @match_visitorteam_name = hash[:match_visitorteam_name] @match_visitorteam_score = hash[:match_visitorteam_score] @match_ht_score = hash[:match_ht_score] @match_ft_score = hash[:match_ft_score] @match_et_score = hash[:match_et_score] @match_season_beta = hash[:match_season_beta] @match_week_beta = hash[:match_week_beta] @match_venue_beta = hash[:match_venue_beta] @match_venue_id_beta = hash[:match_venue_id_beta] @match_venue_city_beta = hash[:match_venue_city_beta] @match_events = parse_match_events(hash[:match_events]) end |
Class Attribute Details
.competition_id ⇒ Object
Returns the value of attribute competition_id.
10 11 12 |
# File 'lib/football_api/match.rb', line 10 def competition_id @competition_id end |
Instance Attribute Details
#match_commentary_available ⇒ Object
Returns the value of attribute match_commentary_available.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_commentary_available @match_commentary_available end |
#match_comp_id ⇒ Object
Returns the value of attribute match_comp_id.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_comp_id @match_comp_id end |
#match_date ⇒ Object
Returns the value of attribute match_date.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_date @match_date end |
#match_et_score ⇒ Object
Returns the value of attribute match_et_score.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_et_score @match_et_score end |
#match_events ⇒ Object
Returns the value of attribute match_events.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_events @match_events end |
#match_formatted_date ⇒ Object
Returns the value of attribute match_formatted_date.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_formatted_date @match_formatted_date end |
#match_ft_score ⇒ Object
Returns the value of attribute match_ft_score.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_ft_score @match_ft_score end |
#match_ht_score ⇒ Object
Returns the value of attribute match_ht_score.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_ht_score @match_ht_score end |
#match_id ⇒ Object
Returns the value of attribute match_id.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_id @match_id end |
#match_localteam_id ⇒ Object
Returns the value of attribute match_localteam_id.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_localteam_id @match_localteam_id end |
#match_localteam_name ⇒ Object
Returns the value of attribute match_localteam_name.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_localteam_name @match_localteam_name end |
#match_localteam_score ⇒ Object
Returns the value of attribute match_localteam_score.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_localteam_score @match_localteam_score end |
#match_season_beta ⇒ Object
Returns the value of attribute match_season_beta.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_season_beta @match_season_beta end |
#match_status ⇒ Object
Returns the value of attribute match_status.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_status @match_status end |
#match_time ⇒ Object
Returns the value of attribute match_time.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_time @match_time end |
#match_venue_beta ⇒ Object
Returns the value of attribute match_venue_beta.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_venue_beta @match_venue_beta end |
#match_venue_city_beta ⇒ Object
Returns the value of attribute match_venue_city_beta.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_venue_city_beta @match_venue_city_beta end |
#match_venue_id_beta ⇒ Object
Returns the value of attribute match_venue_id_beta.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_venue_id_beta @match_venue_id_beta end |
#match_visitorteam_id ⇒ Object
Returns the value of attribute match_visitorteam_id.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_visitorteam_id @match_visitorteam_id end |
#match_visitorteam_name ⇒ Object
Returns the value of attribute match_visitorteam_name.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_visitorteam_name @match_visitorteam_name end |
#match_visitorteam_score ⇒ Object
Returns the value of attribute match_visitorteam_score.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_visitorteam_score @match_visitorteam_score end |
#match_week_beta ⇒ Object
Returns the value of attribute match_week_beta.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def match_week_beta @match_week_beta end |
#static_id ⇒ Object
Returns the value of attribute static_id.
28 29 30 |
# File 'lib/football_api/match.rb', line 28 def static_id @static_id end |
Class Method Details
.all_from_competition(competition) ⇒ Object
17 18 19 20 21 |
# File 'lib/football_api/match.rb', line 17 def all_from_competition(competition) @competition_id = competition.is_a?(Competition) ? competition.id : competition Array(response).map { |match| new(match) } end |
.match_params ⇒ Object
23 24 25 |
# File 'lib/football_api/match.rb', line 23 def match_params self.competition_id ? { comp_id: self.competition_id} : {} end |
.today ⇒ Object
12 13 14 15 |
# File 'lib/football_api/match.rb', line 12 def today @competition_id = nil Array(response).map { |match| new(match) } end |
Instance Method Details
#parse_match_events(arr = []) ⇒ Object
65 66 67 |
# File 'lib/football_api/match.rb', line 65 def parse_match_events(arr = []) Array(arr).map { |e| FootballApi::Event.new(e) } end |