xml_soccer 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +0 -0
  3. data/.rspec +0 -0
  4. data/Gemfile +0 -0
  5. data/LICENSE +0 -0
  6. data/README.md +0 -0
  7. data/Rakefile +0 -0
  8. data/lib/xml_soccer.rb +14 -1
  9. data/lib/xml_soccer/version.rb +3 -3
  10. data/spec/fixtures/check_api_key.xml +0 -0
  11. data/spec/fixtures/get_all_leagues.xml +0 -0
  12. data/spec/fixtures/get_all_teams.xml +0 -0
  13. data/spec/fixtures/get_all_teams_by_league_and_season.xml +0 -0
  14. data/spec/fixtures/get_earliest_match_date_per_league.xml +0 -0
  15. data/spec/fixtures/get_fixtures_by_date_interval.xml +0 -0
  16. data/spec/fixtures/get_fixtures_by_date_interval_and_league.xml +0 -0
  17. data/spec/fixtures/get_fixtures_by_date_interval_and_team.xml +0 -0
  18. data/spec/fixtures/get_fixtures_by_league_and_season.xml +0 -0
  19. data/spec/fixtures/get_historic_matches_by_fixture_match_id.xml +0 -0
  20. data/spec/fixtures/get_historic_matches_by_id.xml +0 -0
  21. data/spec/fixtures/get_historic_matches_by_league_and_date_interval.xml +0 -0
  22. data/spec/fixtures/get_historic_matches_by_league_and_season.xml +0 -0
  23. data/spec/fixtures/get_historic_matches_by_team_and_date_interval.xml +0 -0
  24. data/spec/fixtures/get_historic_matches_by_teams_and_date_interval.xml +0 -0
  25. data/spec/fixtures/get_league_standings_by_season.xml +0 -0
  26. data/spec/fixtures/get_live_score.xml +0 -0
  27. data/spec/fixtures/get_live_score_by_league.xml +0 -0
  28. data/spec/fixtures/get_odds_by_fixture_match_id.xml +0 -0
  29. data/spec/fixtures/get_team.xml +0 -0
  30. data/spec/fixtures/get_top_scorers_by_league_and_season.xml +0 -0
  31. data/spec/fixtures/hashed_responses.rb +22 -0
  32. data/spec/spec_helper.rb +0 -0
  33. data/spec/xml_soccer_spec.rb +54 -0
  34. data/xml_soccer.gemspec +2 -2
  35. metadata +21 -35
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f3c346c67150925860502c99025367a945ed4dff
4
+ data.tar.gz: c26392c29d12f31d99d9a51e03cb98bb2d0da24d
5
+ SHA512:
6
+ metadata.gz: bd29acfc33447883acb15121bd32de59b8a7ddbd3a028393e371cb3c33ddb33f79914acba8ed0fc8579b5db8d8a67202f276f40654ffd7a3c7d2ed3248941a83
7
+ data.tar.gz: c1f18e3193003dddf17200f0175f2960e40e5c6e18fe3f2fddaab0bd53995ff491607409023be235f313e8594b32edd5af966eea619b93bf0f8229338a2f6f53
data/.gitignore CHANGED
File without changes
data/.rspec CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
data/lib/xml_soccer.rb CHANGED
@@ -1,4 +1,4 @@
1
- #require "xml_soccer/version"
1
+ require "xml_soccer/version"
2
2
  require 'savon'
3
3
  require 'active_support/time'
4
4
 
@@ -41,6 +41,11 @@ class XmlSoccer
41
41
  call_api(method: "get_team", message: {"team" => team}, key: :team)
42
42
  end
43
43
 
44
+ def fixture(fixture_id: nil)
45
+ call_api(method: "get_fixture_match_by_id", message: { "Id" => fixture_id },
46
+ key: :match)
47
+ end
48
+
44
49
  def fixtures_by_date(start_date: nil, end_date: nil)
45
50
  call_api(method: "get_fixtures_by_date_interval",
46
51
  message: {"startDateString" => start_date.strftime("%Y-%m-%d"),
@@ -139,6 +144,14 @@ class XmlSoccer
139
144
  key: :topscorer)
140
145
  end
141
146
 
147
+ def players_by_team(team_id: nil)
148
+ call_api(method: "get_players_by_team", message: {"teamId" => team_id}, key: :player)
149
+ end
150
+
151
+ def player(player_id: nil)
152
+ call_api(method: "get_player_by_id", message: {"playerId" => player_id}, key: :player)
153
+ end
154
+
142
155
  def odds_by_fixture(fixture_id: nil)
143
156
  call_api(method: "get_odds_by_fixture_match_id",
144
157
  message: {"fixtureMatch_Id" => fixture_id},
@@ -1,3 +1,3 @@
1
- #class XmlSoccer
2
- # VERSION = "0.0.1"
3
- #end
1
+ class XmlSoccer
2
+ VERSION = "0.0.5"
3
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -5,6 +5,20 @@ module HashedResponses
5
5
  latest_match: DateTime.parse("2013-03-02T16:00:00+01:00")}
6
6
  GetAllTeams = { team_id: "4", name: "Fulham", country: "England", stadium: "Craven Cottage",home_page_url: "http://www.fulhamfc.com/", wiki_link: "http://en.wikipedia.org/wiki/Fulham_F.C."}
7
7
 
8
+ GetFixtureMatchById = { id: "350686", date: DateTime.parse("2015-08-29T14:00:00+00:00"), league: "Scottish Premier League", round: "6", spectators: "4702",
9
+ home_team: "Dundee FC", home_team_id: "522", away_team: "Inverness C", away_team_id: "48", time: "Finished", home_goals: "1",
10
+ away_goals: "1", home_goal_details: "90': Kane Hemmings;", away_goal_details: "60': David Raven;", home_lineup_goalkeeper: " Scott Bain",
11
+ away_lineup_goalkeeper: " Owain Fon Williams", home_lineup_defense: " Paul McGinn; Thomas Konrad; James McPake; Gary Irvine;",
12
+ away_lineup_defense: " David Raven; Ross Draper; Daniel Devine; Carl Tremarco;", home_lineup_midfield: " Paul McGowan; Kevin Thomson; Nick Ross; Nicky Low;",
13
+ away_lineup_midfield: " Greg Tansey; Iain Vigurs; Andrea Mbuyi-Mutombo; Ryan Christie; Danny Williams;", home_lineup_forward: " Kane Hemmings; Greg Stewart;",
14
+ away_lineup_forward: " Daniel Lopez;", home_lineup_substitutes: "Daryll Meggatt; Dylan Carreiro; Simon Ferry; David Mitchell; Kostadin Gadzhalov; Kevin Holt; Jesse Curran;",
15
+ away_lineup_substitutes: "Richie Foran; Jason Brown; Nathaniel Wedderburn; Lewis Horner; Liam Polworth; Ryan Esson; Calum Ferguson;", home_lineup_coach: "Paul Hartley;",
16
+ away_lineup_coach: "John Hughes;", home_sub_details: "75': in Dylan Carreiro;75': out Gary Irvine;67': out Thomas Konrad;67': in Daryll Meggatt;",
17
+ away_sub_details: "82': in Nathaniel Wedderburn;82': out Iain Vigurs;", home_team_formation: "4-4-2", away_team_formation: "4-2-3-1", location: "Dens Park",
18
+ stadium: "Dens Park", home_team_yellow_card_details: "70': Daryll Meggatt;",
19
+ away_team_yellow_card_details: "83': Daniel Devine;50': Iain Vigurs;25': Ross Draper;18': Greg Tansey;",
20
+ home_team_red_card_details: "90': Dylan Carreiro;", away_team_red_card_details: nil }
21
+
8
22
  GetFixturesByDateInterval = { id: "287180", date: DateTime.parse("2013-02-22T21:30:00+01:00"), league: "La Liga", round: "25", home_team: "Ath Bilbao",
9
23
  home_team_id: "143", home_goals: "1", away_team: "Sociedad", away_team_id: "140",
10
24
  away_goals: "3", time: "Finished", location: "San Mam?s", bet_at_home: "2,20", bet_at_draw: "3,35", bet_at_away: "3,15",
@@ -199,6 +213,14 @@ GetTeam = { id: "46", name: "St Johnstone", stadium: "McDiarmid Park", website:
199
213
  GetTopScorersByLeagueAndSeason = { rank: "1", name: "Kris Commons", team_name: "Celtic", team_id: "54", nationality: "Scotland",
200
214
  goals: "18", first_scorer: "10", penalties: "4", missed_penalties: "0" }
201
215
 
216
+ GetPlayersByTeam = { id: "2523", name: "David Goodwillie ", height: "1.7", weight: "70.29", nationality: "Scotland", position: "Forward", team_id: "45",
217
+ player_number: "17", date_of_birth: DateTime.parse("1989-03-28T00:00:00+00:00"),
218
+ date_of_signing: DateTime.parse("2014-07-07T00:00:00+00:00"), signing: "Free"}
219
+
220
+ GetPlayerById = { id: "15435", name: "Cem Felek ", nationality: "Germany", position: "Midfielder", team_id: "45", player_number: "47",
221
+ date_of_birth: DateTime.parse("1996-05-12T00:00:00+00:00"), date_of_signing: DateTime.parse("2014-07-01T00:00:00+00:00"),
222
+ signing: "Signed" }
223
+
202
224
  GetOddsByFixtureMatchId = { id: "139429", fixture_match_id: "324725", date_create: DateTime.parse("2013-12-30T02:56:32.487-08:00"),
203
225
  bwin_home: "2.85", bwin_url: "https://www.bwin.com/", bwin_away: "2.30", bwin_draw: "3.20" }
204
226
 
data/spec/spec_helper.rb CHANGED
File without changes
@@ -86,6 +86,24 @@ describe XmlSoccer do
86
86
 
87
87
  end
88
88
 
89
+ describe '#fixture' do
90
+ before do
91
+ message = { "ApiKey" => "testkey", "Id" => "350686" }
92
+ fixture = File.read("spec/fixtures/get_fixture_match_by_id.xml")
93
+ response = {code: 200, headers: {}, body: fixture}
94
+ savon.expects(:get_fixture_match_by_id).with(message: message).returns(response)
95
+ @array = @client.fixture(fixture_id: "350686")
96
+ end
97
+
98
+ it 'returns an array' do
99
+ expect(@array).to be_an_instance_of(Array)
100
+ end
101
+
102
+ it 'returns expected fixture' do
103
+ expect(@array).to include(HashedResponses::GetFixtureMatchById)
104
+ end
105
+ end
106
+
89
107
  describe '#fixtures_by_date' do
90
108
  before do
91
109
  message = {"ApiKey" => "testkey",
@@ -405,6 +423,42 @@ describe XmlSoccer do
405
423
 
406
424
  end
407
425
 
426
+ describe '#players_by_team' do
427
+ before do
428
+ message = {"ApiKey" => "testkey", "teamId" => "45" }
429
+ fixture = File.read("spec/fixtures/get_players_by_team.xml")
430
+ response = {code: 200, headers: {}, body: fixture}
431
+ savon.expects(:get_players_by_team).with(message: message).returns(response)
432
+ @array = @client.players_by_team(team_id: "45")
433
+ end
434
+
435
+ it 'returns an array' do
436
+ expect(@array).to be_an_instance_of(Array)
437
+ end
438
+
439
+ it 'returns expected players' do
440
+ expect(@array).to include(HashedResponses::GetPlayersByTeam)
441
+ end
442
+ end
443
+
444
+ describe '#player' do
445
+ before do
446
+ message = {"ApiKey" => "testkey", "playerId" => "15435" }
447
+ fixture = File.read("spec/fixtures/get_player_by_id.xml")
448
+ response = {code: 200, headers: {}, body: fixture}
449
+ savon.expects(:get_player_by_id).with(message: message).returns(response)
450
+ @array = @client.player(player_id: "15435")
451
+ end
452
+
453
+ it 'returns an array' do
454
+ expect(@array).to be_an_instance_of(Array)
455
+ end
456
+
457
+ it 'returns expected player' do
458
+ expect(@array).to include(HashedResponses::GetPlayerById)
459
+ end
460
+ end
461
+
408
462
  describe '#odds_by_fixture' do
409
463
  before do
410
464
  message = {"ApiKey" => "testkey",
data/xml_soccer.gemspec CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- #require File.expand_path('../lib/xml_soccer/version', __FILE__)
2
+ require File.expand_path('../lib/xml_soccer/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Matt Augustine"]
@@ -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.4"
26
+ gem.version = XmlSoccer::VERSION
27
27
  end
metadata CHANGED
@@ -1,110 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml_soccer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Matt Augustine
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-03-04 00:00:00.000000000 Z
11
+ date: 2015-09-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: savon
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '2.3'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '2.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: activesupport
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: '3.0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: '3.0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '2.14'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: '2.14'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: webmock
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
61
  version: '1.17'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
68
  version: '1.17'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rake
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ~>
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
75
  version: '10.1'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ~>
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
82
  version: '10.1'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: supermodel
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ~>
87
+ - - "~>"
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0.1'
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ~>
94
+ - - "~>"
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0.1'
110
97
  description: Gem to interface with the xmlsoccer.com API
@@ -114,8 +101,8 @@ executables: []
114
101
  extensions: []
115
102
  extra_rdoc_files: []
116
103
  files:
117
- - .gitignore
118
- - .rspec
104
+ - ".gitignore"
105
+ - ".rspec"
119
106
  - Gemfile
120
107
  - LICENSE
121
108
  - README.md
@@ -150,27 +137,26 @@ files:
150
137
  homepage: https://github.com/nosenseworrying/xmlsoccer
151
138
  licenses:
152
139
  - MIT
140
+ metadata: {}
153
141
  post_install_message:
154
142
  rdoc_options: []
155
143
  require_paths:
156
144
  - lib
157
145
  required_ruby_version: !ruby/object:Gem::Requirement
158
- none: false
159
146
  requirements:
160
- - - ! '>='
147
+ - - ">="
161
148
  - !ruby/object:Gem::Version
162
149
  version: '2.0'
163
150
  required_rubygems_version: !ruby/object:Gem::Requirement
164
- none: false
165
151
  requirements:
166
- - - ! '>='
152
+ - - ">="
167
153
  - !ruby/object:Gem::Version
168
154
  version: '0'
169
155
  requirements: []
170
156
  rubyforge_project:
171
- rubygems_version: 1.8.28
157
+ rubygems_version: 2.4.5
172
158
  signing_key:
173
- specification_version: 3
159
+ specification_version: 4
174
160
  summary: Gem to interface witht the xmlsoccer.com API
175
161
  test_files:
176
162
  - spec/fixtures/check_api_key.xml