{"id":23572577,"url":"https://github.com/ryanjamescaldwell/chess_api","last_synced_at":"2025-06-24T21:36:45.183Z","repository":{"id":46100116,"uuid":"401188229","full_name":"RyanJamesCaldwell/chess_api","owner":"RyanJamesCaldwell","description":"chess_api is a Ruby gem that wraps the Chess.com API.","archived":false,"fork":false,"pushed_at":"2023-07-04T14:22:04.000Z","size":66,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-02T14:58:46.079Z","etag":null,"topics":["api-wrapper","chess","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RyanJamesCaldwell.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-08-30T02:04:44.000Z","updated_at":"2024-06-03T17:41:08.000Z","dependencies_parsed_at":"2025-05-05T16:13:48.444Z","dependency_job_id":"10fae5c6-07c1-494e-a88d-c0f7a3fc3599","html_url":"https://github.com/RyanJamesCaldwell/chess_api","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/RyanJamesCaldwell/chess_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanJamesCaldwell%2Fchess_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanJamesCaldwell%2Fchess_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanJamesCaldwell%2Fchess_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanJamesCaldwell%2Fchess_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RyanJamesCaldwell","download_url":"https://codeload.github.com/RyanJamesCaldwell/chess_api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanJamesCaldwell%2Fchess_api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261760019,"owners_count":23205649,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-wrapper","chess","ruby"],"created_at":"2024-12-26T20:37:56.269Z","updated_at":"2025-06-24T21:36:45.141Z","avatar_url":"https://github.com/RyanJamesCaldwell.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChessApi\n\n[![Gem Version](https://badge.fury.io/rb/chess_api.svg)](https://badge.fury.io/rb/chess_api)\n[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)\n![CI](https://github.com/RyanJamesCaldwell/chess_api/actions/workflows/ruby.yml/badge.svg?branch=main)\n\n\n`chess_api` is a gem that wraps [Chess.com's Published-Data API](https://www.chess.com/news/view/published-data-api).\n\n## Installation\n\n### Codespaces\n\n[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true\u0026ref=main\u0026repo=401188229)\n\n### Add to an existing project\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'chess_api'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install chess_api\n\n## Usage\n\nTo interact with the `ChessApi`, you'll first need to create a client object. You have the option of specifying a [Faraday adapter](https://lostisland.github.io/faraday/adapters/).\n\n```ruby\nclient = ChessApi::Client.new\n# or\nclient = ChessApi::Client.new(adapter: your_adapter_here)\n```\n\nFrom there, you'll be able to perform several operations:\n\n### Fetch a player on Chess.com by username\n\n```ruby\nirb(main):018:0\u003e player = client.player.retrieve(username: \"GothamChess\")\n=\u003e\n#\u003cChessApi::Player:0x000000013bc41198\n...\n\nirb(main):019:0\u003e player.username\n=\u003e \"gothamchess\"\n\nirb(main):020:0\u003e player.title\n=\u003e \"IM\"\n\nirb(main):021:0\u003e player.is_streamer\n=\u003e true\n\nirb(main):022:0\u003e player.twitch_url\n=\u003e \"https://twitch.tv/GothamChess\"\n```\n\nAs you can see in the example above, you can access the fields returned by the Chess.com API through standard Ruby method syntax.\n\n### Fetching a list of players with a particular title on Chess.com\n\n```ruby\nirb(main):001:0\u003e client.titled_player.with_title(title_abbreviation: \"WGM\")\n=\u003e\n#\u003cChessApi::Collection:0x000000013ecc78d0\n @data=\n  [#\u003cChessApi::TitledPlayer:0x000000013f175d78 @attributes=#\u003cOpenStruct username=\"abrahamyan-la\"\u003e\u003e,\n   #\u003cChessApi::TitledPlayer:0x000000013f175620 @attributes=#\u003cOpenStruct username=\"adriananikolova\"\u003e\u003e,\n   #\u003cChessApi::TitledPlayer:0x000000013f175260 @attributes=#\u003cOpenStruct username=\"advantagelucy\"\u003e\u003e,\n   #\u003cChessApi::TitledPlayer:0x000000013f174ec8 @attributes=#\u003cOpenStruct username=\"ahachess\"\u003e\u003e,\n   ...\n  ]\n```\n\n### Fetching a player's online status on Chess.com\n```ruby\nirb(main):001:0\u003e client.player.online_status(username: \"hikaru\")\n=\u003e \"offline\"\n\nirb(main):002:0\u003e client.player.online_status(username: \"ryanjcaldwell\")\n=\u003e \"online\"\n```\n\n### Fetching the clubs that a player belongs to on Chess.com\n```ruby\nirb(main):001:0\u003e clubs = client.player.clubs(username: \"GothamChess\")\n=\u003e\n#\u003cChessApi::Collection:0x000000015dbe5998\n...\n\nirb(main):002:0\u003e clubs.data.map { |club| [club.name, club.joined] }\n=\u003e\n[[\"Chess.comTV\", 1533262149],\n [\"Hikaru Nakamura Fan Club\", 1547248727],\n [\"Chess.com Beta\", 1572489771],\n [\"PRO Chess League\", 1547048660],\n [\"Streamers\", 1533671931],\n [\"4 Player Chess\", 1533746676],\n [\"Gotham's Mob\", 1528247350],\n [\"Arena Kings Championship Season 5\", 1575824630],\n [\"Marshall Chess Club Official - Match Team\", 1587681476],\n [\"Fiona's Fight Club\", 1616428995]]\n```\n\n### Fetching the monthly game archive links for a player on Chess.com\n```ruby\nirb(main):001:0\u003e result = client.monthly_game_archive.list(username: \"ryanjcaldwell\")\n=\u003e\n#\u003cChessApi::Collection:0x0000000153351480\n...\n\nirb(main):002:0\u003e result.data.first.url\n=\u003e \"https://api.chess.com/pub/player/ryanjcaldwell/games/2019/03\"\n```\n\n### Fetching the Daily Puzzle from Chess.com\n```ruby\nirb(main):001:0\u003e daily_puzzle = client.daily_puzzle.retrieve\n=\u003e\n#\u003cChessApi::DailyPuzzle:0x000000012d98b218\n...\n\nirb(main):002:0\u003e daily_puzzle.title\n=\u003e \"Disconnecting Connection\"\n\nirb(main):003:0\u003e daily_puzzle.pgn\n=\u003e \"[Result \\\"*\\\"]\\r\\n[FEN \\\"3rb3/5pk1/2n1pn1p/rp3Pp1/6P1/1P2B2P/2R3BK/R3N3 w - - 0 1\\\"]\\r\\n\\r\\n1.Rxa5 Nxa5 2.Bb6 Rd1 3.Bxa5 *\"\n\nirb(main):004:0\u003e daily_puzzle.image\n=\u003e \"https://www.chess.com/dynboard?fen=3rb3/5pk1/2n1pn1p/rp3Pp1/6P1/1P2B2P/2R3BK/R3N3%20w%20-%20-%200%201\u0026size=2\"\n```\n\n### Fetching a random Daily Puzzle from Chess.com\n```ruby\nirb(main):001:0\u003e random_daily_puzzle = client.daily_puzzle.random\n=\u003e\n#\u003cChessApi::DailyPuzzle:0x000000014740e5a0\n...\n\nirb(main):002:0\u003e random_daily_puzzle.publish_time\n=\u003e 1306047600\n\nirb(main):003:0\u003e random_daily_puzzle.pgn\n=\u003e \"[Date \\\"????.??.??\\\"]\\r\\n[Result \\\"*\\\"]\\r\\n[FEN \\\"1B6/1p4Rp/p4kp1/8/8/8/Pr4PP/6K1 b - - 0 1\\\"]\\r\\n\\r\\n1...Rb1+ 2. Kf2 Kxg7\\r\\n*\"\n\nirb(main):004:0\u003e random_daily_puzzle.url\n=\u003e \"https://www.chess.com/forum/view/daily-puzzles/5222011---eluding-danger\"\n```\n\n### Fetching streamers on Chess.com\n```ruby\nirb(main):001:0\u003e streamers = client.streamer.list\n=\u003e\n#\u003cChessApi::Collection:0x000000013a5bd7a0\n...\n\nirb(main):002:0\u003e streamers.data.first\n=\u003e\n#\u003cChessApi::Streamer:0x000000013a49b200\n @attributes=\n  #\u003cOpenStruct username=\"QTCinderella\", avatar=\"https://betacssjs.chesscomfiles.com/bundles/web/images/noavatar_l.84a92436.gif\", twitch_url=\"https://twitch.tv/QTCinderella\", url=\"https://www.chess.com/member/QTCinderella\", is_live=true\u003e\u003e\n\nirb(main):003:1* streamers.data.first(3).map do |streamer|\nirb(main):004:1*   [streamer.url, streamer.twitch_url, streamer.is_live]\nirb(main):005:0\u003e end\n=\u003e\n[[\"https://www.chess.com/member/QTCinderella\", \"https://twitch.tv/QTCinderella\", true],\n [\"https://www.chess.com/member/GMKrikor\", \"https://twitch.tv/gmkrikor\", true],\n [\"https://www.chess.com/member/jppeixoto29\", \"https://twitch.tv/jppeixoto29\", true]]\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/RyanJamesCaldwell/chess_api.\n\n\n## License\n\nThe gem is available as open source under the terms of the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanjamescaldwell%2Fchess_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanjamescaldwell%2Fchess_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanjamescaldwell%2Fchess_api/lists"}