xml_soccer 0.0.1.pre2 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -5,8 +5,6 @@ This is a Ruby wrapper for the excellent soccer data API that can be found at ww
5
5
 
6
6
  This particular gem is a rewrite/refactoring of the xmlsoccer gem (https://github.com/kavinderd/xmlsoccer)
7
7
 
8
- Please note that this gem is currently in pre-release, and is subject to change.
9
-
10
8
  ## Installation
11
9
 
12
10
  This gem requires Ruby 2.0 or greater, due to the use of keyword arguments in methods.
@@ -21,7 +19,7 @@ And then execute:
21
19
 
22
20
  Or install it yourself as:
23
21
 
24
- $ gem install xml_soccer --pre
22
+ $ gem install xml_soccer
25
23
 
26
24
  ## Usage
27
25
 
@@ -31,8 +29,7 @@ I would recommend everyone interested in using this gem to first read the docume
31
29
 
32
30
  Additionally, the author of the xmlsoccer.com API has put a rate limit on all requests: http://xmlsoccer.wikia.com/wiki/Time_interval_limits
33
31
 
34
- Methods will return an Array of the results (as Hashes) from the API call. If an error occurs, methods will return nil, and print the
35
- response from the API call to the console.
32
+ Methods will return an Array of the results (as Hashes) from the API call. If an error occurs or there are no results for the query, methods will return nil, and print the response from the API call to the console.
36
33
 
37
34
  You must have an xmlsoccer.com API Key and know which API type to use. Currently there are two types: XmlSoccer::DEMO and XmlSoccer::FULL.
38
35
  Demo is the default if you do not explicitly provide a type.
@@ -51,7 +48,7 @@ if leagues
51
48
  puts league[:name]
52
49
  end
53
50
  else
54
- puts "An Error Occured!"
51
+ puts "No results or an error occured!"
55
52
  end
56
53
  ```
57
54
 
@@ -59,19 +56,27 @@ The following methods are currently implemented:
59
56
 
60
57
  xml_soccer method | xmlsoccer.com API call
61
58
  --- | ---
59
+ `check_api_key` | CheckApiKey
62
60
  `leagues` | GetAllLeagues
63
61
  `teams` | GetAllTeams
64
62
  `teams_in_league_by_season(league: 'league', season: 'season')` | GetAllTeamsByLeagueAndSeason
63
+ `team(team: 'team')` | GetTeam
64
+ `earliest_match_date_by_league(league: 'league')` | GetEarliestMatchDatePerLeague
65
65
  `fixtures_by_date(start_date: Date, end_date: Date)` | GetFixturesByDateInterval
66
66
  `fixtures_by_date_and_league(league: 'league', start_date: Date, end_date: Date)` | GetFixturesByDateIntervalAndLeague
67
67
  `fixtures_by_date_and_team(team: 'team', start_date: Date, end_date: Date)` | GetFixturesByDateIntervalAndTeam
68
+ `fixtures_by_league_and_season(league: 'league', season: 'season')` | GetFixturesByLeagueAndSeason
68
69
  `historic_match_by_fixture(fixture_id: 'fixture_id')` | GetHistoricMatchesByFixtureMatchID
69
70
  `historic_match(match_id: 'match_id')` | GetHistoricMatchesByID
70
71
  `historic_matches_by_league_and_date(league: 'league', start_date: Date, end_date: Date)` | GetHistoricMatchesByLeagueAndDateInterval
71
72
  `historic_matches_by_league_and_season(league: 'league', season: 'season')` | GetHistoricMatchesByLeagueAndSeason
72
73
  `historic_matches_by_team_and_date(team: 'team', start_date: Date, end_date: Date)` | GetHistoricMatchesByTeamAndDateInterval
73
74
  `historic_matches_by_teams_and_date(team_1: 'team_1', team_2: 'team_2', start_date: Date, end_date: Date)` | GetHistoricMatchesByTeamsAndDateInterval
74
-
75
+ `league_standings_by_season(league: 'league', season: 'season')` | GetLeagueStandingsBySeason
76
+ `live_scores` | GetLiveScore
77
+ `live_scores_by_league(league: 'league')` | GetLiveScoreByLeague
78
+ `odds_by_fixture(fixture_id: 'league')` | GetOddsByFixtureMatchId
79
+ `top_scorers_by_league_and_season(league: 'league', season: 'season')` | GetTopScorersByLeagueAndSeason
75
80
 
76
81
  ## Contributing
77
82
 
data/lib/xml_soccer.rb CHANGED
@@ -37,6 +37,10 @@ class XmlSoccer
37
37
  key: :team)
38
38
  end
39
39
 
40
+ def team(team: nil)
41
+ call_api(method: "get_team", message: {"ApiKey" => api_key, "team" => team}, key: :team)
42
+ end
43
+
40
44
  def fixtures_by_date(start_date: nil, end_date: nil)
41
45
  call_api(method: "get_fixtures_by_date_interval",
42
46
  message: {"ApiKey" => api_key,
@@ -61,7 +65,13 @@ class XmlSoccer
61
65
  "startDateString" => start_date.strftime("%Y-%m-%d"),
62
66
  "endDateString" => end_date.strftime("%Y-%m-%d")},
63
67
  key: :match)
64
- end
68
+ end
69
+
70
+ def fixtures_by_league_and_season(league: nil, season: nil)
71
+ call_api(method: "get_fixtures_by_league_and_season",
72
+ message: {"ApiKey" => api_key, "league" => league, "seasonDateString" => season},
73
+ key: :match)
74
+ end
65
75
 
66
76
  def historic_match_by_fixture(fixture_id: nil)
67
77
  call_api(method: "get_historic_matches_by_fixture_match_id",
@@ -109,6 +119,44 @@ class XmlSoccer
109
119
  key: :match)
110
120
  end
111
121
 
122
+ def earliest_match_date_by_league(league: nil)
123
+ call_api(method: "get_earliest_match_date_per_league",
124
+ message: {"ApiKey" => api_key,
125
+ "league" => league},
126
+ key: :league_information)
127
+ end
128
+
129
+ def league_standings_by_season(league: nil, season: nil)
130
+ call_api(method: "get_league_standings_by_season",
131
+ message: {"ApiKey" => api_key, "league" => league, "seasonDateString" => season},
132
+ key: :team_league_standing)
133
+ end
134
+
135
+ def live_scores
136
+ call_api(method: "get_live_score", message: {"ApiKey" => api_key}, key: :match)
137
+ end
138
+
139
+ def live_scores_by_league(league: nil)
140
+ call_api(method: "get_live_score_by_league", message: {"ApiKey" => api_key, "league" => league}, key: :match)
141
+ end
142
+
143
+ def top_scorers_by_league_and_season(league: nil, season: nil)
144
+ call_api(method: "get_top_scorers_by_league_and_season",
145
+ message: {"ApiKey" => api_key, "league" => league, "seasonDateString" => season},
146
+ key: :topscorer)
147
+ end
148
+
149
+ def odds_by_fixture(fixture_id: nil)
150
+ call_api(method: "get_odds_by_fixture_match_id",
151
+ message: {"ApiKey" => api_key, "fixtureMatch_Id" => fixture_id},
152
+ key: :odds)
153
+ end
154
+
155
+ def check_api_key
156
+ response = client.call(:check_api_key, message: {"ApiKey" => api_key})
157
+ [{ string: response.body[:check_api_key_response][:check_api_key_result] }]
158
+ end
159
+
112
160
  private
113
161
  def call_api(method: nil, message: nil, key: nil)
114
162
  response = client.call(method.to_sym, message: message)
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Envelope>
3
+ <Body>
4
+ <CheckApiKeyResponse>
5
+ <CheckApiKeyResult>
6
+ <string xmlns="http://xmlsoccer.com/">Hello , you have access to free leagues (demo-user).</string>
7
+ </CheckApiKeyResult>
8
+ </CheckApiKeyResponse>
9
+ </Body>
10
+ </Envelope>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Envelope>
3
+ <Body>
4
+ <GetEarliestMatchDatePerLeagueResponse>
5
+ <GetEarliestMatchDatePerLeagueResult>
6
+ <XMLSOCCER.COM>
7
+ <LeagueInformation>
8
+ <Date>2000-07-28T15:00:00-07:00</Date>
9
+ </LeagueInformation>
10
+ <AccountInformation>Data requested at 02-03-2013 21:02:09 from XX.XX.XX.XX, Username: Espectro. Your current supscription runs out on XX-XX-XXXX 11:01:25.</AccountInformation>
11
+ </XMLSOCCER.COM>
12
+ </GetEarliestMatchDatePerLeagueResult>
13
+ </GetEarliestMatchDatePerLeagueResponse>
14
+ </Body>
15
+ </Envelope>
@@ -0,0 +1,103 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Envelope>
3
+ <Body>
4
+ <GetFixturesByLeagueAndSeasonResponse>
5
+ <GetFixturesByLeagueAndSeasonResult>
6
+ <XMLSOCCER.COM>
7
+ <Match>
8
+ <Id>65801</Id>
9
+ <FixtureMatch_Id>324722</FixtureMatch_Id>
10
+ <Date>2014-01-02T11:45:00-08:00</Date>
11
+ <Round>20</Round>
12
+ <Spectators>20103</Spectators>
13
+ <League>Scottish Premier League</League>
14
+ <HomeTeam>Hibernian</HomeTeam>
15
+ <HomeTeam_Id>53</HomeTeam_Id>
16
+ <HomeCorners>10</HomeCorners>
17
+ <HomeGoals>2</HomeGoals>
18
+ <HalfTimeHomeGoals>0</HalfTimeHomeGoals>
19
+ <HomeShots>23</HomeShots>
20
+ <HomeShotsOnTarget>6</HomeShotsOnTarget>
21
+ <HomeFouls>10</HomeFouls>
22
+ <HomeGoalDetails>83': penalty Liam Craig;60': James Collins;</HomeGoalDetails>
23
+ <HomeLineupGoalkeeper> Ben Williams</HomeLineupGoalkeeper>
24
+ <HomeLineupDefense> Paul Hanlon; Ryan McGivern; Jordan Forster; Michael Nelson;</HomeLineupDefense>
25
+ <HomeLineupMidfield> Lewis Stevenson; Paul Cairney; Scott Robertson; Liam Craig;</HomeLineupMidfield>
26
+ <HomeLineupForward> James Collins; Jason Cummings;</HomeLineupForward>
27
+ <HomeYellowCards>1</HomeYellowCards>
28
+ <HomeRedCards>0</HomeRedCards>
29
+ <HomeSubDetails>89': in Samuel Stanton;89': out Paul Cairney;73': in Owain Tudor Jones;73': out Scott Robertson;62': in Paul Heffernan;62': out Jason Cummings;</HomeSubDetails>
30
+ <AwaySubDetails>66': out Callum Tapping;66': in David Smith;</AwaySubDetails>
31
+ <HomeTeamFormation>4-4-2</HomeTeamFormation>
32
+ <AwayTeam>Hearts</AwayTeam>
33
+ <AwayTeam_Id>50</AwayTeam_Id>
34
+ <AwayCorners>6</AwayCorners>
35
+ <AwayGoals>1</AwayGoals>
36
+ <HalfTimeAwayGoals>0</HalfTimeAwayGoals>
37
+ <AwayShots>5</AwayShots>
38
+ <AwayShotsOnTarget>3</AwayShotsOnTarget>
39
+ <AwayFouls>19</AwayFouls>
40
+ <AwayGoalDetails>71': David Smith;</AwayGoalDetails>
41
+ <AwayLineupGoalkeeper> Jamie MacDonald</AwayLineupGoalkeeper>
42
+ <AwayLineupDefense> Jordan McGhee; Brad McKay; Dylan McGowan; Kevin McHattie;</AwayLineupDefense>
43
+ <AwayLineupMidfield> Callum Tapping; Ryan Stevenson; Jamie Walker; Jamie Hamill; Scott Robinson;</AwayLineupMidfield>
44
+ <AwayLineupForward> Callum Paterson;</AwayLineupForward>
45
+ <AwayYellowCards>4</AwayYellowCards>
46
+ <AwayRedCards>0</AwayRedCards>
47
+ <AwayTeamFormation>4-1-4-1</AwayTeamFormation>
48
+ <HomeTeamYellowCardDetails>84': Paul Cairney;</HomeTeamYellowCardDetails>
49
+ <AwayTeamYellowCardDetails>82': Callum Paterson;76': Jamie Walker;52': Ryan Stevenson;30': Scott Robinson;</AwayTeamYellowCardDetails>
50
+ <HomeTeamRedCardDetails />
51
+ <AwayTeamRedCardDetails />
52
+ </Match>
53
+ <Match>
54
+ <Id>65805</Id>
55
+ <FixtureMatch_Id>324725</FixtureMatch_Id>
56
+ <Date>2014-01-04T07:00:00-08:00</Date>
57
+ <Round>21</Round>
58
+ <Spectators>3212</Spectators>
59
+ <League>Scottish Premier League</League>
60
+ <HomeTeam>Ross County</HomeTeam>
61
+ <HomeTeam_Id>360</HomeTeam_Id>
62
+ <HomeCorners>5</HomeCorners>
63
+ <HomeGoals>1</HomeGoals>
64
+ <HalfTimeHomeGoals>0</HalfTimeHomeGoals>
65
+ <HomeShots>10</HomeShots>
66
+ <HomeShotsOnTarget>2</HomeShotsOnTarget>
67
+ <HomeFouls>13</HomeFouls>
68
+ <HomeGoalDetails>88': Graham Carey;</HomeGoalDetails>
69
+ <HomeLineupGoalkeeper> Michael Fraser</HomeLineupGoalkeeper>
70
+ <HomeLineupDefense> Scott Boyd; Brian McLean; Ben Gordon; Evangelos Ikonomou;</HomeLineupDefense>
71
+ <HomeLineupMidfield> Stuart Kettlewell; Alex Cooper; Richard Brittain; Graham Carey;</HomeLineupMidfield>
72
+ <HomeLineupForward> Jordan Slew; Gary Glen;</HomeLineupForward>
73
+ <HomeYellowCards>1</HomeYellowCards>
74
+ <HomeRedCards>0</HomeRedCards>
75
+ <HomeSubDetails>84': in Michael Tidser;84': out Jordan Slew;66': out Gary Glen;66': in Melvin de Leeuw;</HomeSubDetails>
76
+ <AwaySubDetails>90': in Rory Fallon;90': in Lee Croft;90': out Chris Millar;90': out David Wotherspoon;69': out Nigel Hasselbaink;69': in Michael O'Halloran;</AwaySubDetails>
77
+ <HomeTeamFormation>4-4-2</HomeTeamFormation>
78
+ <AwayTeam>St Johnstone</AwayTeam>
79
+ <AwayTeam_Id>46</AwayTeam_Id>
80
+ <AwayCorners>0</AwayCorners>
81
+ <AwayGoals>0</AwayGoals>
82
+ <HalfTimeAwayGoals>0</HalfTimeAwayGoals>
83
+ <AwayShots>9</AwayShots>
84
+ <AwayShotsOnTarget>3</AwayShotsOnTarget>
85
+ <AwayFouls>14</AwayFouls>
86
+ <AwayGoalDetails />
87
+ <AwayLineupGoalkeeper> Alan Mannus</AwayLineupGoalkeeper>
88
+ <AwayLineupDefense> Frazer Wright; Steven Anderson; Thomas Scobbie; David Mackay;</AwayLineupDefense>
89
+ <AwayLineupMidfield> David Wotherspoon; Murray Davidson; Chris Millar; Gary McDonald;</AwayLineupMidfield>
90
+ <AwayLineupForward> Nigel Hasselbaink; Steve May;</AwayLineupForward>
91
+ <AwayYellowCards>1</AwayYellowCards>
92
+ <AwayRedCards>0</AwayRedCards>
93
+ <AwayTeamFormation>4-4-2</AwayTeamFormation>
94
+ <HomeTeamYellowCardDetails>89': Scott Boyd;</HomeTeamYellowCardDetails>
95
+ <AwayTeamYellowCardDetails>61': David Mackay;</AwayTeamYellowCardDetails>
96
+ <HomeTeamRedCardDetails />
97
+ <AwayTeamRedCardDetails />
98
+ </Match>
99
+ </XMLSOCCER.COM>
100
+ </GetFixturesByLeagueAndSeasonResult>
101
+ </GetFixturesByLeagueAndSeasonResponse>
102
+ </Body>
103
+ </Envelope>
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Envelope>
3
+ <Body>
4
+ <GetLeagueStandingsBySeasonResponse>
5
+ <GetLeagueStandingsBySeasonResult>
6
+ <XMLSOCCER.COM>
7
+ <TeamLeagueStanding xmlns="http://xmlsoccer.com/LeagueStanding">
8
+ <Team>Celtic</Team>
9
+ <Team_Id>54</Team_Id>
10
+ <Played>38</Played>
11
+ <PlayedAtHome>19</PlayedAtHome>
12
+ <PlayedAway>19</PlayedAway>
13
+ <Won>24</Won>
14
+ <Draw>7</Draw>
15
+ <Lost>7</Lost>
16
+ <NumberOfShots>839</NumberOfShots>
17
+ <YellowCards>45</YellowCards>
18
+ <RedCards>1</RedCards>
19
+ <Goals_For>92</Goals_For>
20
+ <Goals_Against>35</Goals_Against>
21
+ <Goal_Difference>57</Goal_Difference>
22
+ <Points>79</Points>
23
+ </TeamLeagueStanding>
24
+ <TeamLeagueStanding xmlns="http://xmlsoccer.com/LeagueStanding">
25
+ <Team>Motherwell</Team>
26
+ <Team_Id>47</Team_Id>
27
+ <Played>38</Played>
28
+ <PlayedAtHome>19</PlayedAtHome>
29
+ <PlayedAway>19</PlayedAway>
30
+ <Won>18</Won>
31
+ <Draw>9</Draw>
32
+ <Lost>11</Lost>
33
+ <NumberOfShots>608</NumberOfShots>
34
+ <YellowCards>43</YellowCards>
35
+ <RedCards>6</RedCards>
36
+ <Goals_For>67</Goals_For>
37
+ <Goals_Against>51</Goals_Against>
38
+ <Goal_Difference>16</Goal_Difference>
39
+ <Points>63</Points>
40
+ </TeamLeagueStanding>
41
+ </XMLSOCCER.COM>
42
+ </GetLeagueStandingsBySeasonResult>
43
+ </GetLeagueStandingsBySeasonResponse>
44
+ </Body>
45
+ </Envelope>
@@ -0,0 +1,79 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Envelope>
3
+ <Body>
4
+ <GetLiveScoreResponse>
5
+ <GetLiveScoreResult>
6
+ <XMLSOCCER.COM>
7
+ <Match>
8
+ <Id>285385</Id>
9
+ <Date>2013-03-30T13:45:00+01:00</Date>
10
+ <League>English Premier League</League>
11
+ <Round>31</Round>
12
+ <Spectators>43747</Spectators>
13
+ <Hometeam>Sunderland</Hometeam>
14
+ <HomeTeam_Id>7</HomeTeam_Id>
15
+ <Awayteam>Man United</Awayteam>
16
+ <AwayTeam_Id>17</AwayTeam_Id>
17
+ <Time>Finished</Time>
18
+ <HomeGoals>0</HomeGoals>
19
+ <AwayGoals>1</AwayGoals>
20
+ <HomeGoalDetails/>
21
+ <AwayGoalDetails>27':Own Titus Bramble;</AwayGoalDetails>
22
+ <HomeLineupGoalkeeper> Simon Mignolet</HomeLineupGoalkeeper>
23
+ <AwayLineupGoalkeeper> David De Gea</AwayLineupGoalkeeper>
24
+ <HomeLineupDefense> Danny Rose; Phillip Bardsley; John O´Shea; Titus Bramble;</HomeLineupDefense>
25
+ <AwayLineupDefense> Alexander Büttner; Rafael da Silva; Chris Smalling; Nemanja Vidic;</AwayLineupDefense>
26
+ <HomeLineupMidfield> Adam Johnson; Alfred N´Diaye; Craig Gardner; James McClean; Stephane Sessegnon;</HomeLineupMidfield>
27
+ <AwayLineupMidfield> Shinji Kagawa; Ashley Young; Anderson; Michael Carrick; Luis Antonio Valencia;</AwayLineupMidfield>
28
+ <HomeLineupForward> Daniel Graham;</HomeLineupForward>
29
+ <AwayLineupForward> Robin van Persie;</AwayLineupForward>
30
+ <HomeSubDetails>85': in Jack Colback;85': out Danny Rose;79': out Phillip Bardsley;79': in Sebastian Larsson;76': in Connor Wickham;76': out Adam Johnson;</HomeSubDetails>
31
+ <AwaySubDetails>84': out Anderson;84': in Tom Cleverley;79': in Danny Welbeck;79': out Shinji Kagawa;32': in Jonny Evans;32': out Rafael da Silva;</AwaySubDetails>
32
+ <HomeTeamFormation>4-4-1-1</HomeTeamFormation>
33
+ <AwayTeamFormation>4-2-3-1</AwayTeamFormation>
34
+ <Location>Stadium of Light</Location>
35
+ <Stadium>Stadium of Light</Stadium>
36
+ <HomeTeamYellowCardDetails>76': Phillip Bardsley;50': John O´Shea;26': Alfred N´Diaye;</HomeTeamYellowCardDetails>
37
+ <AwayTeamYellowCardDetails>58': Robin van Persie;</AwayTeamYellowCardDetails>
38
+ <HomeTeamRedCardDetails/>
39
+ <AwayTeamRedCardDetails/>
40
+ </Match>
41
+ <Match>
42
+ <Id>286362</Id>
43
+ <Date>2013-03-30T15:00:00+01:00</Date>
44
+ <League>Serie A</League>
45
+ <Round>30</Round>
46
+ <Spectators>30953</Spectators>
47
+ <Hometeam>Lazio</Hometeam>
48
+ <HomeTeam_Id>76</HomeTeam_Id>
49
+ <Awayteam>Catania</Awayteam>
50
+ <AwayTeam_Id>79</AwayTeam_Id>
51
+ <Time>54'</Time>
52
+ <HomeGoals>0</HomeGoals>
53
+ <AwayGoals>1</AwayGoals>
54
+ <HomeGoalDetails/>
55
+ <AwayGoalDetails>50': Mariano Julio Izco;</AwayGoalDetails>
56
+ <HomeLineupGoalkeeper> Federico Marchetti</HomeLineupGoalkeeper>
57
+ <AwayLineupGoalkeeper> Mariano Andujar</AwayLineupGoalkeeper>
58
+ <HomeLineupDefense> Alvaro Gonzalez; Stefan Daniel Radu; Giuseppe Biava; Lorik Cana;</HomeLineupDefense>
59
+ <AwayLineupDefense> Nicola Legrottaglie; Pablo Sebastian Alvarez; Giovanni Marchese; Giuseppe Bellusci;</AwayLineupDefense>
60
+ <HomeLineupMidfield> Christian Daniel Ledesma; Senad Lulic; Anderson Hernanes; Ogenyi Onazi; Antonio Candreva;</HomeLineupMidfield>
61
+ <AwayLineupMidfield> Marco Biagianti; Francesco Lodi; Mariano Julio Izco;</AwayLineupMidfield>
62
+ <HomeLineupForward> Louis Saha;</HomeLineupForward>
63
+ <AwayLineupForward> Alejandro Daro Gomez; Gonzalo Bergessio; Pablo Barrientos;</AwayLineupForward>
64
+ <HomeSubDetails/>
65
+ <AwaySubDetails/>
66
+ <HomeTeamFormation>4-1-4-1</HomeTeamFormation>
67
+ <AwayTeamFormation>4-3-3</AwayTeamFormation>
68
+ <Location>Stadio Olimpico</Location>
69
+ <Stadium>Stadio Olimpico</Stadium>
70
+ <HomeTeamYellowCardDetails/>
71
+ <AwayTeamYellowCardDetails>17': Giovanni Marchese;</AwayTeamYellowCardDetails>
72
+ <HomeTeamRedCardDetails/>
73
+ <AwayTeamRedCardDetails/>
74
+ </Match>
75
+ </XMLSOCCER.COM>
76
+ </GetLiveScoreResult>
77
+ </GetLiveScoreResponse>
78
+ </Body>
79
+ </Envelope>
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Envelope>
3
+ <Body>
4
+ <GetLiveScoreByLeagueResponse>
5
+ <GetLiveScoreByLeagueResult>
6
+ <XMLSOCCER.COM>
7
+ <Match>
8
+ <Id>286362</Id>
9
+ <Date>2013-03-30T15:00:00+01:00</Date>
10
+ <League>Serie A</League>
11
+ <Round>30</Round>
12
+ <Spectators>30953</Spectators>
13
+ <Hometeam>Lazio</Hometeam>
14
+ <HomeTeam_Id>76</HomeTeam_Id>
15
+ <Awayteam>Catania</Awayteam>
16
+ <AwayTeam_Id>79</AwayTeam_Id>
17
+ <Time>54'</Time>
18
+ <HomeGoals>0</HomeGoals>
19
+ <AwayGoals>1</AwayGoals>
20
+ <HomeGoalDetails/>
21
+ <AwayGoalDetails>50': Mariano Julio Izco;</AwayGoalDetails>
22
+ <HomeLineupGoalkeeper> Federico Marchetti</HomeLineupGoalkeeper>
23
+ <AwayLineupGoalkeeper> Mariano Andujar</AwayLineupGoalkeeper>
24
+ <HomeLineupDefense> Alvaro Gonzalez; Stefan Daniel Radu; Giuseppe Biava; Lorik Cana;</HomeLineupDefense>
25
+ <AwayLineupDefense> Nicola Legrottaglie; Pablo Sebastian Alvarez; Giovanni Marchese; Giuseppe Bellusci;</AwayLineupDefense>
26
+ <HomeLineupMidfield> Christian Daniel Ledesma; Senad Lulic; Anderson Hernanes; Ogenyi Onazi; Antonio Candreva;</HomeLineupMidfield>
27
+ <AwayLineupMidfield> Marco Biagianti; Francesco Lodi; Mariano Julio Izco;</AwayLineupMidfield>
28
+ <HomeLineupForward> Louis Saha;</HomeLineupForward>
29
+ <AwayLineupForward> Alejandro Daro Gomez; Gonzalo Bergessio; Pablo Barrientos;</AwayLineupForward>
30
+ <HomeSubDetails/>
31
+ <AwaySubDetails/>
32
+ <HomeTeamFormation>4-1-4-1</HomeTeamFormation>
33
+ <AwayTeamFormation>4-3-3</AwayTeamFormation>
34
+ <Location>Stadio Olimpico</Location>
35
+ <Stadium>Stadio Olimpico</Stadium>
36
+ <HomeTeamYellowCardDetails/>
37
+ <AwayTeamYellowCardDetails>17': Giovanni Marchese;</AwayTeamYellowCardDetails>
38
+ <HomeTeamRedCardDetails/>
39
+ <AwayTeamRedCardDetails/>
40
+ </Match>
41
+ </XMLSOCCER.COM>
42
+ </GetLiveScoreByLeagueResult>
43
+ </GetLiveScoreByLeagueResponse>
44
+ </Body>
45
+ </Envelope>
@@ -0,0 +1,93 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Envelope>
3
+ <Body>
4
+ <GetOddsByFixtureMatchIdResponse>
5
+ <GetOddsByFixtureMatchIdResult>
6
+ <XMLSOCCER.COM>
7
+ <Odds>
8
+ <Id>142190</Id>
9
+ <FixtureMatch_Id>324725</FixtureMatch_Id>
10
+ <Date_Create>2014-01-04T14:47:32.437-08:00</Date_Create>
11
+ <_10Bet_Home_Home>3.35</_10Bet_Home_Home>
12
+ <_10Bet_Home_Url>http://en.10bet.com</_10Bet_Home_Url>
13
+ <_10Bet_Home_Away>2.15</_10Bet_Home_Away>
14
+ <_10Bet_Home_Draw>3.25</_10Bet_Home_Draw>
15
+ <Bet_At_Home_Home>3.20</Bet_At_Home_Home>
16
+ <Bet_At_Home_Url>http://www.bet-at-home.com/</Bet_At_Home_Url>
17
+ <Bet_At_Home_Away>2.15</Bet_At_Home_Away>
18
+ <Bet_At_Home_Draw>3.20</Bet_At_Home_Draw>
19
+ <Bet365_Url>http://www.bet365.com/</Bet365_Url>
20
+ <Bet365_Home>3.50</Bet365_Home>
21
+ <Bet365_Away>2.10</Bet365_Away>
22
+ <Bet365_Draw>3.30</Bet365_Draw>
23
+ <Bwin_Home>3.10</Bwin_Home>
24
+ <Bwin_Url>https://www.bwin.com/</Bwin_Url>
25
+ <Bwin_Away>2.20</Bwin_Away>
26
+ <Bwin_Draw>3.10</Bwin_Draw>
27
+ <Ladbrokes_Home>3.25</Ladbrokes_Home>
28
+ <Ladbrokes_Url>http://www.Ladbrokes.com</Ladbrokes_Url>
29
+ <Ladbrokes_Away>2.20</Ladbrokes_Away>
30
+ <Ladbrokes_Draw>3.30</Ladbrokes_Draw>
31
+ <MyBet_Home>3.15</MyBet_Home>
32
+ <MyBet_Url>http://www.mybet.com/</MyBet_Url>
33
+ <MyBet_Away>2.25</MyBet_Away>
34
+ <MyBet_Draw>3.30</MyBet_Draw>
35
+ <NordicBet_Home>3.05</NordicBet_Home>
36
+ <NordicBet_Url>https://www.nordicbet.com/</NordicBet_Url>
37
+ <NordicBet_Away>2.20</NordicBet_Away>
38
+ <NordicBet_Draw>3.35</NordicBet_Draw>
39
+ <Unibet_Home>3.30</Unibet_Home>
40
+ <Unibet_Url>http://www.unibet.com/</Unibet_Url>
41
+ <Unibet_Away>2.10</Unibet_Away>
42
+ <Unibet_Draw>3.30</Unibet_Draw>
43
+ <_188Bet_Home>3.45</_188Bet_Home>
44
+ <_188Bet_Url>http://www.188bet.com/</_188Bet_Url>
45
+ <_188Bet_Draw>3.30</_188Bet_Draw>
46
+ <_188Bet_Away>2.20</_188Bet_Away>
47
+ <_5Dimes_Home>3.43</_5Dimes_Home>
48
+ <_5Dimes_Url>http://www.5dimes.eu/</_5Dimes_Url>
49
+ <_5Dimes_Draw>3.32</_5Dimes_Draw>
50
+ <_5Dimes_Away>2.29</_5Dimes_Away>
51
+ <_888Sport_Home>3.30</_888Sport_Home>
52
+ <_888Sport_Url>http://www.888sport.com/</_888Sport_Url>
53
+ <_888Sport_Draw>3.30</_888Sport_Draw>
54
+ <_888Sport_Away>2.10</_888Sport_Away>
55
+ <Expect_Home>3.40</Expect_Home>
56
+ <Expect_Draw>3.10</Expect_Draw>
57
+ <Expect_Url>http://www.expekt.com/</Expect_Url>
58
+ <Expect_Away>2.15</Expect_Away>
59
+ <Betsafe_Home>3.25</Betsafe_Home>
60
+ <Betsafe_Url>https://www.betsafe.com/</Betsafe_Url>
61
+ <Betsafe_Draw>3.25</Betsafe_Draw>
62
+ <Betsafe_Away>2.20</Betsafe_Away>
63
+ <Interwetten_Home>3.00</Interwetten_Home>
64
+ <Interwetten_Url>https://www.interwetten.com/</Interwetten_Url>
65
+ <Interwetten_Draw>3.10</Interwetten_Draw>
66
+ <Interwetten_Away>2.20</Interwetten_Away>
67
+ <WilliamHill_Home>3.30</WilliamHill_Home>
68
+ <WilliamHill_Url>http://www.williamhill.com/</WilliamHill_Url>
69
+ <WilliamHill_Draw>3.30</WilliamHill_Draw>
70
+ <WilliamHill_Away>2.20</WilliamHill_Away>
71
+ <Betclic_Home>3.40</Betclic_Home>
72
+ <Betclic_Draw>3.00</Betclic_Draw>
73
+ <Betclic_Away>2.15</Betclic_Away>
74
+ <Betclic_Url>https://en.betclic.com/</Betclic_Url>
75
+ <DOXXbet_Home>3.23</DOXXbet_Home>
76
+ <DOXXbet_Draw>3.25</DOXXbet_Draw>
77
+ <DOXXbet_Away>2.13</DOXXbet_Away>
78
+ <DOXXbet_Url>https://www.doxxbet.com/</DOXXbet_Url>
79
+ </Odds>
80
+ <Odds>
81
+ <Id>139429</Id>
82
+ <FixtureMatch_Id>324725</FixtureMatch_Id>
83
+ <Date_Create>2013-12-30T02:56:32.487-08:00</Date_Create>
84
+ <Bwin_Home>2.85</Bwin_Home>
85
+ <Bwin_Url>https://www.bwin.com/</Bwin_Url>
86
+ <Bwin_Away>2.30</Bwin_Away>
87
+ <Bwin_Draw>3.20</Bwin_Draw>
88
+ </Odds>
89
+ </XMLSOCCER.COM>
90
+ </GetOddsByFixtureMatchIdResult>
91
+ </GetOddsByFixtureMatchIdResponse>
92
+ </Body>
93
+ </Envelope>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Envelope>
3
+ <Body>
4
+ <GetTeamResponse>
5
+ <GetTeamResult>
6
+ <XMLSOCCER.COM>
7
+ <Team>
8
+ <Id>46</Id>
9
+ <Name>St Johnstone</Name>
10
+ <Stadium>McDiarmid Park</Stadium>
11
+ <Website>http://www.perthstjohnstonefc.co.uk</Website>
12
+ <WikiPageUrl>http://en.wikipedia.org/wiki/St._Johnstone_F.C.</WikiPageUrl>
13
+ <Country>Scotland</Country>
14
+ </Team>
15
+ </XMLSOCCER.COM>
16
+ </GetTeamResult>
17
+ </GetTeamResponse>
18
+ </Body>
19
+ </Envelope>
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Envelope>
3
+ <Body>
4
+ <GetTopScorersByLeagueAndSeasonResponse>
5
+ <GetTopScorersByLeagueAndSeasonResult>
6
+ <XMLSOCCER.COM>
7
+ <Topscorer>
8
+ <Rank>1</Rank>
9
+ <Name>Kris Commons</Name>
10
+ <TeamName>Celtic</TeamName>
11
+ <Team_Id>54</Team_Id>
12
+ <Nationality>Scotland</Nationality>
13
+ <Goals>18</Goals>
14
+ <FirstScorer>10</FirstScorer>
15
+ <Penalties>4</Penalties>
16
+ <MissedPenalties>0</MissedPenalties>
17
+ </Topscorer>
18
+ <Topscorer>
19
+ <Rank>2</Rank>
20
+ <Name>Kris Boyd</Name>
21
+ <TeamName>Kilmarnock</TeamName>
22
+ <Team_Id>52</Team_Id>
23
+ <Nationality>Scotland</Nationality>
24
+ <Goals>16</Goals>
25
+ <FirstScorer>4</FirstScorer>
26
+ <Penalties>0</Penalties>
27
+ <MissedPenalties>0</MissedPenalties>
28
+ </Topscorer>
29
+ </XMLSOCCER.COM>
30
+ </GetTopScorersByLeagueAndSeasonResult>
31
+ </GetTopScorersByLeagueAndSeasonResponse>
32
+ </Body>
33
+ </Envelope>
@@ -27,6 +27,25 @@ module HashedResponses
27
27
  away_team_yellow_card_details: "61': David Mackay;", home_team_red_card_details: nil,
28
28
  away_team_red_card_details: nil }
29
29
 
30
+ GetFixturesByLeagueAndSeason = { id: "65805", fixture_match_id: "324725", date: DateTime.parse("2014-01-04T07:00:00-08:00"), round: "21",
31
+ spectators: "3212", league: "Scottish Premier League", home_team: "Ross County", home_team_id: "360",
32
+ home_corners: "5", home_goals: "1", half_time_home_goals: "0", home_shots: "10", home_shots_on_target: "2",
33
+ home_fouls: "13", home_goal_details: "88': Graham Carey;", home_lineup_goalkeeper: " Michael Fraser",
34
+ home_lineup_defense: " Scott Boyd; Brian McLean; Ben Gordon; Evangelos Ikonomou;",
35
+ home_lineup_midfield: " Stuart Kettlewell; Alex Cooper; Richard Brittain; Graham Carey;",
36
+ home_lineup_forward: " Jordan Slew; Gary Glen;", home_yellow_cards: "1", home_red_cards: "0",
37
+ home_team_formation: "4-4-2", away_team: "St Johnstone", away_team_id: "46",
38
+ away_corners: "0", away_goals: "0", half_time_away_goals: "0", away_shots: "9", away_shots_on_target: "3",
39
+ away_fouls: "14", away_goal_details: nil, away_lineup_goalkeeper: " Alan Mannus",
40
+ away_lineup_defense: " Frazer Wright; Steven Anderson; Thomas Scobbie; David Mackay;",
41
+ away_lineup_midfield: " David Wotherspoon; Murray Davidson; Chris Millar; Gary McDonald;",
42
+ away_lineup_forward: " Nigel Hasselbaink; Steve May;", away_yellow_cards: "1", away_red_cards: "0",
43
+ away_team_formation: "4-4-2", home_team_yellow_card_details: "89': Scott Boyd;",
44
+ away_team_yellow_card_details: "61': David Mackay;",
45
+ home_team_red_card_details: nil, away_team_red_card_details: nil,
46
+ home_sub_details: "84': in Michael Tidser;84': out Jordan Slew;66': out Gary Glen;66': in Melvin de Leeuw;",
47
+ away_sub_details: "90': in Rory Fallon;90': in Lee Croft;90': out Chris Millar;90': out David Wotherspoon;69': out Nigel Hasselbaink;69': in Michael O'Halloran;" }
48
+
30
49
  GetHistoricMatchesByFixtureMatchId = { id: "65805", fixture_match_id: "324725", date: DateTime.parse("2014-01-04T07:00:00-08:00"), round: "21",
31
50
  spectators: "3212", league: "Scottish Premier League", home_team: "Ross County", home_team_id: "360",
32
51
  home_corners: "5", home_goals: "1", half_time_home_goals: "0", home_shots: "10", home_shots_on_target: "2",
@@ -141,4 +160,48 @@ module HashedResponses
141
160
  home_sub_details: "84': in Michael Tidser;84': out Jordan Slew;66': out Gary Glen;66': in Melvin de Leeuw;",
142
161
  away_sub_details: "90': in Rory Fallon;90': in Lee Croft;90': out Chris Millar;90': out David Wotherspoon;69': out Nigel Hasselbaink;69': in Michael O'Halloran;" }
143
162
 
163
+
164
+ GetEarliestMatchDatePerLeague = { date: DateTime.parse("2000-07-28T15:00:00-07:00") }
165
+
166
+ GetLeagueStandingsBySeason = { team: "Celtic", team_id: "54", played: "38", played_at_home: "19", played_away: "19", won: "24", draw: "7",
167
+ lost: "7", number_of_shots: "839", yellow_cards: "45", red_cards: "1", goals_for: "92", goals_against: "35",
168
+ goal_difference: "57", points: "79", :@xmlns => "http://xmlsoccer.com/LeagueStanding" }
169
+
170
+ GetLiveScore = { id: "286362", date: DateTime.parse("2013-03-30T15:00:00+01:00"), round: "30",
171
+ spectators: "30953", league: "Serie A", hometeam: "Lazio", home_team_id: "76", awayteam: "Catania", away_team_id: "79",
172
+ time: "54'", home_goals: "0", away_goals: "1", home_goal_details: nil, away_goal_details: "50': Mariano Julio Izco;",
173
+ home_lineup_goalkeeper: " Federico Marchetti", away_lineup_goalkeeper: " Mariano Andujar",
174
+ home_lineup_defense: " Alvaro Gonzalez; Stefan Daniel Radu; Giuseppe Biava; Lorik Cana;",
175
+ away_lineup_defense: " Nicola Legrottaglie; Pablo Sebastian Alvarez; Giovanni Marchese; Giuseppe Bellusci;",
176
+ home_lineup_midfield: " Christian Daniel Ledesma; Senad Lulic; Anderson Hernanes; Ogenyi Onazi; Antonio Candreva;",
177
+ away_lineup_midfield: " Marco Biagianti; Francesco Lodi; Mariano Julio Izco;",
178
+ home_lineup_forward: " Louis Saha;", away_lineup_forward: " Alejandro Daro Gomez; Gonzalo Bergessio; Pablo Barrientos;",
179
+ home_sub_details: nil, away_sub_details: nil, home_team_formation: "4-1-4-1", away_team_formation: "4-3-3",
180
+ location: "Stadio Olimpico", stadium: "Stadio Olimpico", home_team_yellow_card_details: nil,
181
+ away_team_yellow_card_details: "17': Giovanni Marchese;", home_team_red_card_details: nil, away_team_red_card_details: nil }
182
+
183
+ GetLiveScoreByLeague = { id: "286362", date: DateTime.parse("2013-03-30T15:00:00+01:00"), round: "30",
184
+ spectators: "30953", league: "Serie A", hometeam: "Lazio", home_team_id: "76", awayteam: "Catania", away_team_id: "79",
185
+ time: "54'", home_goals: "0", away_goals: "1", home_goal_details: nil, away_goal_details: "50': Mariano Julio Izco;",
186
+ home_lineup_goalkeeper: " Federico Marchetti", away_lineup_goalkeeper: " Mariano Andujar",
187
+ home_lineup_defense: " Alvaro Gonzalez; Stefan Daniel Radu; Giuseppe Biava; Lorik Cana;",
188
+ away_lineup_defense: " Nicola Legrottaglie; Pablo Sebastian Alvarez; Giovanni Marchese; Giuseppe Bellusci;",
189
+ home_lineup_midfield: " Christian Daniel Ledesma; Senad Lulic; Anderson Hernanes; Ogenyi Onazi; Antonio Candreva;",
190
+ away_lineup_midfield: " Marco Biagianti; Francesco Lodi; Mariano Julio Izco;",
191
+ home_lineup_forward: " Louis Saha;", away_lineup_forward: " Alejandro Daro Gomez; Gonzalo Bergessio; Pablo Barrientos;",
192
+ home_sub_details: nil, away_sub_details: nil, home_team_formation: "4-1-4-1", away_team_formation: "4-3-3",
193
+ location: "Stadio Olimpico", stadium: "Stadio Olimpico", home_team_yellow_card_details: nil,
194
+ away_team_yellow_card_details: "17': Giovanni Marchese;", home_team_red_card_details: nil, away_team_red_card_details: nil }
195
+
196
+ GetTeam = { id: "46", name: "St Johnstone", stadium: "McDiarmid Park", website: "http://www.perthstjohnstonefc.co.uk",
197
+ wiki_page_url: "http://en.wikipedia.org/wiki/St._Johnstone_F.C.", country: "Scotland" }
198
+
199
+ GetTopScorersByLeagueAndSeason = { rank: "1", name: "Kris Commons", team_name: "Celtic", team_id: "54", nationality: "Scotland",
200
+ goals: "18", first_scorer: "10", penalties: "4", missed_penalties: "0" }
201
+
202
+ GetOddsByFixtureMatchId = { id: "139429", fixture_match_id: "324725", date_create: DateTime.parse("2013-12-30T02:56:32.487-08:00"),
203
+ bwin_home: "2.85", bwin_url: "https://www.bwin.com/", bwin_away: "2.30", bwin_draw: "3.20" }
204
+
205
+ CheckApiKey = { string: {string: "Hello , you have access to free leagues (demo-user)." } }
206
+
144
207
  end
@@ -147,6 +147,26 @@ describe XmlSoccer do
147
147
  expect(@array).to include(HashedResponses::GetFixturesByDateIntervalAndTeam)
148
148
  end
149
149
  end
150
+
151
+ describe '#fixtures_by_league_and_season' do
152
+ before do
153
+ message = {"ApiKey" => "testkey",
154
+ "league" => "Scottish Premier League",
155
+ "seasonDateString" => "" }
156
+ fixture = File.read("spec/fixtures/get_fixtures_by_league_and_season.xml")
157
+ response = {code: 200, headers: {}, body: fixture}
158
+ savon.expects(:get_fixtures_by_league_and_season).with(message: message).returns(response)
159
+ @array = @client.fixtures_by_league_and_season(league: "Scottish Premier League", season: "")
160
+ end
161
+
162
+ it 'returns an array' do
163
+ expect(@array).to be_an_instance_of(Array)
164
+ end
165
+
166
+ it 'returns expected match' do
167
+ expect(@array).to include(HashedResponses::GetFixturesByLeagueAndSeason)
168
+ end
169
+ end
150
170
 
151
171
  describe '#historic_match_by_fixture' do
152
172
  before do
@@ -269,6 +289,161 @@ describe XmlSoccer do
269
289
  expect(@array).to include(HashedResponses::GetHistoricMatchesByTeamsAndDateInterval)
270
290
  end
271
291
  end
292
+
293
+ describe '#earliest_match_date_by_league' do
294
+ before do
295
+ message = {"ApiKey" => "testkey", "league" => "Scottish Premier League" }
296
+ fixture = File.read("spec/fixtures/get_earliest_match_date_per_league.xml")
297
+ response = {code: 200, headers: {}, body: fixture}
298
+ savon.expects(:get_earliest_match_date_per_league).with(message: message).returns(response)
299
+ @array = @client.earliest_match_date_by_league(league: "Scottish Premier League")
300
+ end
301
+
302
+ it 'returns an array' do
303
+ expect(@array).to be_an_instance_of(Array)
304
+ end
305
+
306
+ it 'returns expected match' do
307
+ expect(@array).to include(HashedResponses::GetEarliestMatchDatePerLeague)
308
+ end
309
+ end
310
+
311
+ describe '#league_standings_by_season' do
312
+ before do
313
+ message = {"ApiKey" => "testkey",
314
+ "league" => "Scottish Premier League",
315
+ "seasonDateString" => "1213" }
316
+ fixture = File.read("spec/fixtures/get_league_standings_by_season.xml")
317
+ response = {code: 200, headers: {}, body: fixture}
318
+ savon.expects(:get_league_standings_by_season).with(message: message).returns(response)
319
+ @array = @client.league_standings_by_season(league: "Scottish Premier League", season: "1213")
320
+ end
321
+
322
+ it 'returns an array' do
323
+ expect(@array).to be_an_instance_of(Array)
324
+ end
325
+
326
+ it 'returns expected standing' do
327
+ expect(@array).to include(HashedResponses::GetLeagueStandingsBySeason)
328
+ end
329
+ end
330
+
331
+ describe '#live_scores' do
332
+ before do
333
+ message = {"ApiKey" => "testkey"}
334
+ fixture = File.read("spec/fixtures/get_live_score.xml")
335
+
336
+ response = {code: 200, headers: {}, body: fixture}
337
+ savon.expects(:get_live_score).with(message: message).returns(response)
338
+ @array = @client.live_scores
339
+ end
340
+
341
+ it 'returns an array' do
342
+ expect(@array).to be_an_instance_of(Array)
343
+ end
344
+
345
+ it 'returns expected score' do
346
+ expect(@array).to include(HashedResponses::GetLiveScore)
347
+ end
348
+ end
349
+
350
+ describe '#live_scores_by_league' do
351
+ before do
352
+ message = {"ApiKey" => "testkey", "league" => "Serie A"}
353
+ fixture = File.read("spec/fixtures/get_live_score_by_league.xml")
354
+
355
+ response = {code: 200, headers: {}, body: fixture}
356
+ savon.expects(:get_live_score_by_league).with(message: message).returns(response)
357
+ @array = @client.live_scores_by_league(league: "Serie A")
358
+ end
359
+
360
+ it 'returns an array' do
361
+ expect(@array).to be_an_instance_of(Array)
362
+ end
363
+
364
+ it 'returns expected score' do
365
+ expect(@array).to include(HashedResponses::GetLiveScoreByLeague)
366
+ end
367
+ end
368
+
369
+ describe '#team' do
370
+ before do
371
+ message = {"ApiKey" => "testkey", "team" => "46"}
372
+ fixture = File.read("spec/fixtures/get_team.xml")
373
+
374
+ response = {code: 200, headers: {}, body: fixture}
375
+ savon.expects(:get_team).with(message: message).returns(response)
376
+ @array = @client.team(team: "46")
377
+ end
378
+
379
+ it 'returns an array' do
380
+ expect(@array).to be_an_instance_of(Array)
381
+ end
382
+
383
+ it 'returns expected team' do
384
+ expect(@array).to include(HashedResponses::GetTeam)
385
+ end
386
+ end
387
+
388
+ describe '#top_scorers_by_league_and_season' do
389
+ before do
390
+ message = {"ApiKey" => "testkey",
391
+ "league" => "Scottish Premier League", "seasonDateString" => "1314"}
392
+ fixture = File.read("spec/fixtures/get_top_scorers_by_league_and_season.xml")
393
+ response = {code: 200, headers: {}, body: fixture}
394
+ savon.expects(:get_top_scorers_by_league_and_season).with(message: message).returns(response)
395
+ @array = @client.top_scorers_by_league_and_season(league: "Scottish Premier League", season: "1314")
396
+ end
397
+
398
+ it 'returns an array' do
399
+ expect(@array).to be_an_instance_of(Array)
400
+ end
401
+
402
+ it 'returns expected scorer' do
403
+ expect(@array).to include(HashedResponses::GetTopScorersByLeagueAndSeason)
404
+ end
405
+
406
+ end
407
+
408
+ describe '#odds_by_fixture' do
409
+ before do
410
+ message = {"ApiKey" => "testkey",
411
+ "fixtureMatch_Id" => "324725"}
412
+ fixture = File.read("spec/fixtures/get_odds_by_fixture_match_id.xml")
413
+ response = {code: 200, headers: {}, body: fixture}
414
+ savon.expects(:get_odds_by_fixture_match_id).with(message: message).returns(response)
415
+ @array = @client.odds_by_fixture(fixture_id: "324725")
416
+ end
417
+
418
+ it 'returns an array' do
419
+ expect(@array).to be_an_instance_of(Array)
420
+ end
421
+
422
+ it 'returns expected odds' do
423
+ expect(@array).to include(HashedResponses::GetOddsByFixtureMatchId)
424
+ end
425
+
426
+ end
427
+
428
+ describe '#check_api_key' do
429
+ before do
430
+ message = {"ApiKey" => "testkey"}
431
+ fixture = File.read("spec/fixtures/check_api_key.xml")
432
+ response = {code: 200, headers: {}, body: fixture}
433
+ savon.expects(:check_api_key).with(message: message).returns(response)
434
+ @array = @client.check_api_key
435
+ end
436
+
437
+ it 'returns an array' do
438
+ expect(@array).to be_an_instance_of(Array)
439
+ end
272
440
 
441
+ it 'returns expected message' do
442
+ expect(@array).to include(HashedResponses::CheckApiKey)
443
+ end
444
+
445
+ end
446
+
447
+
273
448
  end
274
449
 
data/xml_soccer.gemspec CHANGED
@@ -23,5 +23,5 @@ Gem::Specification.new do |gem|
23
23
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
24
24
  gem.name = "xml_soccer"
25
25
  gem.require_paths = ["lib"]
26
- gem.version = "0.0.1.pre2"
26
+ gem.version = "0.0.2"
27
27
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml_soccer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.pre2
5
- prerelease: 6
4
+ version: 0.0.2
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matt Augustine
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-28 00:00:00.000000000 Z
12
+ date: 2014-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
@@ -122,18 +122,27 @@ files:
122
122
  - Rakefile
123
123
  - lib/xml_soccer.rb
124
124
  - lib/xml_soccer/version.rb
125
+ - spec/fixtures/check_api_key.xml
125
126
  - spec/fixtures/get_all_leagues.xml
126
127
  - spec/fixtures/get_all_teams.xml
127
128
  - spec/fixtures/get_all_teams_by_league_and_season.xml
129
+ - spec/fixtures/get_earliest_match_date_per_league.xml
128
130
  - spec/fixtures/get_fixtures_by_date_interval.xml
129
131
  - spec/fixtures/get_fixtures_by_date_interval_and_league.xml
130
132
  - spec/fixtures/get_fixtures_by_date_interval_and_team.xml
133
+ - spec/fixtures/get_fixtures_by_league_and_season.xml
131
134
  - spec/fixtures/get_historic_matches_by_fixture_match_id.xml
132
135
  - spec/fixtures/get_historic_matches_by_id.xml
133
136
  - spec/fixtures/get_historic_matches_by_league_and_date_interval.xml
134
137
  - spec/fixtures/get_historic_matches_by_league_and_season.xml
135
138
  - spec/fixtures/get_historic_matches_by_team_and_date_interval.xml
136
139
  - spec/fixtures/get_historic_matches_by_teams_and_date_interval.xml
140
+ - spec/fixtures/get_league_standings_by_season.xml
141
+ - spec/fixtures/get_live_score.xml
142
+ - spec/fixtures/get_live_score_by_league.xml
143
+ - spec/fixtures/get_odds_by_fixture_match_id.xml
144
+ - spec/fixtures/get_team.xml
145
+ - spec/fixtures/get_top_scorers_by_league_and_season.xml
137
146
  - spec/fixtures/hashed_responses.rb
138
147
  - spec/spec_helper.rb
139
148
  - spec/xml_soccer_spec.rb
@@ -154,9 +163,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
154
163
  required_rubygems_version: !ruby/object:Gem::Requirement
155
164
  none: false
156
165
  requirements:
157
- - - ! '>'
166
+ - - ! '>='
158
167
  - !ruby/object:Gem::Version
159
- version: 1.3.1
168
+ version: '0'
160
169
  requirements: []
161
170
  rubyforge_project:
162
171
  rubygems_version: 1.8.28
@@ -164,18 +173,27 @@ signing_key:
164
173
  specification_version: 3
165
174
  summary: Gem to interface witht the xmlsoccer.com API
166
175
  test_files:
176
+ - spec/fixtures/check_api_key.xml
167
177
  - spec/fixtures/get_all_leagues.xml
168
178
  - spec/fixtures/get_all_teams.xml
169
179
  - spec/fixtures/get_all_teams_by_league_and_season.xml
180
+ - spec/fixtures/get_earliest_match_date_per_league.xml
170
181
  - spec/fixtures/get_fixtures_by_date_interval.xml
171
182
  - spec/fixtures/get_fixtures_by_date_interval_and_league.xml
172
183
  - spec/fixtures/get_fixtures_by_date_interval_and_team.xml
184
+ - spec/fixtures/get_fixtures_by_league_and_season.xml
173
185
  - spec/fixtures/get_historic_matches_by_fixture_match_id.xml
174
186
  - spec/fixtures/get_historic_matches_by_id.xml
175
187
  - spec/fixtures/get_historic_matches_by_league_and_date_interval.xml
176
188
  - spec/fixtures/get_historic_matches_by_league_and_season.xml
177
189
  - spec/fixtures/get_historic_matches_by_team_and_date_interval.xml
178
190
  - spec/fixtures/get_historic_matches_by_teams_and_date_interval.xml
191
+ - spec/fixtures/get_league_standings_by_season.xml
192
+ - spec/fixtures/get_live_score.xml
193
+ - spec/fixtures/get_live_score_by_league.xml
194
+ - spec/fixtures/get_odds_by_fixture_match_id.xml
195
+ - spec/fixtures/get_team.xml
196
+ - spec/fixtures/get_top_scorers_by_league_and_season.xml
179
197
  - spec/fixtures/hashed_responses.rb
180
198
  - spec/spec_helper.rb
181
199
  - spec/xml_soccer_spec.rb