infostrada 0.1.26 → 0.1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.rspec +2 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +6 -0
- data/README.md +2 -0
- data/infostrada.gemspec +4 -1
- data/lib/infostrada.rb +6 -12
- data/lib/infostrada/call_refresh.rb +2 -1
- data/lib/infostrada/competition.rb +2 -1
- data/lib/infostrada/core_ext/hash.rb +14 -0
- data/lib/infostrada/core_ext/string.rb +19 -2
- data/lib/infostrada/match.rb +2 -2
- data/lib/infostrada/match_event.rb +1 -1
- data/lib/infostrada/mock.rb +76 -0
- data/lib/infostrada/nation.rb +2 -2
- data/lib/infostrada/person_info.rb +12 -12
- data/lib/infostrada/phase.rb +11 -13
- data/lib/infostrada/player.rb +11 -11
- data/lib/infostrada/squad.rb +3 -6
- data/lib/infostrada/team.rb +4 -4
- data/lib/infostrada/team_info.rb +1 -1
- data/lib/infostrada/team_request.rb +2 -5
- data/lib/infostrada/version.rb +1 -1
- data/spec/base_request_spec.rb +19 -0
- data/spec/competition_spec.rb +67 -0
- data/spec/edition_request_spec.rb +20 -0
- data/spec/edition_spec.rb +111 -0
- data/spec/endpoint_spec.rb +62 -0
- data/spec/formatter_spec.rb +12 -0
- data/spec/helpers/json_helper.rb +41 -0
- data/spec/json/competition.json +55 -0
- data/spec/json/edition.json +61 -0
- data/spec/json/edition_request.json +242 -0
- data/spec/json/endpoint.json +46 -0
- data/spec/json/match.json +945 -0
- data/spec/json/match_event.json +187 -0
- data/spec/json/match_event_list.json +411 -0
- data/spec/json/nation.json +302 -0
- data/spec/json/person_info.json +52 -0
- data/spec/json/phase.json +158 -0
- data/spec/json/player.json +93 -0
- data/spec/json/referee.json +184 -0
- data/spec/json/sample_responses/all_editions.json +243 -0
- data/spec/json/sample_responses/competition_edition_league_21594_serie_a.json +4 -0
- data/spec/json/sample_responses/competition_match_days_league_21594_serie_a.json +473 -0
- data/spec/json/sample_responses/competition_match_list_league_21594_serie_a.json +25465 -0
- data/spec/json/sample_responses/competition_phases_cup_21204_capital_one_cup.json +138 -0
- data/spec/json/sample_responses/competition_phases_league_21594_serie_a.json +24 -0
- data/spec/json/sample_responses/competition_table_phase_114165_serie_a_2015.json +585 -0
- data/spec/json/sample_responses/competition_teams_league_21594.json +165 -0
- data/spec/json/sample_responses/get_api_call_refresh_module.json +65 -0
- data/spec/json/sample_responses/match_events_1788734_real_atletico_final_champions.json +7960 -0
- data/spec/json/sample_responses/match_info_1788734_real_atletico_final_champions.json +96 -0
- data/spec/json/sample_responses/match_info_upcoming_1968820_serie_a.json +96 -0
- data/spec/json/sample_responses/person_info_611005_bale.json +55 -0
- data/spec/json/sample_responses/squad_100163_on_edition_21590.json +1355 -0
- data/spec/json/sample_responses/team_info_100163.json +28 -0
- data/spec/json/sample_responses/template_dummy_response.json +4 -0
- data/spec/json/squad.json +514 -0
- data/spec/json/team.json +10 -0
- data/spec/json/team_info.json +25 -0
- data/spec/json/team_request.json +68 -0
- data/spec/match_event_list_spec.rb +21 -0
- data/spec/match_event_spec.rb +159 -0
- data/spec/match_spec.rb +430 -0
- data/spec/nation_spec.rb +179 -0
- data/spec/person_info_spec.rb +69 -0
- data/spec/phase_spec.rb +183 -0
- data/spec/player_spec.rb +112 -0
- data/spec/referee_spec.rb +71 -0
- data/spec/spec_helper.rb +117 -0
- data/spec/squad_spec.rb +25 -0
- data/spec/team_info_spec.rb +77 -0
- data/spec/team_request_spec.rb +24 -0
- data/spec/team_spec.rb +76 -0
- metadata +213 -43
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZTlmMWIxYTFhM2Q2NTRlYmFhN2JjZTliOTM5ZjEwNDFlNGM0MmViZg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6b30c5898694a437a67d666cc76caa8065dd319f
|
4
|
+
data.tar.gz: c87943d6ee571431fcb73ef36538fe2170dc9ef4
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
OWM0MmU2Mzg4ODZiYzdiYzc3Y2VhMTZkNmM0MzVkMTkyZTQ4NDJhMjMxZTUy
|
11
|
-
OTI0NmMyMTczOGI5MThlNzM2NTE2YzliYWMzNWIxZThjNzIzOGE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OGQzZTYwMmIxN2JlZGY2NmY2YmU1MTQyMzY2OGRkYmRiYWIyODZjZThmODg4
|
14
|
-
ZjAyOTBmYmI0NGM0MzBiNWI1MmU0ZDQ2ZDllZThiOWU3YjJlYjU1OGQ1Mzg3
|
15
|
-
NWEyMzVlOGI4NGY1ODcwMjBlM2U2NmZjODhhMWE4ZGE0YzEyODc=
|
6
|
+
metadata.gz: 54d404aaa60736bbec2de0aa39314db1deab3f0f39f509787195612d75936f2f8bb4aadd3b77770e28fa91ae0c7a7837d2d725d23e9dcc227bc2a7f39d16e896
|
7
|
+
data.tar.gz: 899739556ca72a86127484f470c54e45e93a6a8a4eab1ec368eeb70812b1038fadb25180247f9c83e4fd2b2955b86e05c881d76e5ab100870453a66949574306
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/README.md
CHANGED
data/infostrada.gemspec
CHANGED
@@ -16,13 +16,16 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ['lib']
|
19
|
+
spec.require_paths = ['lib', 'lib/infostrada' ]
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.2', '>= 10.2.2'
|
23
23
|
spec.add_development_dependency 'reek', '~> 1.3', '>= 1.3.7'
|
24
24
|
spec.add_development_dependency 'rubocop', '~> 0.20', '>= 0.20.1'
|
25
25
|
spec.add_development_dependency 'pry', '~> 0.9', '>= 0.9.12'
|
26
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.1', '>= 3.1.0'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.2', '>= 3.2.0'
|
28
|
+
spec.add_development_dependency 'webmock', '~> 1.21', '>= 1.21.0'
|
26
29
|
|
27
30
|
spec.add_dependency 'httparty', '~> 0.13', '>= 0.13.0'
|
28
31
|
spec.add_dependency 'colored', '~> 1.2'
|
data/lib/infostrada.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'httparty'
|
3
3
|
require 'active_model'
|
4
|
-
|
5
|
-
require 'infostrada/core_ext/string'
|
4
|
+
require 'pry'
|
6
5
|
require 'infostrada/base_request'
|
7
|
-
|
8
6
|
module Infostrada
|
7
|
+
require 'infostrada/core_ext/string'
|
8
|
+
require 'infostrada/core_ext/hash'
|
9
|
+
require 'infostrada/mock'
|
9
10
|
extend ActiveModel::Serializers::JSON
|
10
11
|
|
11
12
|
# The configuration of the API requests.
|
@@ -53,26 +54,19 @@ module Infostrada
|
|
53
54
|
end
|
54
55
|
|
55
56
|
require 'infostrada/competition'
|
56
|
-
|
57
57
|
require 'infostrada/edition'
|
58
58
|
require 'infostrada/edition_request'
|
59
|
-
|
59
|
+
require 'infostrada/endpoint'
|
60
60
|
require 'infostrada/errors'
|
61
|
-
|
62
61
|
require 'infostrada/nation'
|
63
|
-
|
64
62
|
require 'infostrada/formatter'
|
65
|
-
|
66
63
|
require 'infostrada/team'
|
67
64
|
require 'infostrada/team_request'
|
68
65
|
require 'infostrada/team_info'
|
69
|
-
|
70
66
|
require 'infostrada/match'
|
71
67
|
require 'infostrada/phase'
|
72
68
|
require 'infostrada/table'
|
73
|
-
|
74
69
|
require 'infostrada/squad'
|
75
70
|
require 'infostrada/player'
|
76
71
|
require 'infostrada/person_info'
|
77
|
-
|
78
|
-
require 'infostrada/version'
|
72
|
+
require 'infostrada/version'
|
@@ -64,10 +64,11 @@ module Infostrada
|
|
64
64
|
|
65
65
|
list = get!(URL, query: { from: date_str, outputType: OUTPUT_TYPE, module: 'football' })
|
66
66
|
|
67
|
+
puts "Refresh call with #{date_str}"
|
67
68
|
list.each_with_object([]) do |hash, endpoints|
|
68
69
|
lang = hash['c_QueryString'].scan(/languagecode=(\d+)/).flatten.first.to_i
|
69
70
|
endpoints << Endpoint.new(hash) if LANGUAGE_CODES.include?(lang)
|
70
71
|
end
|
71
72
|
end
|
72
73
|
end
|
73
|
-
end
|
74
|
+
end
|
@@ -15,7 +15,7 @@ module Infostrada
|
|
15
15
|
attr_accessor :id, :name, :set, :level, :nation
|
16
16
|
|
17
17
|
def self.from_json(json = {})
|
18
|
-
|
18
|
+
new do |competition|
|
19
19
|
competition.id = json['id']
|
20
20
|
competition.name = json['name']
|
21
21
|
competition.nation = Nation.from_json(json['nation'], 'competition') if json['nation']
|
@@ -32,3 +32,4 @@ module Infostrada
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Hash
|
2
|
+
def symbolize_keys
|
3
|
+
transform_keys{ |key| key.to_sym rescue key }
|
4
|
+
end
|
5
|
+
|
6
|
+
def transform_keys
|
7
|
+
return enum_for(:transform_keys) unless block_given?
|
8
|
+
result = self.class.new
|
9
|
+
each_key do |key|
|
10
|
+
result[yield(key)] = self[key]
|
11
|
+
end
|
12
|
+
result
|
13
|
+
end
|
14
|
+
end
|
@@ -1,11 +1,28 @@
|
|
1
1
|
class String
|
2
2
|
# This is a version of the method stolen from railties and it converts 'Text-LikeThis' to
|
3
3
|
# 'text_like_this'.
|
4
|
-
def
|
4
|
+
def info_snake_case
|
5
5
|
result = self.gsub(/::/, '/')
|
6
6
|
result.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
|
7
7
|
result.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
8
8
|
result.tr!("-", "_")
|
9
9
|
result.downcase
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
|
+
# Weird name so inclusion with active support
|
13
|
+
# doesn't break things
|
14
|
+
def info_camelize
|
15
|
+
result = self.gsub(/(?<=_|^)(\w)/){$1.upcase}
|
16
|
+
result.gsub(/(?<=_|^)(\w)/){$1.upcase}.gsub(/(?:_)(\w)/,'\1')
|
17
|
+
end
|
18
|
+
|
19
|
+
# Weird name so inclusion with active support
|
20
|
+
# doesn't break things
|
21
|
+
def info_underscore
|
22
|
+
result = self.gsub(/::/, '/')
|
23
|
+
result.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
|
24
|
+
.gsub(/([a-z\d])([A-Z])/,'\1_\2')
|
25
|
+
.tr("-", "_")
|
26
|
+
.downcase
|
27
|
+
end
|
28
|
+
end
|
data/lib/infostrada/match.rb
CHANGED
@@ -188,8 +188,8 @@ module Infostrada
|
|
188
188
|
@referee = Referee.new(hash) if hash['n_RefereeID']
|
189
189
|
@phase = Phase.new(hash) if hash['n_PhaseID']
|
190
190
|
|
191
|
-
@home_team = Team.new(hash, 'home') if hash['
|
192
|
-
@away_team = Team.new(hash, 'away') if hash['
|
191
|
+
@home_team = Team.new(hash, 'home') if hash['n_HomeTeamID']
|
192
|
+
@away_team = Team.new(hash, 'away') if hash['n_AwayTeamID']
|
193
193
|
|
194
194
|
@goals = Goals.new(hash) if hash['n_HomeGoals']
|
195
195
|
@edition = Edition.new(hash) if hash['n_EditionID']
|
@@ -86,7 +86,7 @@ module Infostrada
|
|
86
86
|
@time = hash['n_ActionTime']
|
87
87
|
@home_goals = hash['n_HomeGoals']
|
88
88
|
@away_goals = hash['n_AwayGoals']
|
89
|
-
@home_event = hash['n_HomeOrAway'] == 1
|
89
|
+
@home_event = hash['n_HomeOrAway'] == 1
|
90
90
|
@team_id = hash['n_TeamID']
|
91
91
|
@team_name = hash['c_Team']
|
92
92
|
@team_short_name = hash['c_TeamShort']
|
@@ -0,0 +1,76 @@
|
|
1
|
+
json_helper = File.join('..', '..', '..', 'spec', 'helpers', 'json_helper')
|
2
|
+
require File.expand_path(json_helper, __FILE__)
|
3
|
+
|
4
|
+
module Infostrada
|
5
|
+
class Mock
|
6
|
+
class << self
|
7
|
+
def explain
|
8
|
+
meths = %w(competition edition match_event match nation person_info
|
9
|
+
phase player referee team_info team)
|
10
|
+
puts 'Returns mock class instance for tests.'
|
11
|
+
puts 'Available methods:'
|
12
|
+
meths.each do |m|
|
13
|
+
puts "\t - Infostrada::Mock.#{m}"
|
14
|
+
end
|
15
|
+
puts 'All the methods accept one or more arguments.'
|
16
|
+
puts 'The first argument is *type*, which allows the selection of the mock json.'
|
17
|
+
puts ''
|
18
|
+
end
|
19
|
+
|
20
|
+
def competition(type = :default)
|
21
|
+
json = JSONHelper::Competition.get(type)
|
22
|
+
Infostrada::Competition.new(json)
|
23
|
+
end
|
24
|
+
|
25
|
+
def edition(type = :default)
|
26
|
+
json = JSONHelper::Edition.get(type)
|
27
|
+
Infostrada::Edition.new(json)
|
28
|
+
end
|
29
|
+
|
30
|
+
def match_event(type = :event_1, match_id = nil)
|
31
|
+
json = JSONHelper::MatchEvent.get(type)
|
32
|
+
Infostrada::MatchEvent.new(match_id, json)
|
33
|
+
end
|
34
|
+
|
35
|
+
def match(type = :cup_knock_out_finished_complete)
|
36
|
+
json = JSONHelper::Match.get(type)
|
37
|
+
Infostrada::Match.new(json)
|
38
|
+
end
|
39
|
+
|
40
|
+
def nation(type = :team)
|
41
|
+
json = JSONHelper::Nation.get(type)
|
42
|
+
Infostrada::Nation.new(json, type.to_s)
|
43
|
+
end
|
44
|
+
|
45
|
+
def person_info(person_id = 611_005, type = :default)
|
46
|
+
json = JSONHelper::PersonInfo.get(type)
|
47
|
+
Infostrada::PersonInfo.new(person_id, json)
|
48
|
+
end
|
49
|
+
|
50
|
+
def phase(type = :default)
|
51
|
+
json = JSONHelper::Phase.get(type).first
|
52
|
+
Infostrada::Phase.new(json)
|
53
|
+
end
|
54
|
+
|
55
|
+
def player(type = :default)
|
56
|
+
json = JSONHelper::Player.get(type)
|
57
|
+
Infostrada::Player.new(json)
|
58
|
+
end
|
59
|
+
|
60
|
+
def referee(type = :complete_referee_match)
|
61
|
+
json = JSONHelper::Referee.get(type)
|
62
|
+
Infostrada::Referee.new(json)
|
63
|
+
end
|
64
|
+
|
65
|
+
def team_info(type = :default)
|
66
|
+
json = JSONHelper::TeamInfo.get(type)
|
67
|
+
Infostrada::TeamInfo.new(json)
|
68
|
+
end
|
69
|
+
|
70
|
+
def team(type = :default)
|
71
|
+
json = JSONHelper::Team.get(type)
|
72
|
+
Infostrada::Team.new(json, '')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/infostrada/nation.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Infostrada
|
2
2
|
class Nation
|
3
|
-
attr_accessor :id, :name, :short_name
|
4
3
|
|
4
|
+
attr_accessor :id, :name, :short_name
|
5
5
|
|
6
6
|
def self.from_json(hash = {}, prefix)
|
7
7
|
self.new(prefix) do |nation|
|
@@ -13,7 +13,7 @@ module Infostrada
|
|
13
13
|
|
14
14
|
def initialize(hash = {}, prefix, &block)
|
15
15
|
hash.each do |key, value|
|
16
|
-
match = key.
|
16
|
+
match = key.info_snake_case.match(/[cn]_#{prefix}_?(natio\w*)$/)
|
17
17
|
self.send("#{$1}=", value) if match
|
18
18
|
end
|
19
19
|
|
@@ -12,24 +12,24 @@ module Infostrada
|
|
12
12
|
|
13
13
|
info = get!(URL, query: { personid: id }).first
|
14
14
|
|
15
|
-
|
15
|
+
new(id, info)
|
16
16
|
end
|
17
17
|
|
18
18
|
def initialize(id, info)
|
19
19
|
@id = id
|
20
20
|
|
21
21
|
# Sometimes info comes as an empty array...
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
22
|
+
return unless info && !info.empty?
|
23
|
+
|
24
|
+
@first_name = info['c_FirstName']
|
25
|
+
@last_name = info['c_LastName']
|
26
|
+
@public_name = info['c_PublicName']
|
27
|
+
@nickname = info['c_Nickname']
|
28
|
+
@birthdate = Formatter.format_date(info['d_BirthDate'])
|
29
|
+
@height = info['n_Height']
|
30
|
+
@weight = info['n_Weight']
|
31
|
+
@birth_city = info['c_BirthCity']
|
32
|
+
@birth_country = info['c_BirthCountry']
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/lib/infostrada/phase.rb
CHANGED
@@ -24,17 +24,14 @@ module Infostrada
|
|
24
24
|
|
25
25
|
list = get!(URL, query: { editionid: edition_id.to_i })
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
phases << Phase.new(phase_hash)
|
27
|
+
list.map do |phase_hash|
|
28
|
+
Phase.new(phase_hash)
|
30
29
|
end
|
31
|
-
|
32
|
-
phases
|
33
30
|
end
|
34
31
|
|
35
32
|
# Useful method to get a Phase object from a json serialized Phase object.
|
36
33
|
def self.from_json(json = {})
|
37
|
-
|
34
|
+
new do |phase|
|
38
35
|
phase.id = json['id']
|
39
36
|
phase.name = json['name']
|
40
37
|
phase.level = json['level']
|
@@ -48,16 +45,11 @@ module Infostrada
|
|
48
45
|
phase.has_table = json['has_table']
|
49
46
|
phase.current = json['current']
|
50
47
|
phase.currents = json['currents']
|
51
|
-
phase.start_date = Date.parse(json['start_date']) if json['start_date']
|
52
|
-
phase.end_date = Date.parse(json['end_date'])
|
48
|
+
phase.start_date = Date.parse(json['start_date'].to_s) if json['start_date']
|
49
|
+
phase.end_date = Date.parse(json['end_date'].to_s) if json['end_date']
|
53
50
|
end
|
54
51
|
end
|
55
52
|
|
56
|
-
# Get the classification table for this phase.
|
57
|
-
def table
|
58
|
-
Table.where(phase_id: id)
|
59
|
-
end
|
60
|
-
|
61
53
|
def initialize(hash = {}, &block)
|
62
54
|
@id = hash['n_PhaseID']
|
63
55
|
@name = hash['c_Phase']
|
@@ -84,6 +76,12 @@ module Infostrada
|
|
84
76
|
self
|
85
77
|
end
|
86
78
|
|
79
|
+
# Get the classification table for this phase.
|
80
|
+
def table
|
81
|
+
Table.where(phase_id: id)
|
82
|
+
end
|
83
|
+
|
84
|
+
|
87
85
|
def has_table?
|
88
86
|
@has_table
|
89
87
|
end
|
data/lib/infostrada/player.rb
CHANGED
@@ -48,17 +48,17 @@ module Infostrada
|
|
48
48
|
def set_season_stats(hash)
|
49
49
|
@season_stats = {}
|
50
50
|
|
51
|
-
@season_stats[:matches]
|
52
|
-
@season_stats[:matches_start]
|
53
|
-
@season_stats[:matches_out]
|
54
|
-
@season_stats[:matches_in]
|
55
|
-
@season_stats[:minutes_played]
|
56
|
-
@season_stats[:goals]
|
57
|
-
@season_stats[:own_goals]
|
58
|
-
@season_stats[:assists]
|
59
|
-
@season_stats[:cards_yellow]
|
60
|
-
@season_stats[:cards_red]
|
61
|
-
@season_stats[:cards_red_direct]
|
51
|
+
@season_stats[:matches] = hash['n_Matches']
|
52
|
+
@season_stats[:matches_start] = hash['n_MatchesStart']
|
53
|
+
@season_stats[:matches_out] = hash['n_MatchesOut']
|
54
|
+
@season_stats[:matches_in] = hash['n_MatchesIn']
|
55
|
+
@season_stats[:minutes_played] = hash['n_MinutesPlayed']
|
56
|
+
@season_stats[:goals] = hash['n_Goals']
|
57
|
+
@season_stats[:own_goals] = hash['n_OwnGoals']
|
58
|
+
@season_stats[:assists] = hash['n_Assists']
|
59
|
+
@season_stats[:cards_yellow] = hash['n_CardsYellow']
|
60
|
+
@season_stats[:cards_red] = hash['n_CardsRed']
|
61
|
+
@season_stats[:cards_red_direct] = hash['n_CardsRedDirect']
|
62
62
|
@season_stats[:cards_red_from_yellow] = hash['n_CardsRed2Yellow']
|
63
63
|
end
|
64
64
|
end
|
data/lib/infostrada/squad.rb
CHANGED
@@ -10,12 +10,9 @@ module Infostrada
|
|
10
10
|
|
11
11
|
list = get!(URL, query: { editionid: edition_id, teamid: team_id })
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
players << Player.new(player_hash)
|
13
|
+
list.map do |player_hash|
|
14
|
+
Player.new(player_hash)
|
16
15
|
end
|
17
|
-
|
18
|
-
players
|
19
16
|
end
|
20
17
|
end
|
21
|
-
end
|
18
|
+
end
|
data/lib/infostrada/team.rb
CHANGED
@@ -6,15 +6,15 @@ module Infostrada
|
|
6
6
|
def_delegator :@nation, :name, :nation_name
|
7
7
|
def_delegator :@nation, :short_name, :nation_short_name
|
8
8
|
|
9
|
-
attr_accessor :id, :name, :short_name, :nation, :edition_id
|
9
|
+
attr_accessor :id, :name, :short_name, :nation, :edition_id, :details
|
10
10
|
|
11
11
|
def self.where(options = {})
|
12
12
|
edition_id = options.delete(:edition_id)
|
13
|
-
|
13
|
+
TeamRequest.get_edition(edition_id.to_i)
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.from_json(json = {}, prefix)
|
17
|
-
|
17
|
+
new(prefix) do |team|
|
18
18
|
team.id = json['id']
|
19
19
|
team.name = json['name']
|
20
20
|
team.short_name = json['short_name']
|
@@ -27,7 +27,7 @@ module Infostrada
|
|
27
27
|
@edition_id = hash['edition_id']
|
28
28
|
|
29
29
|
hash.each do |key, value|
|
30
|
-
case key.
|
30
|
+
case key.info_snake_case
|
31
31
|
when /^[cn]\w+#{prefix}_?team_id$/
|
32
32
|
self.send('team_id=', value)
|
33
33
|
when /^[cn]\w+#{prefix}_?team$/
|