Sha256: 0ad9082cfbc8a0d8b1af524e4a96211645a23c5d44c1d583fd54aacdcaa3bbc7
Contents?: true
Size: 938 Bytes
Versions: 5
Compression:
Stored size: 938 Bytes
Contents
module Sportradar module Api module Football class Situation < Data attr_accessor :response, :clock, :down, :yfd, :possession, :location, :team_id def initialize(data) @response = data @clock = data["clock"] @down = data["down"] @yfd = data["yfd"] @possession = OpenStruct.new(data["possession"]) if data["possession"] if data["location"] @location = OpenStruct.new(data["location"]) elsif data['side'] && data['yard_line'] @location = OpenStruct.new(alias: data['side'], yardline: data['yard_line']) end @team_id = possession&.id || data["team"] end def spot [location&.alias, location&.yardline].compact.join(' ') end def down_distance [@down, @distance].compact.join(' & ') end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems