Sha256: 82233db490913f6e920aad6f344160f7e843f291d7d02a379ea294959dfe0fc4

Contents?: true

Size: 802 Bytes

Versions: 7

Compression:

Stored size: 802 Bytes

Contents

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

      alias :count :penalties

      def set_stats
        @response  = response[1] if response.is_a? Array
        @penalties = response['penalties']
        @yards     = response['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

7 entries across 7 versions & 1 rubygems

Version Path
sportradar-api-0.1.38 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.1.37 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.1.36 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.1.35 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.1.34 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.1.33 lib/sportradar/api/football/stat_pack/penalties.rb
sportradar-api-0.1.32 lib/sportradar/api/football/stat_pack/penalties.rb