Sha256: 2d853404c618bd65cdc3d4e3c041a04a301c1044c9c1302ba7c006994fe2e4ac

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

module Sportradar
  module Api
    module Basketball
      class Injury < Data
        attr_accessor :response, :id, :comment, :descripton, :status, :start_date, :update_date

        def initialize(data, **opts)
          @response = data
          update(data, **opts)
        end

        def update(data, **opts)
          @id           = data.dig('injury', 'id')
          @comment      = data.dig('injury', 'comment')
          @descripton   = data.dig('injury', 'desc')
          @status       = data.dig('injury', 'status')
          @start_date   = data.dig('injury', 'start_date')
          @update_date  = data.dig('injury', 'update_date')
        end

        def out?
          @status == 'Out'
        end

        private def sample_data
          {
            "injury" => {
              "id"         => "069a9d3f-036e-4dab-9b49-d2e75082230e",
              "comment"    => "Paul will have surgery to repair torn ligaments in his left thumb and is expected to be out for six-to-eight weeks to recover, according to a report from ESPN.com.",
              "desc"       => "Thumb",
              "status"     => "Out",
              "start_date" => "2017-01-17",
              "update_date"=> "2017-01-17"
            }
          }
        end

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sportradar-api-0.9.59 lib/sportradar/api/basketball/injury.rb
sportradar-api-0.9.58 lib/sportradar/api/basketball/injury.rb
sportradar-api-0.9.57 lib/sportradar/api/basketball/injury.rb
sportradar-api-0.9.56 lib/sportradar/api/basketball/injury.rb
sportradar-api-0.9.55 lib/sportradar/api/basketball/injury.rb
sportradar-api-0.9.54 lib/sportradar/api/basketball/injury.rb