wikidatum 0.2.0 → 0.3.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 +4 -4
- data/CHANGELOG.md +14 -2
- data/README.md +24 -2
- data/bin/console +0 -4
- data/lib/wikidatum/client.rb +395 -327
- data/lib/wikidatum/data_type/base.rb +61 -0
- data/lib/wikidatum/{data_value_type → data_type}/globe_coordinate.rb +21 -20
- data/lib/wikidatum/{data_value_type → data_type}/monolingual_text.rb +19 -18
- data/lib/wikidatum/{data_value_type → data_type}/no_value.rb +3 -11
- data/lib/wikidatum/data_type/quantity.rb +75 -0
- data/lib/wikidatum/{data_value_type → data_type}/some_value.rb +3 -11
- data/lib/wikidatum/{data_value_type → data_type}/time.rb +20 -37
- data/lib/wikidatum/data_type/wikibase_item.rb +64 -0
- data/lib/wikidatum/{data_value_type → data_type}/wikibase_string.rb +16 -15
- data/lib/wikidatum/data_type.rb +11 -0
- data/lib/wikidatum/item.rb +2 -2
- data/lib/wikidatum/qualifier.rb +52 -4
- data/lib/wikidatum/reference.rb +9 -9
- data/lib/wikidatum/reference_part.rb +56 -0
- data/lib/wikidatum/statement.rb +21 -11
- data/lib/wikidatum/utils.rb +25 -0
- data/lib/wikidatum/version.rb +1 -1
- data/lib/wikidatum.rb +31 -20
- data/wikidatum.gemspec +1 -1
- metadata +15 -17
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -73
- data/Rakefile +0 -16
- data/lib/wikidatum/data_value_type/base.rb +0 -61
- data/lib/wikidatum/data_value_type/quantity.rb +0 -92
- data/lib/wikidatum/data_value_type/wikibase_entity_id.rb +0 -83
- data/lib/wikidatum/data_value_type.rb +0 -11
- data/lib/wikidatum/snak.rb +0 -79
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78bb68e7872a77e0dc21f9904d0fd8306b4d4caa23329824d87257a91e503925
|
4
|
+
data.tar.gz: 84765a7d5f3cee85b0c6ad68953f1d6e9718d068037247f8e8e7e1c4b651c51b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24dd512b025f3e618b46ba9b5cc280c2ef500909b7f68c666f29914b5a64e1da63729ded4e321e37461f68f6fdc1f429ec87a71684b773eacb5f25f56ee5c212
|
7
|
+
data.tar.gz: e43e1b92d171667ce5af5028c56b7d5c28971ef3c3aed93f55a919088e6a990796889eb32293563191d857cf547ca685b6d571bc629a199cbbb6ab332283a731
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,20 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
6
6
|
|
7
|
-
##
|
7
|
+
## 0.3.0 - 2022-12-27
|
8
|
+
### Added
|
9
|
+
|
10
|
+
- Add `allow_ip_edits` argument on `Wikidatum::Client.new`. This protects users from making IP address-exposing edits if they haven't explicitly opted-in to doing that. The argument defaults to false.
|
11
|
+
- Add code to raise errors when various types of invalid input are passed to `Wikidatum::Client#add_statement`.
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
|
15
|
+
- Update the serializers and `add_statement` method to account for various changes that have been made upstream to the Wikibase REST API.
|
16
|
+
|
17
|
+
## 0.2.1 - 2022-08-13
|
18
|
+
### Fixed
|
19
|
+
|
20
|
+
- Fix a mistake that broke loading the gem.
|
8
21
|
|
9
22
|
## 0.2.0 - 2022-08-13
|
10
23
|
### Added
|
@@ -24,4 +37,3 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
24
37
|
### Added
|
25
38
|
|
26
39
|
- Initial release, nothing is really usable yet.
|
27
|
-
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
This gem supports making requests to the [new Wikidata/Wikibase REST API](https://doc.wikimedia.org/Wikibase/master/js/rest-api/).
|
4
4
|
|
5
|
-
|
5
|
+
The [Wikimedia Docs on Wikibase's JSON format](https://doc.wikimedia.org/Wikibase/master/php/docs_topics_json.html) are also very useful for interacting with/contributing to this gem.
|
6
|
+
|
7
|
+
**The gem is currently in early development and is not ready for production usage**.
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
@@ -24,7 +26,7 @@ Or install it yourself as:
|
|
24
26
|
|
25
27
|
You can view the YARD docs on GitHub Pages [here](https://connorshea.github.io/wikidatum/index.html).
|
26
28
|
|
27
|
-
Currently, the gem is able to hit a few
|
29
|
+
Currently, 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.
|
28
30
|
|
29
31
|
```ruby
|
30
32
|
require 'wikidatum'
|
@@ -57,6 +59,26 @@ item.label(lang: :en).value #=> "Earth"
|
|
57
59
|
|
58
60
|
# Get the values for all English aliases on this item.
|
59
61
|
item.aliases(langs: [:en]).map(&:value) #=> ["Planet Earth", "Pale Blue Dot"]
|
62
|
+
|
63
|
+
statement_id = 'Q123$4543523c-1d1d-1111-1e1e-11b11111b1f1'
|
64
|
+
statement = wikidatum_client.statement(id: statement_id) #=> Wikidatum::Statement
|
65
|
+
|
66
|
+
# Add a statement to Q193581 for P577 (publication date) that has a time value of November 16, 2004.
|
67
|
+
wikidatum_client.add_statement(
|
68
|
+
id: 'Q193581',
|
69
|
+
property: 'P577',
|
70
|
+
value: Wikidatum::DataType::Time.new(
|
71
|
+
time: '+2004-11-16T00:00:00Z',
|
72
|
+
precision: 11,
|
73
|
+
calendar_model: 'https://www.wikidata.org/entity/Q12138'
|
74
|
+
)
|
75
|
+
)
|
76
|
+
|
77
|
+
# Delete a statement and include an edit summary.
|
78
|
+
wikidatum_client.delete_statement(
|
79
|
+
id: 'Q123$4543523c-1d1d-1111-1e1e-11b11111b1f1',
|
80
|
+
comment: 'Deleting this statement because it is inaccurate.'
|
81
|
+
)
|
60
82
|
```
|
61
83
|
|
62
84
|
## Development
|
data/bin/console
CHANGED
@@ -7,9 +7,5 @@ require "wikidatum"
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
9
9
|
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
10
|
require "irb"
|
15
11
|
IRB.start(__FILE__)
|