Sha256: 4483f0c0b440a747ded585bebdcc7425d4bb5cc42dd4cf45fd1f7ed048bf4834

Contents?: true

Size: 1.71 KB

Versions: 128

Compression:

Stored size: 1.71 KB

Contents

module Sportradar
  module Api
    class Football::StatPack::ExtraPoints < Football::StatPack
      attr_accessor :attempts, :pct, :made, :blocked, :pass_attempts, :pass_successes, :rush_attempts, :rush_successes, :defense_attempts, :defense_successes, :turnover_successes

      def set_stats
        kick_data = response['kicks'] || response['totals'] || response
        @attempts = kick_data["attempts"] || kick_data["att"]
        @made     = kick_data["made"]
        @blocked  = kick_data["blocked"] || kick_data["blk"]
        @pct      = kick_data["pct"] || (@made.to_f / @attempts.to_i)
        if response['conversions']
          @pass_attempts      = response["pass_attempts"]
          @pass_successes     = response["pass_successes"]
          @rush_attempts      = response["rush_attempts"]
          @rush_successes     = response["rush_successes"]
          @defense_attempts   = response["defense_attempts"]
          @defense_successes  = response["defense_successes"]
          @turnover_successes = response["turnover_successes"]
        end
      end

    end
  end
end

# # sample response
# extra_points =
#   {"kicks"=>
#     {"player"=>
#       [
#        {"name"=>"Aldrick Rosas",
#         "jersey"=>"03",
#         "reference"=>"00-0032870",
#         "id"=>"8fb2ca06-3d13-4552-98e0-7b913b4ab5b9",
#         "position"=>"K",
#         "attempts"=>"1",
#         "made"=>"1",
#         "blocked"=>"0"}],
#      "attempts"=>"3",
#      "blocked"=>"0",
#      "made"=>"3"},
#   "conversions"=> {
#     "pass_attempts"=>"0",
#     "pass_successes"=>"0",
#     "rush_attempts"=>"0",
#     "rush_successes"=>"0",
#     "defense_attempts"=>"0",
#     "defense_successes"=>"0",
#     "turnover_successes"=>"0"
#     }
#   }

Version data entries

128 entries across 128 versions & 1 rubygems

Version Path
sportradar-api-0.20.2 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.20.1 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.20.0 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.20.0.pre2 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.20.0.pre lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.19.6 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.19.5 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.19.4 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.19.3 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.19.2 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.19.1 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.19.0 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.18.1 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.18.0 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.17.6 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.17.5 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.17.5.pre lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.17.4 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.17.3 lib/sportradar/api/football/stat_pack/extra_points.rb
sportradar-api-0.17.2 lib/sportradar/api/football/stat_pack/extra_points.rb