Sha256: 5f0c520096775da4756dabce0ab7508d3070b9c41571e6051cd875b91de47685

Contents?: true

Size: 857 Bytes

Versions: 128

Compression:

Stored size: 857 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') || response['num']
        @yards     = response.dig('yards') || response['yds']
      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

128 entries across 128 versions & 1 rubygems

Version Path
sportradar-api-0.17.1 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.17.0 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.17.0.pre lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.16.1 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.16.0 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.15.1 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.15.0 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.14.0 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.13.26 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.13.25 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.13.24 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.13.23 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.13.22 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.13.21 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.13.20 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.13.19 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.13.18 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.13.17 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.13.16 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.13.15 lib/sportradar/api/football/stat_pack/penalties.rb