openfooty 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -32,7 +32,7 @@ Sign up for a Openfooty API key: [http://www.footytube.com/openfooty/signup.php]
32
32
 
33
33
  >> openfooty = Openfooty::Client.new
34
34
  >> fixtures = openfooty.league("getFixtures", :league_id => 72).openfooty.fixtures.match
35
- >> fixtures.first.home_team.cdata
35
+ >> fixtures.first.home_team
36
36
  => "South Africa"
37
37
 
38
38
  >> stats = openfooty.match("getStats", :match_id => 781512).openfooty.match
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -3,7 +3,7 @@ module Openfooty
3
3
  class Client
4
4
  include HTTParty
5
5
  base_uri "http://api.openfooty.org/1.0"
6
- format :json
6
+ format :xml
7
7
 
8
8
  attr_reader :api_key
9
9
 
@@ -57,7 +57,7 @@ module Openfooty
57
57
  protected
58
58
 
59
59
  def default_options
60
- {:api_key => @api_key, :format => :json}
60
+ {:api_key => @api_key, :format => :xml}
61
61
  end
62
62
 
63
63
  def mashup(response)
data/openfooty.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{openfooty}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Johnny Khai Nguyen"]
12
- s.date = %q{2010-06-08}
12
+ s.date = %q{2010-06-10}
13
13
  s.description = %q{Ruby wrapper for the Openfooty API}
14
14
  s.email = %q{johnnyn@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -26,10 +26,14 @@ Gem::Specification.new do |s|
26
26
  "lib/openfooty/client.rb",
27
27
  "openfooty.gemspec",
28
28
  "pkg/openfooty-0.1.0.gem",
29
+ "pkg/openfooty-0.2.0.gem",
29
30
  "tasks/openfooty_tasks.rake",
30
31
  "test/fixtures/league_fixtures.json",
32
+ "test/fixtures/league_fixtures.xml",
31
33
  "test/fixtures/match_stats.json",
34
+ "test/fixtures/match_stats.xml",
32
35
  "test/fixtures/team_squad.json",
36
+ "test/fixtures/team_squad.xml",
33
37
  "test/helper.rb",
34
38
  "test/openfooty_test.rb",
35
39
  "uninstall.rb"
Binary file
@@ -0,0 +1,186 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <openfooty version="1.0">
3
+ <response status="ok"/>
4
+ <fixtures hasMorePages="true" nextPage="2">
5
+ <match match_id="878771">
6
+ <league id="72" season_id="4770">World Cup</league>
7
+ <home_team team_id="2014">South Africa</home_team>
8
+ <away_team team_id="1497">Mexico</away_team>
9
+ <date ts="1276264800">2010-06-11 14:00:00</date>
10
+ <status>Fixture</status>
11
+ <ft_score></ft_score>
12
+ <winner></winner>
13
+ </match>
14
+ <match match_id="878772">
15
+ <league id="72" season_id="4770">World Cup</league>
16
+ <home_team team_id="2300">Uruguay</home_team>
17
+ <away_team team_id="944">France</away_team>
18
+ <date ts="1276281000">2010-06-11 18:30:00</date>
19
+ <status>Fixture</status>
20
+ <ft_score></ft_score>
21
+ <winner></winner>
22
+ </match>
23
+ <match match_id="878778">
24
+ <league id="72" season_id="4770">World Cup</league>
25
+ <home_team team_id="1385">Korea Republic</home_team>
26
+ <away_team team_id="1091">Greece</away_team>
27
+ <date ts="1276342200">2010-06-12 11:30:00</date>
28
+ <status>Fixture</status>
29
+ <ft_score></ft_score>
30
+ <winner></winner>
31
+ </match>
32
+ <match match_id="878777">
33
+ <league id="72" season_id="4770">World Cup</league>
34
+ <home_team team_id="132">Argentina</home_team>
35
+ <away_team team_id="1567">Nigeria</away_team>
36
+ <date ts="1276351200">2010-06-12 14:00:00</date>
37
+ <status>Fixture</status>
38
+ <ft_score></ft_score>
39
+ <winner></winner>
40
+ </match>
41
+ <match match_id="878783">
42
+ <league id="72" season_id="4770">World Cup</league>
43
+ <home_team team_id="774">England</home_team>
44
+ <away_team team_id="2281">United States</away_team>
45
+ <date ts="1276367400">2010-06-12 18:30:00</date>
46
+ <status>Fixture</status>
47
+ <ft_score></ft_score>
48
+ <winner></winner>
49
+ </match>
50
+ <match match_id="878784">
51
+ <league id="72" season_id="4770">World Cup</league>
52
+ <home_team team_id="78">Algeria</home_team>
53
+ <away_team team_id="2011">Slovenia</away_team>
54
+ <date ts="1276428600">2010-06-13 11:30:00</date>
55
+ <status>Fixture</status>
56
+ <ft_score></ft_score>
57
+ <winner></winner>
58
+ </match>
59
+ <match match_id="878790">
60
+ <league id="72" season_id="4770">World Cup</league>
61
+ <home_team team_id="6816">Serbia</home_team>
62
+ <away_team team_id="1038">Ghana</away_team>
63
+ <date ts="1276437600">2010-06-13 14:00:00</date>
64
+ <status>Fixture</status>
65
+ <ft_score></ft_score>
66
+ <winner></winner>
67
+ </match>
68
+ <match match_id="878789">
69
+ <league id="72" season_id="4770">World Cup</league>
70
+ <home_team team_id="1037">Germany</home_team>
71
+ <away_team team_id="156">Australia</away_team>
72
+ <date ts="1276453800">2010-06-13 18:30:00</date>
73
+ <status>Fixture</status>
74
+ <ft_score></ft_score>
75
+ <winner></winner>
76
+ </match>
77
+ <match match_id="878795">
78
+ <league id="72" season_id="4770">World Cup</league>
79
+ <home_team team_id="1552">Netherlands</home_team>
80
+ <away_team team_id="643">Denmark</away_team>
81
+ <date ts="1276515000">2010-06-14 11:30:00</date>
82
+ <status>Fixture</status>
83
+ <ft_score></ft_score>
84
+ <winner></winner>
85
+ </match>
86
+ <match match_id="878796">
87
+ <league id="72" season_id="4770">World Cup</league>
88
+ <home_team team_id="1348">Japan</home_team>
89
+ <away_team team_id="386">Cameroon</away_team>
90
+ <date ts="1276524000">2010-06-14 14:00:00</date>
91
+ <status>Fixture</status>
92
+ <ft_score></ft_score>
93
+ <winner></winner>
94
+ </match>
95
+ <match match_id="878801">
96
+ <league id="72" season_id="4770">World Cup</league>
97
+ <home_team team_id="1318">Italy</home_team>
98
+ <away_team team_id="1630">Paraguay</away_team>
99
+ <date ts="1276540200">2010-06-14 18:30:00</date>
100
+ <status>Fixture</status>
101
+ <ft_score></ft_score>
102
+ <winner></winner>
103
+ </match>
104
+ <match match_id="878802">
105
+ <league id="72" season_id="4770">World Cup</league>
106
+ <home_team team_id="1564">New Zealand</home_team>
107
+ <away_team team_id="1998">Slovakia</away_team>
108
+ <date ts="1276601400">2010-06-15 11:30:00</date>
109
+ <status>Fixture</status>
110
+ <ft_score></ft_score>
111
+ <winner></winner>
112
+ </match>
113
+ <match match_id="878808">
114
+ <league id="72" season_id="4770">World Cup</league>
115
+ <home_team team_id="598">Ivory Coast</home_team>
116
+ <away_team team_id="1772">Portugal</away_team>
117
+ <date ts="1276610400">2010-06-15 14:00:00</date>
118
+ <status>Fixture</status>
119
+ <ft_score></ft_score>
120
+ <winner></winner>
121
+ </match>
122
+ <match match_id="878807">
123
+ <league id="72" season_id="4770">World Cup</league>
124
+ <home_team team_id="349">Brazil</home_team>
125
+ <away_team team_id="1371">Korea DPR</away_team>
126
+ <date ts="1276626600">2010-06-15 18:30:00</date>
127
+ <status>Fixture</status>
128
+ <ft_score></ft_score>
129
+ <winner></winner>
130
+ </match>
131
+ <match match_id="878814">
132
+ <league id="72" season_id="4770">World Cup</league>
133
+ <home_team team_id="1099">Honduras</home_team>
134
+ <away_team team_id="424">Chile</away_team>
135
+ <date ts="1276687800">2010-06-16 11:30:00</date>
136
+ <status>Fixture</status>
137
+ <ft_score></ft_score>
138
+ <winner></winner>
139
+ </match>
140
+ <match match_id="878813">
141
+ <league id="72" season_id="4770">World Cup</league>
142
+ <home_team team_id="2137">Spain</home_team>
143
+ <away_team team_id="2201">Switzerland</away_team>
144
+ <date ts="1276696800">2010-06-16 14:00:00</date>
145
+ <status>Fixture</status>
146
+ <ft_score></ft_score>
147
+ <winner></winner>
148
+ </match>
149
+ <match match_id="878773">
150
+ <league id="72" season_id="4770">World Cup</league>
151
+ <home_team team_id="2014">South Africa</home_team>
152
+ <away_team team_id="2300">Uruguay</away_team>
153
+ <date ts="1276713000">2010-06-16 18:30:00</date>
154
+ <status>Fixture</status>
155
+ <ft_score></ft_score>
156
+ <winner></winner>
157
+ </match>
158
+ <match match_id="878779">
159
+ <league id="72" season_id="4770">World Cup</league>
160
+ <home_team team_id="132">Argentina</home_team>
161
+ <away_team team_id="1385">Korea Republic</away_team>
162
+ <date ts="1276774200">2010-06-17 11:30:00</date>
163
+ <status>Fixture</status>
164
+ <ft_score></ft_score>
165
+ <winner></winner>
166
+ </match>
167
+ <match match_id="878780">
168
+ <league id="72" season_id="4770">World Cup</league>
169
+ <home_team team_id="1091">Greece</home_team>
170
+ <away_team team_id="1567">Nigeria</away_team>
171
+ <date ts="1276783200">2010-06-17 14:00:00</date>
172
+ <status>Fixture</status>
173
+ <ft_score></ft_score>
174
+ <winner></winner>
175
+ </match>
176
+ <match match_id="878774">
177
+ <league id="72" season_id="4770">World Cup</league>
178
+ <home_team team_id="944">France</home_team>
179
+ <away_team team_id="1497">Mexico</away_team>
180
+ <date ts="1276799400">2010-06-17 18:30:00</date>
181
+ <status>Fixture</status>
182
+ <ft_score></ft_score>
183
+ <winner></winner>
184
+ </match>
185
+ </fixtures>
186
+ </openfooty>
@@ -0,0 +1,63 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <openfooty version="1.0">
3
+ <match>
4
+ <ht_score>0-1</ht_score>
5
+ <score>2-1</score>
6
+ <winner>674</winner>
7
+ <date>2010-04-25 14:00:00</date>
8
+ <status>Played</status>
9
+ <home_team id="674">
10
+ <name>Everton</name>
11
+ <lineup>
12
+ <player id="632">T. Howard</player>
13
+ <player id="2846">S. Distin</player>
14
+ <player id="2868">T. Hibbert</player>
15
+ <player id="2600">P. Jagielka</player>
16
+ <player id="2672">L. Baines</player>
17
+ <player id="2876">M. Arteta</player>
18
+ <player id="6472">D. Bilyaletdinov</player>
19
+ <player id="1960">S. Pienaar</player>
20
+ <player id="2874">P. Neville</player>
21
+ <player id="709">T. Cahill</player>
22
+ <player id="2839">A. Yakubu</player>
23
+ <substitution player_id_off="6472" player_id_on="2886">V. Anichebe for D. Bilyaletdinov (45)</substitution>
24
+ <substitution player_id_off="2874" player_id_on="552">L. Saha for P. Neville (60)</substitution>
25
+ <substitution player_id_off="2839" player_id_on="55559">J. Baxter for A. Yakubu (87)</substitution>
26
+ </lineup>
27
+ <goals count="2">
28
+ <goal type="owngoal" time="49" player_id="79474" player_name="C. Smalling"/>
29
+ <goal type="penalty" time="90" player_id="2876" player_name="M. Arteta"/>
30
+ </goals>
31
+ <assists count="2">
32
+ <assist time="49" player_id="2886" player_name="V. Anichebe"/>
33
+ <assist time="90" player_id="709" player_name="T. Cahill"/>
34
+ </assists>
35
+ <cards count="0"/>
36
+ </home_team>
37
+ <away_team id="667">
38
+ <name>Fulham</name>
39
+ <lineup>
40
+ <player id="702">M. Schwarzer</player>
41
+ <player id="15481">C. Baird</player>
42
+ <player id="79474">C. Smalling</player>
43
+ <player id="611">J. Paintsil</player>
44
+ <player id="2568">N. Shorey</player>
45
+ <player id="21660">K. Dikgacoi</player>
46
+ <player id="664">C. Dempsey</player>
47
+ <player id="15429">J. Greening</player>
48
+ <player id="7773">B. Riise</player>
49
+ <player id="2288">E. Nevland</player>
50
+ <player id="18418">S. Okaka Chuka</player>
51
+ <substitution player_id_off="2288" player_id_on="6275">D. Elm for E. Nevland (78)</substitution>
52
+ <substitution player_id_off="18418" player_id_on="7905">F. Stoor for S. Okaka Chuka (89)</substitution>
53
+ </lineup>
54
+ <goals count="1">
55
+ <goal type="normal" time="36" player_id="2288" player_name="E. Nevland"/>
56
+ </goals>
57
+ <assists count="0"/>
58
+ <cards count="1">
59
+ <card type="yellow" time="39" player_id="611" player_name="J. Paintsil"/>
60
+ </cards>
61
+ </away_team>
62
+ </match>
63
+ </openfooty>
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <openfooty version="1.0">
3
+ <response status="ok"/>
4
+ <players team_id="2281">
5
+ <player id="130156" position="">B. Bradley</player>
6
+ <player id="6912" position="Goalkeeper">B. Guzan</player>
7
+ <player id="629" position="Goalkeeper">M. Hahnemann</player>
8
+ <player id="632" position="Goalkeeper">T. Howard</player>
9
+ <player id="643" position="Defender">C. Bocanegra</player>
10
+ <player id="6906" position="Defender">J. Bornstein</player>
11
+ <player id="104666" position="Defender">S. Cherundolo</player>
12
+ <player id="2541" position="Defender">J. DeMerit</player>
13
+ <player id="7261" position="Defender">C. Goodson</player>
14
+ <player id="7214" position="Defender">C. Marshall</player>
15
+ <player id="655" position="Defender">O. Onyewu</player>
16
+ <player id="16404" position="Defender">H. Pearce</player>
17
+ <player id="2712" position="Defender">J. Spector</player>
18
+ <player id="659" position="Midfielder">D. Beasley</player>
19
+ <player id="76707" position="Midfielder">A. Bedoya</player>
20
+ <player id="2304" position="Midfielder">M. Bradley</player>
21
+ <player id="10049" position="Midfielder">R. Clark</player>
22
+ <player id="664" position="Midfielder">C. Dempsey</player>
23
+ <player id="666" position="Midfielder">L. Donovan</player>
24
+ <player id="7452" position="Midfielder">M. Edu</player>
25
+ <player id="2008" position="Midfielder">B. Feilhaber</player>
26
+ <player id="7305" position="Midfielder">S. Holden</player>
27
+ <player id="6915" position="Midfielder">S. Kljestan</player>
28
+ <player id="7226" position="Midfielder">R. Rogers</player>
29
+ <player id="14359" position="Midfielder">J. Torres</player>
30
+ <player id="7422" position="Attacker">J. Altidore</player>
31
+ <player id="7445" position="Attacker">E. Buddle</player>
32
+ <player id="673" position="Attacker">B. Ching</player>
33
+ <player id="7345" position="Attacker">R. Findley</player>
34
+ <player id="6937" position="Attacker">H. Gómez</player>
35
+ <player id="674" position="Attacker">E. Johnson</player>
36
+ </players>
37
+ </openfooty>
data/test/helper.rb CHANGED
@@ -13,11 +13,11 @@ require 'openfooty'
13
13
  # Set the default allow_net_connect option--usually you'll want this off.
14
14
  # You don't usually want your test suite to make HTTP connections, do you?
15
15
 
16
+ FakeWeb.allow_net_connect = false
17
+
16
18
  class Test::Unit::TestCase
17
19
  end
18
20
 
19
- FakeWeb.allow_net_connect = false
20
-
21
21
  def fixture_file(filename)
22
22
  return '' if filename == ''
23
23
  file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
@@ -5,26 +5,26 @@ class OpenfootyTest < Test::Unit::TestCase
5
5
  context "Openfooty API" do
6
6
 
7
7
  setup do
8
- @client = Openfooty::Client.new(:api_key => 'openfooty')
8
+ @client = Openfooty::Client.new(:api_key => 'openfootyapikey')
9
9
  end
10
10
 
11
11
  should "return a list of fixtures for given league_id" do
12
- stub_get("/league.getFixtures?league_id=72", "league_fixtures.json")
12
+ stub_get("/league.getFixtures?league_id=72", "league_fixtures.xml")
13
13
  league_fixtures = @client.league("getFixtures", :league_id => 72).openfooty.fixtures.match
14
14
  league_fixtures.size.should == 20
15
- league_fixtures.first.home_team.cdata.should == 'South Africa'
16
- league_fixtures.first.away_team.cdata.should == 'Mexico'
15
+ league_fixtures.first.home_team.should == 'South Africa'
16
+ league_fixtures.first.away_team.should == 'Mexico'
17
17
  end
18
18
 
19
19
  should "return a team squad members for a given team_id" do
20
- stub_get("/team.getSquad?team_id=2281", "team_squad.json")
20
+ stub_get("/team.getSquad?team_id=2281", "team_squad.xml")
21
21
  team_squad = @client.team("getSquad", :team_id => 2281).openfooty.players.player
22
22
  team_squad.size.should == 31
23
- team_squad.first.cdata.should == 'B. Bradley'
23
+ team_squad.first.should == 'B. Bradley'
24
24
  end
25
25
 
26
26
  should "return a list of stats for a given match_id" do
27
- stub_get("/match.getStats?match_id=781512", "match_stats.json")
27
+ stub_get("/match.getStats?match_id=781512", "match_stats.xml")
28
28
  match_stats = @client.match("getStats", :match_id => 781512).openfooty.match
29
29
  match_stats.home_team.assists.assist.size.should == 2
30
30
  match_stats.home_team.assists.assist.last.player_name.should == 'T. Cahill'
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Johnny Khai Nguyen
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-08 00:00:00 -05:00
17
+ date: 2010-06-10 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -64,10 +64,14 @@ files:
64
64
  - lib/openfooty/client.rb
65
65
  - openfooty.gemspec
66
66
  - pkg/openfooty-0.1.0.gem
67
+ - pkg/openfooty-0.2.0.gem
67
68
  - tasks/openfooty_tasks.rake
68
69
  - test/fixtures/league_fixtures.json
70
+ - test/fixtures/league_fixtures.xml
69
71
  - test/fixtures/match_stats.json
72
+ - test/fixtures/match_stats.xml
70
73
  - test/fixtures/team_squad.json
74
+ - test/fixtures/team_squad.xml
71
75
  - test/helper.rb
72
76
  - test/openfooty_test.rb
73
77
  - uninstall.rb