wikidata_adaptor 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.env.test +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +45 -0
- data/.yardopts +10 -0
- data/CHANGELOG.md +106 -0
- data/CLAUDE.md +200 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/COVERAGE.md +77 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +124 -0
- data/LICENSE.txt +21 -0
- data/README.md +269 -0
- data/Rakefile +18 -0
- data/integration/.env.example +20 -0
- data/integration/README.md +58 -0
- data/integration/config/99_IntegrationTesting.php +3 -0
- data/integration/config/wikibase-php.ini +15 -0
- data/integration/docker-compose.yml +98 -0
- data/lib/wikidata_adaptor/rest_api/aliases.rb +88 -0
- data/lib/wikidata_adaptor/rest_api/descriptions.rb +138 -0
- data/lib/wikidata_adaptor/rest_api/items.rb +36 -0
- data/lib/wikidata_adaptor/rest_api/labels.rb +138 -0
- data/lib/wikidata_adaptor/rest_api/open_api_document.rb +15 -0
- data/lib/wikidata_adaptor/rest_api/properties.rb +36 -0
- data/lib/wikidata_adaptor/rest_api/property_data_types.rb +15 -0
- data/lib/wikidata_adaptor/rest_api/search_item.rb +44 -0
- data/lib/wikidata_adaptor/rest_api/search_property.rb +44 -0
- data/lib/wikidata_adaptor/rest_api/sitelinks.rb +59 -0
- data/lib/wikidata_adaptor/rest_api/statements.rb +153 -0
- data/lib/wikidata_adaptor/rest_api.rb +32 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api/aliases.rb +229 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api/descriptions.rb +308 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api/items.rb +213 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api/labels.rb +302 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api/open_api_document.rb +29 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api/properties.rb +233 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api/property_data_types.rb +23 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api/search_item.rb +118 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api/search_property.rb +118 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api/sitelinks.rb +143 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api/statements.rb +475 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api/support/support.rb +310 -0
- data/lib/wikidata_adaptor/test_helpers/rest_api.rb +89 -0
- data/lib/wikidata_adaptor/version.rb +6 -0
- data/lib/wikidata_adaptor.rb +28 -0
- data/sig/wikidata_adaptor.rbs +4 -0
- metadata +106 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4608fa95dc35d85a4f2277439fbfc888ed976bc95a8ff8bf0d43d135d3b3abea
|
|
4
|
+
data.tar.gz: a7144edeb669d7b8814177288bb0b435b19d760366be6b57c1727fbc68cfea03
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: eee320800d0dcc1b9c0999e4d58121eea4c432725d83de905714360b3b1545c59423276041aefdeb38db509db630a5147a54fb4553dfdbc3f8c2f790881841fe
|
|
7
|
+
data.tar.gz: a8259baea66ef32241b329933036bbd61037bd26d70f62d1d9a7aa5e12217a44b78a9797f286c8644228099ffe89c776a5c651fef68827d7f03de392a3cad386
|
data/.env.test
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# See https://www.wikidata.org/wiki/Wikidata:REST_API/Authentication#Setting_up_OAuth_2.0
|
|
2
|
+
APPLICATION_KEY=application_key
|
|
3
|
+
APPLICATION_SECRET=application_secret
|
|
4
|
+
ACCESS_TOKEN=access_token
|
|
5
|
+
APP_NAME=wikidata_adaptor_api_test
|
|
6
|
+
APP_VERSION=1.0.0
|
|
7
|
+
APP_CONTACT=contact@wikidata_adaptor_api
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
plugins:
|
|
2
|
+
- rubocop-rake
|
|
3
|
+
- rubocop-rspec
|
|
4
|
+
- rubocop-yard
|
|
5
|
+
|
|
6
|
+
AllCops:
|
|
7
|
+
NewCops: enable
|
|
8
|
+
TargetRubyVersion: 3.2
|
|
9
|
+
|
|
10
|
+
Style/StringLiterals:
|
|
11
|
+
Enabled: true
|
|
12
|
+
EnforcedStyle: double_quotes
|
|
13
|
+
|
|
14
|
+
Style/StringLiteralsInInterpolation:
|
|
15
|
+
Enabled: true
|
|
16
|
+
EnforcedStyle: double_quotes
|
|
17
|
+
|
|
18
|
+
Layout/LineLength:
|
|
19
|
+
Enabled: false
|
|
20
|
+
|
|
21
|
+
Metrics:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
Style/Documentation:
|
|
25
|
+
Enabled: false
|
|
26
|
+
|
|
27
|
+
Naming/AccessorMethodName:
|
|
28
|
+
Enabled: false
|
|
29
|
+
|
|
30
|
+
RSpec/BeforeAfterAll:
|
|
31
|
+
Exclude:
|
|
32
|
+
- "spec/integration/**/*"
|
|
33
|
+
|
|
34
|
+
RSpec/InstanceVariable:
|
|
35
|
+
Exclude:
|
|
36
|
+
- "spec/integration/**/*"
|
|
37
|
+
|
|
38
|
+
RSpec/ExampleLength:
|
|
39
|
+
Enabled: false
|
|
40
|
+
|
|
41
|
+
RSpec/MultipleExpectations:
|
|
42
|
+
Enabled: false
|
|
43
|
+
|
|
44
|
+
RSpec/MultipleMemoizedHelpers:
|
|
45
|
+
Enabled: false
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
## [1.0.0] - 2025-02-15
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- **YARD Documentation** - Complete API documentation with 100% coverage
|
|
6
|
+
(193/193 methods documented)
|
|
7
|
+
- YARD gem (~> 0.9) for HTML documentation generation with Markdown support
|
|
8
|
+
- redcarpet gem (~> 3.6) for Markdown rendering in YARD docs
|
|
9
|
+
- rubocop-yard gem for YARD documentation linting and enforcement
|
|
10
|
+
- `.yardopts` configuration file for consistent documentation generation
|
|
11
|
+
- Rake task for YARD documentation: `bundle exec rake yard`
|
|
12
|
+
- GitHub Actions workflow for automated YARD documentation deployment to
|
|
13
|
+
GitHub Pages
|
|
14
|
+
- YARD documentation build check in pre-merge quality checks workflow
|
|
15
|
+
- Comprehensive README.md with installation, usage examples, and API coverage
|
|
16
|
+
- GitHub Actions badges for quality checks and documentation status
|
|
17
|
+
- DELETE label endpoints (`delete_item_label`, `delete_property_label`)
|
|
18
|
+
to remove labels by language
|
|
19
|
+
- DELETE description endpoints (`delete_item_description`,
|
|
20
|
+
`delete_property_description`) to remove descriptions by language
|
|
21
|
+
- DELETE sitelink endpoint (`delete_item_sitelink`) to remove sitelinks
|
|
22
|
+
- DELETE statement endpoints (`delete_item_statement`,
|
|
23
|
+
`delete_property_statement`, `delete_statement`) to remove statements
|
|
24
|
+
- Dependabot configuration with aggressive grouping for low-maintenance
|
|
25
|
+
dependency updates
|
|
26
|
+
- Automated RubyGems publishing workflow with OIDC trusted publishing
|
|
27
|
+
- Release process documentation in CLAUDE.md with step-by-step guide
|
|
28
|
+
- POST item endpoint (`post_item`) with test helpers for error scenarios
|
|
29
|
+
(invalid item, access denied, data policy violation, request limit)
|
|
30
|
+
- POST property endpoint (`post_property`) with matching error stubs
|
|
31
|
+
- POST aliases endpoints (`post_item_aliases`, `post_property_aliases`)
|
|
32
|
+
to append aliases in a given language
|
|
33
|
+
- POST statement endpoints (`post_item_statement`,
|
|
34
|
+
`post_property_statement`) to create statements on entities
|
|
35
|
+
- PUT label endpoints (`put_item_label`, `put_property_label`)
|
|
36
|
+
to replace a single label by language
|
|
37
|
+
- PUT description endpoints (`put_item_description`,
|
|
38
|
+
`put_property_description`) to replace a single description by language
|
|
39
|
+
- PUT sitelink endpoint (`put_item_sitelink`) to replace a sitelink
|
|
40
|
+
by site ID
|
|
41
|
+
- PUT statement endpoints (`put_item_statement`,
|
|
42
|
+
`put_property_statement`, `put_statement`) to replace statements
|
|
43
|
+
- PATCH item and property endpoints (`patch_item`, `patch_property`)
|
|
44
|
+
for JSON Patch updates to entire entities
|
|
45
|
+
- PATCH label endpoints (`patch_item_labels`, `patch_property_labels`)
|
|
46
|
+
for JSON Patch updates to labels
|
|
47
|
+
- PATCH description endpoints (`patch_item_descriptions`,
|
|
48
|
+
`patch_property_descriptions`) for JSON Patch updates to descriptions
|
|
49
|
+
- PATCH alias endpoints (`patch_item_aliases`, `patch_property_aliases`)
|
|
50
|
+
for JSON Patch updates to aliases
|
|
51
|
+
- PATCH sitelinks endpoint (`patch_item_sitelinks`) for JSON Patch
|
|
52
|
+
updates to sitelinks
|
|
53
|
+
- PATCH statement endpoints (`patch_item_statement`,
|
|
54
|
+
`patch_property_statement`, `patch_statement`) for JSON Patch updates
|
|
55
|
+
to statements
|
|
56
|
+
- Search items (`search_items`, `suggest_items`) and search properties
|
|
57
|
+
(`search_properties`) endpoints
|
|
58
|
+
- Language fallback handling for labels via 307 redirect following
|
|
59
|
+
- Integration test suite with Docker Compose (Wikibase stack), helper
|
|
60
|
+
scripts (`integration-up`, `integration-test`, `integration-down`),
|
|
61
|
+
and RSpec filter to exclude integration tests by default
|
|
62
|
+
- Test helpers using OpenAPI spec v1.4 examples for response fixtures
|
|
63
|
+
- Bundled copy of OpenAPI Spec v1.4 for test comparisons
|
|
64
|
+
- `CLAUDE.md` project guidance with Git standards, commit conventions,
|
|
65
|
+
TDD workflow, and release process
|
|
66
|
+
- `rubocop-rake` and `rubocop-rspec` plugins
|
|
67
|
+
- Gemspec metadata: documentation_uri and bug_tracker_uri for RubyGems.org
|
|
68
|
+
|
|
69
|
+
### Changed
|
|
70
|
+
|
|
71
|
+
- **Documentation** - README completely rewritten with comprehensive usage
|
|
72
|
+
examples, quick start guide, and links to all relevant documentation
|
|
73
|
+
- YARD documentation now includes README.md and CLAUDE.md in generated docs
|
|
74
|
+
- Dependabot configured to group minor/patch updates and run weekly
|
|
75
|
+
(7-day cooldown)
|
|
76
|
+
|
|
77
|
+
- Refactored `RestApi` into separate modules per resource: Items, Labels,
|
|
78
|
+
Descriptions, Aliases, Statements, Sitelinks, Properties, PropertyDataTypes,
|
|
79
|
+
OpenApiDocument, SearchItem, SearchProperty
|
|
80
|
+
- Moved spec paths to mirror source layout
|
|
81
|
+
(`spec/wikidata_adaptor/rest_api/`)
|
|
82
|
+
- Updated API paths to target v1 endpoints
|
|
83
|
+
- Updated `api_adaptor` dependency to v0.1.0
|
|
84
|
+
- Updated `stub_rest_api_request` to accept headers
|
|
85
|
+
- Updated target Ruby version to >= 3.2
|
|
86
|
+
|
|
87
|
+
### Fixed
|
|
88
|
+
|
|
89
|
+
- YARD syntax errors: `Array[String]` → `Array<String>` in aliases.rb
|
|
90
|
+
- RuboCop offenses: `RSpec/BeNil`, `RSpec/EmptyLineAfterExample`,
|
|
91
|
+
`RSpec/SpecFilePathFormat` (missing `_spec` suffix on
|
|
92
|
+
`property_data_types`)
|
|
93
|
+
- Gemspec: removed commented `allowed_push_host` placeholder
|
|
94
|
+
|
|
95
|
+
### Infrastructure
|
|
96
|
+
|
|
97
|
+
- **CI/CD**: GitHub Pages deployment for documentation
|
|
98
|
+
- **CI/CD**: YARD docs build check in quality-checks workflow
|
|
99
|
+
- **CI/CD**: Automated RubyGems publishing with comprehensive validation
|
|
100
|
+
- **Dependencies**: Dependabot with aggressive grouping (bundler + actions)
|
|
101
|
+
- **Documentation**: 100% YARD coverage with rubocop-yard linting
|
|
102
|
+
- **Release**: Dry-run mode for testing releases without publishing
|
|
103
|
+
|
|
104
|
+
## [0.0.0] - 2023-06-01
|
|
105
|
+
|
|
106
|
+
- Initial bootstrapping
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
WikidataAdaptor is a Ruby gem that wraps the Wikibase REST API. It extends `ApiAdaptor::Base` and uses a modular mixin pattern — each API resource (Items, Labels, Statements, etc.) is a separate module included into `WikidataAdaptor::RestApi`. Corresponding test helper modules in `lib/wikidata_adaptor/test_helpers/` provide WebMock stubs for consumers of the gem.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Run all checks (specs + rubocop)
|
|
13
|
+
bundle exec rake
|
|
14
|
+
|
|
15
|
+
# Unit tests only (integration tests excluded by default)
|
|
16
|
+
bundle exec rspec
|
|
17
|
+
|
|
18
|
+
# Single test file
|
|
19
|
+
bundle exec rspec spec/wikidata_adaptor/rest_api/items_spec.rb
|
|
20
|
+
|
|
21
|
+
# Single test by line
|
|
22
|
+
bundle exec rspec spec/wikidata_adaptor/rest_api/items_spec.rb:42
|
|
23
|
+
|
|
24
|
+
# Lint
|
|
25
|
+
bundle exec rubocop
|
|
26
|
+
|
|
27
|
+
# Integration tests (requires running Wikibase instance)
|
|
28
|
+
./script/integration-up # start Docker Compose stack
|
|
29
|
+
./script/integration-test # run integration specs
|
|
30
|
+
./script/integration-down # tear down
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Architecture
|
|
34
|
+
|
|
35
|
+
- **`lib/wikidata_adaptor/rest_api.rb`** — Main client class, inherits `ApiAdaptor::Base`, includes all resource modules
|
|
36
|
+
- **`lib/wikidata_adaptor/rest_api/`** — One module per API resource (items, labels, descriptions, aliases, statements, sitelinks, properties, search_item, search_property, property_data_types, open_api_document)
|
|
37
|
+
- **`lib/wikidata_adaptor/test_helpers/`** — Mirrors `rest_api/` structure, providing `stub_*` methods for WebMock-based testing
|
|
38
|
+
- **`spec/wikidata_adaptor/rest_api/`** — Unit tests using WebMock stubs
|
|
39
|
+
- **`spec/integration/`** — Integration tests against a real Wikibase instance via Docker Compose
|
|
40
|
+
|
|
41
|
+
## Testing Conventions
|
|
42
|
+
|
|
43
|
+
- Unit tests use `include WikidataAdaptor::TestHelpers::RestApi` for stubbing
|
|
44
|
+
- Integration tests use `include WikidataAdaptor::Integration::Helpers` and are tagged `:integration`
|
|
45
|
+
- Integration tests use `before(:context)` with instance variables (not `let`) to seed data once per group
|
|
46
|
+
- Integration tests are excluded by default; enabled with `INTEGRATION=1`
|
|
47
|
+
|
|
48
|
+
## Environment Variables
|
|
49
|
+
|
|
50
|
+
- `WIKIBASE_REST_ENDPOINT` — API base URL (default: `https://www.wikidata.org/w/rest.php/wikibase`)
|
|
51
|
+
- `WIKIBASE_BEARER_TOKEN` — Optional OAuth token for write operations
|
|
52
|
+
- `INTEGRATION` — Set to `1` to include integration tests
|
|
53
|
+
|
|
54
|
+
## Git Standards
|
|
55
|
+
|
|
56
|
+
Never commit to main branch,
|
|
57
|
+
Always create a new branch with a sensible descriptive name and expect a Pull Request process.
|
|
58
|
+
|
|
59
|
+
You'll need to provide a good PR description that sums up any collected change.
|
|
60
|
+
|
|
61
|
+
## Commit Standards
|
|
62
|
+
|
|
63
|
+
Follows [GDS Git conventions](https://gds-way.digital.cabinet-office.gov.uk/standards/source-code/working-with-git.html#commits), informed by [chris.beams.io/posts/git-commit](https://chris.beams.io/posts/git-commit), [thoughtbot](https://thoughtbot.com/blog/5-useful-tips-for-a-better-commit-message), [mislav.net](https://mislav.net/2014/02/hidden-documentation/), and [Joel Chippindale's "Telling Stories Through Your Commits"](https://blog.mocoso.co.uk/posts/talks/telling-stories-through-your-commits/).
|
|
64
|
+
|
|
65
|
+
### Formatting
|
|
66
|
+
|
|
67
|
+
- **[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)** — subject line format: `<type>[optional scope]: <description>`
|
|
68
|
+
- **Types**: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`
|
|
69
|
+
- **Scope** — optional parenthetical context, e.g. `feat(labels):` or `fix(integration):`
|
|
70
|
+
- **Breaking changes** — indicated with `!` before the colon, e.g. `feat!:`, or a `BREAKING CHANGE:` footer
|
|
71
|
+
- **Subject line** — max 50 characters, no trailing period, imperative mood ("Add feature" not "Added feature")
|
|
72
|
+
- **Body** — separated from subject by a blank line, wrapped at 72 characters
|
|
73
|
+
- **Links supplement, not replace** — issue/PR links may go stale, so the message must stand on its own
|
|
74
|
+
|
|
75
|
+
### Content
|
|
76
|
+
|
|
77
|
+
- **Answer three questions**: Why is this change necessary? How does it address the issue? What side effects does it have?
|
|
78
|
+
- **Explain the "why"** — the code shows _how_; the commit message must capture _why_. Rationale and context are hard to reconstruct later
|
|
79
|
+
- **Note alternatives considered** — if you chose approach A over B, say so and why
|
|
80
|
+
|
|
81
|
+
### Structure
|
|
82
|
+
|
|
83
|
+
- **Atomic commits** — each commit is a self-contained, logical unit of work; avoid needing "and" in your subject line
|
|
84
|
+
- **Tell a story** — commits should be logically ordered so the history reads as a coherent narrative, not a jumbled log
|
|
85
|
+
- **Clean up before sharing** — revise commit history on feature branches before opening a PR
|
|
86
|
+
|
|
87
|
+
## Development Workflow (TDD)
|
|
88
|
+
|
|
89
|
+
When adding new API endpoints, follow this test-driven approach.
|
|
90
|
+
You are expected to pause and commit between each step, once we are ready for PR you may soft reset and re-commit if the audit history does not properly represent the above rules.
|
|
91
|
+
|
|
92
|
+
A good flow might look like:
|
|
93
|
+
|
|
94
|
+
1. **Write unit tests (red)** — Add `describe` blocks to the relevant spec file calling `stub_*` and API methods that don't exist yet. Verify `bundle exec rubocop` passes and `bundle exec rspec` fails. Then commit and push.
|
|
95
|
+
2. **Add test helpers + implementation (green)** — Add `stub_*` helpers and implement the API methods. Verify `bundle exec rake` passes (rspec + rubocop). Then commit and push.
|
|
96
|
+
3. **Add integration tests** — Add tests to `spec/integration/` that exercise the real API. Then commit and push.
|
|
97
|
+
4. **Update TODO** — Move endpoints from "Uncovered" to "Covered" in `TODO.md` and update counts. Then commit and push.
|
|
98
|
+
|
|
99
|
+
## Style
|
|
100
|
+
|
|
101
|
+
- Double quotes for strings
|
|
102
|
+
- Ruby >= 3.2
|
|
103
|
+
|
|
104
|
+
## Release Process
|
|
105
|
+
|
|
106
|
+
WikidataAdaptor uses automated publishing to RubyGems via GitHub Actions with OIDC trusted publishing.
|
|
107
|
+
|
|
108
|
+
### Prerequisites (One-time Setup)
|
|
109
|
+
|
|
110
|
+
1. **Configure RubyGems Trusted Publishing**:
|
|
111
|
+
- Go to [RubyGems.org](https://rubygems.org) → Account Settings → Publishing
|
|
112
|
+
- Add trusted publisher:
|
|
113
|
+
- Repository: `huwd/wikidata_adaptor`
|
|
114
|
+
- Workflow: `release.yml`
|
|
115
|
+
- Environment: (leave empty)
|
|
116
|
+
|
|
117
|
+
### Release Checklist
|
|
118
|
+
|
|
119
|
+
1. **Update version**:
|
|
120
|
+
```bash
|
|
121
|
+
# Edit lib/wikidata_adaptor/version.rb
|
|
122
|
+
VERSION = "1.0.0"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
2. **Update CHANGELOG.md**:
|
|
126
|
+
```markdown
|
|
127
|
+
## [1.0.0] - YYYY-MM-DD
|
|
128
|
+
|
|
129
|
+
### Added
|
|
130
|
+
- New feature X
|
|
131
|
+
|
|
132
|
+
### Changed
|
|
133
|
+
- Updated Y
|
|
134
|
+
|
|
135
|
+
### Fixed
|
|
136
|
+
- Bug Z
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
3. **Commit changes**:
|
|
140
|
+
```bash
|
|
141
|
+
git add lib/wikidata_adaptor/version.rb CHANGELOG.md
|
|
142
|
+
git commit -m "chore: Prepare v1.0.0 release"
|
|
143
|
+
git push origin main
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
4. **Create and push tag**:
|
|
147
|
+
```bash
|
|
148
|
+
git tag v1.0.0
|
|
149
|
+
git push origin v1.0.0
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
5. **GitHub Actions automatically**:
|
|
153
|
+
- Validates tag format matches semantic versioning
|
|
154
|
+
- Verifies tag matches `WikidataAdaptor::VERSION`
|
|
155
|
+
- Confirms CHANGELOG mentions version
|
|
156
|
+
- Runs full test suite
|
|
157
|
+
- Runs RuboCop
|
|
158
|
+
- Builds YARD documentation
|
|
159
|
+
- Builds gem package
|
|
160
|
+
- Tests gem installation
|
|
161
|
+
- Publishes to RubyGems.org
|
|
162
|
+
|
|
163
|
+
6. **Verify release**:
|
|
164
|
+
- Check [GitHub Actions](https://github.com/huwd/wikidata_adaptor/actions)
|
|
165
|
+
- Verify on [RubyGems.org](https://rubygems.org/gems/wikidata_adaptor)
|
|
166
|
+
- Test installation: `gem install wikidata_adaptor`
|
|
167
|
+
|
|
168
|
+
### Dry Run (Testing Without Publishing)
|
|
169
|
+
|
|
170
|
+
To test the release process without publishing:
|
|
171
|
+
|
|
172
|
+
1. Go to [Actions → Release RubyGem](https://github.com/huwd/wikidata_adaptor/actions/workflows/release.yml)
|
|
173
|
+
2. Click "Run workflow"
|
|
174
|
+
3. Select branch: `main`
|
|
175
|
+
4. Set dry_run: `true`
|
|
176
|
+
5. Click "Run workflow"
|
|
177
|
+
|
|
178
|
+
This runs all checks and builds the gem but skips publishing to RubyGems.
|
|
179
|
+
|
|
180
|
+
### Version Numbering
|
|
181
|
+
|
|
182
|
+
Follow [Semantic Versioning](https://semver.org/):
|
|
183
|
+
- **MAJOR** (e.g., `1.0.0` → `2.0.0`): Incompatible API changes
|
|
184
|
+
- **MINOR** (e.g., `1.0.0` → `1.1.0`): Backwards-compatible new features
|
|
185
|
+
- **PATCH** (e.g., `1.1.0` → `1.1.1`, or `1.0.0` → `1.0.1`): Backwards-compatible bug fixes
|
|
186
|
+
- **Pre-release** (e.g., `1.1.0-beta.1`): Alpha, beta, or release candidate
|
|
187
|
+
- **Note**: During initial development (`0.y.z`), breaking changes may be introduced in minor versions; treat `0.y.z` as unstable.
|
|
188
|
+
|
|
189
|
+
### Troubleshooting
|
|
190
|
+
|
|
191
|
+
**Tag mismatch error**: Ensure `lib/wikidata_adaptor/version.rb` matches the git tag (without the `v` prefix).
|
|
192
|
+
|
|
193
|
+
**CHANGELOG error**: Add an entry for the version in CHANGELOG.md following the format:
|
|
194
|
+
```markdown
|
|
195
|
+
## [1.0.0] - YYYY-MM-DD
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Tests fail**: Fix failing tests before releasing. The release will not proceed if tests fail.
|
|
199
|
+
|
|
200
|
+
**RuboCop errors**: Fix linting errors before releasing.
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
+
|
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
22
|
+
advances of any kind
|
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
24
|
+
* Public or private harassment
|
|
25
|
+
* Publishing others' private information, such as a physical or email
|
|
26
|
+
address, without their explicit permission
|
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
28
|
+
professional setting
|
|
29
|
+
|
|
30
|
+
## Enforcement Responsibilities
|
|
31
|
+
|
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
33
|
+
|
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
35
|
+
|
|
36
|
+
## Scope
|
|
37
|
+
|
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
39
|
+
|
|
40
|
+
## Enforcement
|
|
41
|
+
|
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at mail@huwdiprose.co.uk. All complaints will be reviewed and investigated promptly and fairly.
|
|
43
|
+
|
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
45
|
+
|
|
46
|
+
## Enforcement Guidelines
|
|
47
|
+
|
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
49
|
+
|
|
50
|
+
### 1. Correction
|
|
51
|
+
|
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
53
|
+
|
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
55
|
+
|
|
56
|
+
### 2. Warning
|
|
57
|
+
|
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
59
|
+
|
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
61
|
+
|
|
62
|
+
### 3. Temporary Ban
|
|
63
|
+
|
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
65
|
+
|
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
67
|
+
|
|
68
|
+
### 4. Permanent Ban
|
|
69
|
+
|
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
71
|
+
|
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
73
|
+
|
|
74
|
+
## Attribution
|
|
75
|
+
|
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
78
|
+
|
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
|
80
|
+
|
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
|
82
|
+
|
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/COVERAGE.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# API Coverage
|
|
2
|
+
|
|
3
|
+
Tracking coverage of Wikibase REST API v1.4 (OpenAPI spec).
|
|
4
|
+
|
|
5
|
+
**Covered: 65 / 65 endpoints (100%)**
|
|
6
|
+
|
|
7
|
+
## Covered endpoints
|
|
8
|
+
|
|
9
|
+
All endpoints from the Wikibase REST API v1.4 specification are now implemented.
|
|
10
|
+
|
|
11
|
+
| # | Method | Path | Ruby method | Module |
|
|
12
|
+
| --- | ------ | ------------------------------------------------------------------------------------------- | ------------------------------------------------- | ----------------- |
|
|
13
|
+
| 1 | GET | `/v0/search/items` | `search_items` | SearchItem |
|
|
14
|
+
| 2 | GET | `/v0/search/properties` | `search_properties` | SearchProperty |
|
|
15
|
+
| 3 | GET | `/v0/suggest/items` | `suggest_items` | SearchItem |
|
|
16
|
+
| 4 | GET | `/v0/suggest/properties` | `suggest_properties` | SearchProperty |
|
|
17
|
+
| 5 | GET | `/v1/entities/items/{item_id}` | `get_item` | Items |
|
|
18
|
+
| 6 | GET | `/v1/entities/items/{item_id}/aliases` | `get_item_aliases` | Aliases |
|
|
19
|
+
| 7 | GET | `/v1/entities/items/{item_id}/aliases/{language_code}` | `get_item_alias` | Aliases |
|
|
20
|
+
| 8 | GET | `/v1/entities/items/{item_id}/descriptions` | `get_item_descriptions` | Descriptions |
|
|
21
|
+
| 9 | GET | `/v1/entities/items/{item_id}/descriptions/{language_code}` | `get_item_description` | Descriptions |
|
|
22
|
+
| 10 | GET | `/v1/entities/items/{item_id}/labels` | `get_item_labels` | Labels |
|
|
23
|
+
| 11 | GET | `/v1/entities/items/{item_id}/labels/{language_code}` | `get_item_label` | Labels |
|
|
24
|
+
| 12 | GET | `/v1/entities/items/{item_id}/labels_with_language_fallback/{language_code}` | `get_item_label_with_language_fallback` | Labels |
|
|
25
|
+
| 13 | GET | `/v1/entities/items/{item_id}/sitelinks` | `get_item_sitelinks` | Sitelinks |
|
|
26
|
+
| 14 | GET | `/v1/entities/items/{item_id}/sitelinks/{site_id}` | `get_item_sitelink` | Sitelinks |
|
|
27
|
+
| 15 | GET | `/v1/entities/items/{item_id}/statements` | `get_item_statements` | Statements |
|
|
28
|
+
| 16 | GET | `/v1/entities/items/{item_id}/statements/{statement_id}` | `get_item_statement` | Statements |
|
|
29
|
+
| 17 | GET | `/v1/entities/properties/{property_id}` | `get_property` | Properties |
|
|
30
|
+
| 18 | GET | `/v1/entities/properties/{property_id}/aliases` | `get_property_aliases` | Aliases |
|
|
31
|
+
| 19 | GET | `/v1/entities/properties/{property_id}/aliases/{language_code}` | `get_property_alias` | Aliases |
|
|
32
|
+
| 20 | GET | `/v1/entities/properties/{property_id}/descriptions` | `get_property_descriptions` | Descriptions |
|
|
33
|
+
| 21 | GET | `/v1/entities/properties/{property_id}/descriptions/{language_code}` | `get_property_description` | Descriptions |
|
|
34
|
+
| 22 | GET | `/v1/entities/properties/{property_id}/labels` | `get_property_labels` | Labels |
|
|
35
|
+
| 23 | GET | `/v1/entities/properties/{property_id}/labels/{language_code}` | `get_property_label` | Labels |
|
|
36
|
+
| 24 | GET | `/v1/entities/properties/{property_id}/labels_with_language_fallback/{language_code}` | `get_property_label_with_language_fallback` | Labels |
|
|
37
|
+
| 25 | GET | `/v1/entities/properties/{property_id}/statements` | `get_property_statements` | Statements |
|
|
38
|
+
| 26 | GET | `/v1/entities/properties/{property_id}/statements/{statement_id}` | `get_property_statement` | Statements |
|
|
39
|
+
| 27 | GET | `/v1/openapi.json` | `get_openapi_document` | OpenApiDocument |
|
|
40
|
+
| 28 | GET | `/v1/property-data-types` | `get_property_data_types` | PropertyDataTypes |
|
|
41
|
+
| 29 | GET | `/v1/statements/{statement_id}` | `get_statement` | Statements |
|
|
42
|
+
| 30 | POST | `/v1/entities/items` | `post_item` | Items |
|
|
43
|
+
| 31 | GET | `/v1/entities/items/{item_id}/descriptions_with_language_fallback/{language_code}` | `get_item_description_with_language_fallback` | Descriptions |
|
|
44
|
+
| 32 | GET | `/v1/entities/properties/{property_id}/descriptions_with_language_fallback/{language_code}` | `get_property_description_with_language_fallback` | Descriptions |
|
|
45
|
+
| 33 | POST | `/v1/entities/items/{item_id}/aliases/{language_code}` | `post_item_aliases` | Aliases |
|
|
46
|
+
| 34 | POST | `/v1/entities/items/{item_id}/statements` | `post_item_statement` | Statements |
|
|
47
|
+
| 35 | POST | `/v1/entities/properties` | `post_property` | Properties |
|
|
48
|
+
| 36 | POST | `/v1/entities/properties/{property_id}/aliases/{language_code}` | `post_property_aliases` | Aliases |
|
|
49
|
+
| 37 | POST | `/v1/entities/properties/{property_id}/statements` | `post_property_statement` | Statements |
|
|
50
|
+
| 38 | PUT | `/v1/entities/items/{item_id}/labels/{language_code}` | `put_item_label` | Labels |
|
|
51
|
+
| 39 | PUT | `/v1/entities/properties/{property_id}/labels/{language_code}` | `put_property_label` | Labels |
|
|
52
|
+
| 40 | PUT | `/v1/entities/items/{item_id}/descriptions/{language_code}` | `put_item_description` | Descriptions |
|
|
53
|
+
| 41 | PUT | `/v1/entities/properties/{property_id}/descriptions/{language_code}` | `put_property_description` | Descriptions |
|
|
54
|
+
| 42 | PUT | `/v1/entities/items/{item_id}/sitelinks/{site_id}` | `put_item_sitelink` | Sitelinks |
|
|
55
|
+
| 43 | PUT | `/v1/entities/items/{item_id}/statements/{statement_id}` | `put_item_statement` | Statements |
|
|
56
|
+
| 44 | PUT | `/v1/entities/properties/{property_id}/statements/{statement_id}` | `put_property_statement` | Statements |
|
|
57
|
+
| 45 | PUT | `/v1/statements/{statement_id}` | `put_statement` | Statements |
|
|
58
|
+
| 46 | PATCH | `/v1/entities/items/{item_id}` | `patch_item` | Items |
|
|
59
|
+
| 47 | PATCH | `/v1/entities/items/{item_id}/aliases` | `patch_item_aliases` | Aliases |
|
|
60
|
+
| 48 | PATCH | `/v1/entities/items/{item_id}/descriptions` | `patch_item_descriptions` | Descriptions |
|
|
61
|
+
| 49 | PATCH | `/v1/entities/items/{item_id}/labels` | `patch_item_labels` | Labels |
|
|
62
|
+
| 50 | PATCH | `/v1/entities/items/{item_id}/sitelinks` | `patch_item_sitelinks` | Sitelinks |
|
|
63
|
+
| 51 | PATCH | `/v1/entities/items/{item_id}/statements/{statement_id}` | `patch_item_statement` | Statements |
|
|
64
|
+
| 52 | PATCH | `/v1/entities/properties/{property_id}` | `patch_property` | Properties |
|
|
65
|
+
| 53 | PATCH | `/v1/entities/properties/{property_id}/aliases` | `patch_property_aliases` | Aliases |
|
|
66
|
+
| 54 | PATCH | `/v1/entities/properties/{property_id}/descriptions` | `patch_property_descriptions` | Descriptions |
|
|
67
|
+
| 55 | PATCH | `/v1/entities/properties/{property_id}/labels` | `patch_property_labels` | Labels |
|
|
68
|
+
| 56 | PATCH | `/v1/entities/properties/{property_id}/statements/{statement_id}` | `patch_property_statement` | Statements |
|
|
69
|
+
| 57 | PATCH | `/v1/statements/{statement_id}` | `patch_statement` | Statements |
|
|
70
|
+
| 58 | DELETE | `/v1/entities/items/{item_id}/labels/{language_code}` | `delete_item_label` | Labels |
|
|
71
|
+
| 59 | DELETE | `/v1/entities/properties/{property_id}/labels/{language_code}` | `delete_property_label` | Labels |
|
|
72
|
+
| 60 | DELETE | `/v1/entities/items/{item_id}/descriptions/{language_code}` | `delete_item_description` | Descriptions |
|
|
73
|
+
| 61 | DELETE | `/v1/entities/properties/{property_id}/descriptions/{language_code}` | `delete_property_description` | Descriptions |
|
|
74
|
+
| 62 | DELETE | `/v1/entities/items/{item_id}/sitelinks/{site_id}` | `delete_item_sitelink` | Sitelinks |
|
|
75
|
+
| 63 | DELETE | `/v1/entities/items/{item_id}/statements/{statement_id}` | `delete_item_statement` | Statements |
|
|
76
|
+
| 64 | DELETE | `/v1/entities/properties/{property_id}/statements/{statement_id}` | `delete_property_statement` | Statements |
|
|
77
|
+
| 65 | DELETE | `/v1/statements/{statement_id}` | `delete_statement` | Statements |
|
data/Gemfile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
# Specify your gem's dependencies in wikidata_adaptor.gemspec
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
gem "rake", "~> 13.0"
|
|
9
|
+
|
|
10
|
+
gem "rspec", "~> 3.0"
|
|
11
|
+
|
|
12
|
+
gem "rubocop-rake"
|
|
13
|
+
gem "rubocop-rspec"
|
|
14
|
+
gem "rubocop-yard"
|
|
15
|
+
|
|
16
|
+
gem "dotenv", "3.2.0"
|
|
17
|
+
gem "redcarpet", "~> 3.6"
|
|
18
|
+
gem "rubocop", "~> 1.84"
|
|
19
|
+
gem "webmock", "~> 3.17"
|
|
20
|
+
gem "yard", "~> 0.9"
|