<commit_before>require 'test_helper'

class TestResource < JsonApiClient::Resource
  self.site = "http://localhost:3000/"
  self.parser = JsonApiClient::Parsers::Parser
end

class Article < TestResource
end

class ParserTest < MiniTest::Unit::TestCase

  def test_can_parse_single_record
    stub_request(:get, "http://localhost:3000/articles/1.json")
      .to_return(headers: {content_type: "application/vnd.api+json"}, body: {
        data: {
          type: "articles",
          id: 1,
          title: "Rails is Omakase",
          links: {
            author: {
              self: "/articles/1/links/author",
              related: "/articles/1/author",
              linkage: { type: "people", id: 9 }
            }
          }
        }
      }.to_json)
    articles = Article.find(1)

    assert articles.is_a?(JsonApiClient::ResultSet)
    assert_equal 1, articles.length

    article = articles.first
    assert_equal 1, article.id
    assert_equal "Rails is Omakase", article.title
  end

end<commit_msg>'Each resource object MUST contain an `id` member, whose value MUST be a string.'<commit_after>require 'test_helper'

class TestResource < JsonApiClient::Resource
  self.site = "http://localhost:3000/"
  self.parser = JsonApiClient::Parsers::Parser
end

class Article < TestResource
end

class ParserTest < MiniTest::Unit::TestCase

  def test_can_parse_single_record
    stub_request(:get, "http://localhost:3000/articles/1.json")
      .to_return(headers: {content_type: "application/vnd.api+json"}, body: {
        data: {
          type: "articles",
          id: "1",
          title: "Rails is Omakase",
          links: {
            author: {
              self: "/articles/1/links/author",
              related: "/articles/1/author",
              linkage: { type: "people", id: 9 }
            }
          }
        }
      }.to_json)
    articles = Article.find(1)

    assert articles.is_a?(JsonApiClient::ResultSet)
    assert_equal 1, articles.length

    article = articles.first
    assert_equal "1", article.id
    assert_equal "Rails is Omakase", article.title
  end

end
{'fraction_non_alphanumeric': 0.11954459203036052, 'fraction_numerical': 0.015180265654648957, 'mean_word_length': 2.4975124378109452, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4005512', 'n_tokens_mistral': 668, 'n_tokens_neox': 633, 'n_words': 142}