Sha256: 6de27f2c26ece0a6e78a4ff3a4e5819b1e6fac5e0973bc6a6a2c88f6b97681cf

Contents?: true

Size: 1.07 KB

Versions: 55

Compression:

Stored size: 1.07 KB

Contents

module Sportradar
  module Api
    module Soccer
      class Lineup < Data
        attr_reader :id, :team, :manager, :jersey, :starting_lineup, :substitutes

        def initialize(data, **opts)
          @response     = data
          @id           = data["team"]

          @starting_hash  = {}
          @subs_hash      = {}

          update(data, **opts)
        end
        def update(data, **opts)
          @team     = data['team']                    if data['team']
          @manager  = OpenStruct.new(data['manager']) if data['manager']
          @jersey   = OpenStruct.new(data['jersey'])  if data['jersey']
          # @starting_lineup  = data['starting_lineup'] if data['starting_lineup']
          # @substitutes      = data['substitutes']     if data['substitutes']

          create_data(@starting_hash, data['starting_lineup'], klass: Player, api: opts[:api], lineup: self) if data['starting_lineup']
          create_data(@subs_hash,     data['substitutes'],     klass: Player, api: opts[:api], lineup: self) if data['substitutes']
        end

      end

    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
sportradar-api-0.20.2 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.20.1 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.20.0 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.20.0.pre2 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.20.0.pre lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.19.6 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.19.5 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.19.4 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.19.3 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.19.2 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.19.1 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.19.0 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.18.1 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.18.0 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.17.6 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.17.5 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.17.5.pre lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.17.4 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.17.3 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.17.2 lib/sportradar/api/soccer/lineup.rb