Sha256: 4f5f95bf982f7937ea339aa2a6b6e7452a604f8fa529d90e4fe4280322d7bcb9

Contents?: true

Size: 1.09 KB

Versions: 115

Compression:

Stored size: 1.09 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"]["ref"], klass: Sportradar::Api::Content::Reference) if response["refs"] && response["refs"]["ref"]
      end

      def transaction?
        transaction == 'true'
      end

      def injury?
        injury == 'true'
      end

    end
  end
end

Version data entries

115 entries across 115 versions & 1 rubygems

Version Path
sportradar-api-0.9.35 lib/sportradar/api/content/article.rb
sportradar-api-0.9.34 lib/sportradar/api/content/article.rb
sportradar-api-0.9.33 lib/sportradar/api/content/article.rb
sportradar-api-0.9.32 lib/sportradar/api/content/article.rb
sportradar-api-0.9.31 lib/sportradar/api/content/article.rb
sportradar-api-0.9.30 lib/sportradar/api/content/article.rb
sportradar-api-0.9.29 lib/sportradar/api/content/article.rb
sportradar-api-0.9.28 lib/sportradar/api/content/article.rb
sportradar-api-0.9.27 lib/sportradar/api/content/article.rb
sportradar-api-0.9.26 lib/sportradar/api/content/article.rb
sportradar-api-0.9.25 lib/sportradar/api/content/article.rb
sportradar-api-0.9.24 lib/sportradar/api/content/article.rb
sportradar-api-0.9.23 lib/sportradar/api/content/article.rb
sportradar-api-0.9.22 lib/sportradar/api/content/article.rb
sportradar-api-0.9.21 lib/sportradar/api/content/article.rb
sportradar-api-0.9.20 lib/sportradar/api/content/article.rb
sportradar-api-0.9.19 lib/sportradar/api/content/article.rb
sportradar-api-0.9.18 lib/sportradar/api/content/article.rb
sportradar-api-0.9.17 lib/sportradar/api/content/article.rb
sportradar-api-0.9.16 lib/sportradar/api/content/article.rb