Sha256: df0ac460911e702b4d2097cfc7769ee29d0fe033aa45031338c0a804d0b03deb

Contents?: true

Size: 1.05 KB

Versions: 125

Compression:

Stored size: 1.05 KB

Contents

module Sportradar
  module Api
    class Content::Article < Data
      attr_accessor :response, :type, :created, :updated, :injury, :transaction, :title, :byline, :dateline, :credit, :content, :references, :provider

      def initialize(data)
        @response = data
        @created = Time.parse(data["created"]) if data["created"]
        @updated = Time.parse(data["updated"]) if data["updated"]
        @type = data["type"]
        @injury = data["injury"]
        @transaction = data["transaction"]
        @title = data["title"]
        @byline = data["byline"]
        @dateline = data["dateline"]
        @credit = data["credit"]
        @content = data["content"]["long"] if data["content"] && data["content"]["long"]
        @provider = OpenStruct.new(data["provider"]) if data["provider"]
        @references = parse_into_array(selector: response["refs"], klass: Sportradar::Api::Content::Reference) if response["refs"]
      end

      def transaction?
        transaction == 'true'
      end

      def injury?
        injury == 'true'
      end

    end
  end
end

Version data entries

125 entries across 125 versions & 1 rubygems

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