Sha256: df968f8ecec54d5f16e8ca6fd383d06739b9687f3ee03b59c315f4d5ae2e1124

Contents?: true

Size: 819 Bytes

Versions: 112

Compression:

Stored size: 819 Bytes

Contents

module Sportradar
  module Api
    class Football::StatPack::Penalties < Football::StatPack
      attr_accessor :penalties, :yards

      alias :count :penalties

      def set_stats
        @response  = (response.dig(1) || {}) if response.is_a? Array
        @penalties = response.dig('penalties')
        @yards     = response.dig('yards')
      end

      def formatted
        "#{count}-#{yards}"
      end
    end

  end
end

# # sample response
# example_penalty_hash =
#   ["7",
#     {"player"=>
#       [{"name"=>"Curtis Grant",
#         "jersey"=>"58",
#         "reference"=>"00-0032084",
#         "id"=>"b807020d-d9c8-4fd0-9acb-fb61ddffae50",
#         "position"=>"LB",
#         "penalties"=>"1",
#         "yards"=>"5"},
#         # ...
#       ],
#     "penalties"=>"7",
#     "yards"=>"58"
#   }
# ]

Version data entries

112 entries across 112 versions & 1 rubygems

Version Path
sportradar-api-0.9.32 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.31 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.30 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.29 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.28 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.27 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.26 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.25 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.24 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.23 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.22 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.21 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.20 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.19 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.18 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.17 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.16 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.15 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.14 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.9.13 lib/sportradar/api/football/stat_pack/penalties.rb