Top Level Namespace

Defined Under Namespace

Modules: Footballdata, FootballdataApi Classes: Stages, Teams

Instance Method Summary collapse

Instance Method Details

say hello



51
# File 'lib/footballdata.rb', line 51

puts FootballdataApi.banner

#build_team(h) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/footballdata/convert-teams.rb', line 46

def build_team( h )

  ##
  ## note:  convert country code to "standard" fifa code
  ##        use official fifa country code
   country_name = h['area']['name']

   country = Fifa.world.find_by_name( country_name )
   if country.nil?
     raise ArgumentError, "[fifa world] no country record found for #{country_name} for: #{h.inspect}"
   end

   country_code =  country.code


      rec = { id:         h['id'],
              name:       h['name'],
              short_name: h['shortName'],
              code:       h['tla'],
              address:    h['address'],    ###  street / city / postal_code
              founded:    h['founded'],
              ground:     h['venue'],     ### use stadium or venue ??

              ##
              ##  or use country { code:, name }
              ## change to cc (country code) - why? why not?
              country:   {   name: country_name,
                             code: country_code,
                             code_bak: h['area']['code'] },

              count:      0,   ## track - match counts
        }

     rec
end

#leaguesObject

3rd party (our own)



2
# File 'lib/footballdata.rb', line 2

require 'leagues'