{"id":15550612,"url":"https://github.com/connorshea/wikidatum","last_synced_at":"2025-04-23T20:23:21.790Z","repository":{"id":37235300,"uuid":"505253674","full_name":"connorshea/wikidatum","owner":"connorshea","description":"Interact with the Wikidata/Wikibase REST API from Ruby.","archived":false,"fork":false,"pushed_at":"2023-08-05T19:21:26.000Z","size":176,"stargazers_count":13,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T17:05:27.444Z","etag":null,"topics":["ruby","ruby-gem","wikidata","wikidata-api"],"latest_commit_sha":null,"homepage":"https://connorshea.github.io/wikidatum/","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/connorshea.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}},"created_at":"2022-06-20T00:58:27.000Z","updated_at":"2025-03-06T09:27:02.000Z","dependencies_parsed_at":"2024-10-02T14:00:40.096Z","dependency_job_id":"fde73fdd-9789-48b3-8ee2-7409a70a8024","html_url":"https://github.com/connorshea/wikidatum","commit_stats":{"total_commits":199,"total_committers":1,"mean_commits":199.0,"dds":0.0,"last_synced_commit":"3c58ffe692b310174a9dfb23b1754b27ea61bab1"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connorshea%2Fwikidatum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connorshea%2Fwikidatum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connorshea%2Fwikidatum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connorshea%2Fwikidatum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/connorshea","download_url":"https://codeload.github.com/connorshea/wikidatum/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250506901,"owners_count":21441875,"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":["ruby","ruby-gem","wikidata","wikidata-api"],"created_at":"2024-10-02T14:00:26.130Z","updated_at":"2025-04-23T20:23:21.765Z","avatar_url":"https://github.com/connorshea.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wikidatum\n\nThis gem supports making requests to the [new Wikidata/Wikibase REST API](https://doc.wikimedia.org/Wikibase/master/js/rest-api/).\n\nThe [Wikimedia Docs on the Wikibase REST API data format differences](https://doc.wikimedia.org/Wikibase/master/php/rest_data_format_differences.html) are also very useful for interacting with/contributing to this gem.\n\n**The gem is currently in development. It's ready to be used, but you should be careful when making edits with it to ensure it's working correctly.** It's missing some key features, namely authentication support, but the core of the library works.\n\nI reserve the right to make breaking changes while the library is still in the 0.x release series, although I'll avoid them unless I believe them to be significantly better for the library's usability/maintainability (or are necessary due to breaking changes in the REST API itself). If they do happen, I'll make them clear in the Changelog.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'wikidatum'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install wikidatum\n\n## Usage\n\nYou can view the YARD docs on GitHub Pages [here](https://connorshea.github.io/wikidatum/index.html). Generally, you'll want to look at the docs for {Wikidatum::Client} to get started.\n\nCurrently, the gem is able to hit a few of the basic endpoints, and currently has no way to provide authentication. The additional features will be added later.\n\n```ruby\nrequire 'wikidatum'\n\nwikidatum_client = Wikidatum::Client.new(\n  user_agent: 'REPLACE ME WITH THE NAME OF YOUR BOT!',\n  wikibase_url: 'https://www.wikidata.org',\n  # NOTE: To edit as a bot, you need to authenticate as a user with the Bot\n  # flag. If you don't have that flag on your Wikibase User, you'll get a\n  # 403 error.\n  bot: true\n)\n\n# Get an item from the Wikibase instance.\nitem = wikidatum_client.item(id: 'Q2') #=\u003e Wikidatum::Item\n\n# Get the statements from the item.\nitem.statements #=\u003e Array\u003cWikidatum::Statement\u003e\n\n# Get the statments for property P123 on the item.\nitem.statements(properties: ['P123']) #=\u003e Array\u003cWikidatum::Statement\u003e\n\n# Get all the labels for the item.\nitem.labels #=\u003e Array\u003cWikidatum::Term\u003e\n\n# Get the English label for the item.\nitem.label(lang: :en) #=\u003e Wikidatum::Term\n\n# Get the actual value for the label.\nitem.label(lang: :en).value #=\u003e \"Earth\"\n\n# Get the values for all English aliases on this item.\nitem.aliases(langs: [:en]).map(\u0026:value) #=\u003e [\"Planet Earth\", \"Pale Blue Dot\"]\n\n# Get all labels for a given item.\nwikidatum_client.labels(id: 'Q2') #=\u003e Array\u003cWikidatum::Term\u003e\n\n# Get a specific statement from its ID.\nstatement_id = 'Q123$4543523c-1d1d-1111-1e1e-11b11111b1f1'\nstatement = wikidatum_client.statement(id: statement_id) #=\u003e Wikidatum::Statement\n\n# Add a statement to Q193581 for P577 (publication date) that has a time value of November 16, 2004.\nwikidatum_client.add_statement(\n  id: 'Q193581',\n  property: 'P577',\n  value: Wikidatum::DataType::Time.new(\n    time: '+2004-11-16T00:00:00Z',\n    precision: 11,\n    calendar_model: 'https://www.wikidata.org/entity/Q12138'\n  )\n)\n\n# Delete a statement and include an edit summary.\nwikidatum_client.delete_statement(\n  id: 'Q123$4543523c-1d1d-1111-1e1e-11b11111b1f1',\n  comment: 'Deleting this statement because it is inaccurate.'\n)\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` 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/connorshea/wikidatum.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconnorshea%2Fwikidatum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconnorshea%2Fwikidatum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconnorshea%2Fwikidatum/lists"}