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.17.1 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.17.0 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.17.0.pre lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.16.1 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.16.0 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.15.1 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.15.0 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.14.0 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.13.26 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.13.25 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.13.24 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.13.23 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.13.22 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.13.21 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.13.20 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.13.19 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.13.18 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.13.17 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.13.16 lib/sportradar/api/soccer/lineup.rb
sportradar-api-0.13.15 lib/sportradar/api/soccer/lineup.rb