wikibase_representable 0.1.4 → 0.2.1

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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.rubocop_todo.yml +17 -0
  4. data/lib/wikibase_representable/model/{alias_group_list.rb → alias_group_hash.rb} +2 -2
  5. data/lib/wikibase_representable/model/data_value.rb +1 -1
  6. data/lib/wikibase_representable/model/entity_id.rb +1 -1
  7. data/lib/wikibase_representable/model/entity_id_value.rb +4 -4
  8. data/lib/wikibase_representable/model/item.rb +18 -22
  9. data/lib/wikibase_representable/model/property.rb +9 -25
  10. data/lib/wikibase_representable/model/property_value_snak.rb +1 -1
  11. data/lib/wikibase_representable/model/site_link.rb +1 -1
  12. data/lib/wikibase_representable/model/{site_link_list.rb → site_link_hash.rb} +1 -1
  13. data/lib/wikibase_representable/model/{snak_list.rb → snak_hash.rb} +2 -2
  14. data/lib/wikibase_representable/model/statement.rb +3 -3
  15. data/lib/wikibase_representable/model/{statement_list.rb → statement_hash.rb} +2 -2
  16. data/lib/wikibase_representable/model/term.rb +1 -1
  17. data/lib/wikibase_representable/model/{term_list.rb → term_hash.rb} +2 -2
  18. data/lib/wikibase_representable/model/time.rb +1 -1
  19. data/lib/wikibase_representable/model/time_value.rb +7 -7
  20. data/lib/wikibase_representable/model.rb +5 -5
  21. data/lib/wikibase_representable/representers/{alias_group_list_representer.rb → alias_group_hash_representer.rb} +1 -1
  22. data/lib/wikibase_representable/representers/item_representer.rb +19 -17
  23. data/lib/wikibase_representable/representers/property_representer.rb +15 -13
  24. data/lib/wikibase_representable/representers/{site_link_list_representer.rb → site_link_hash_representer.rb} +1 -1
  25. data/lib/wikibase_representable/representers/{snak_list_representer.rb → snak_hash_representer.rb} +2 -2
  26. data/lib/wikibase_representable/representers/{statement_list_representer.rb → statement_hash_representer.rb} +1 -1
  27. data/lib/wikibase_representable/representers/statement_representer.rb +3 -3
  28. data/lib/wikibase_representable/representers/{term_list_representer.rb → term_hash_representer.rb} +2 -2
  29. data/lib/wikibase_representable/representers.rb +5 -5
  30. data/lib/wikibase_representable/version.rb +1 -1
  31. metadata +41 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: defaee30f588f7bee23fa3fd57e8ddcceb8537abe62b1807ba35fdcbf72d435c
4
- data.tar.gz: 7acba0104544f026a193f005a26921ae905c5d7b351ecc02b88390caa7d28e47
3
+ metadata.gz: ffbe7b79015173e461400332a5a467166fc9f3ff96ead74b61b02a3b1aeafc91
4
+ data.tar.gz: d61ca51eac04caf4e9e6655a6bd6fcd0e6e4b8467e89e4dbbcd1a548c89b13b0
5
5
  SHA512:
6
- metadata.gz: e45f476441a66d51c1f16090e71e6b2cfd34e4e5edde277166dd22f9665743efa3551fb81e9128becdc3240212c92fcb11717e4f44d34a03847e2f0c6b006201
7
- data.tar.gz: fad708bfd76fa145e89c1b1dc841e397e73891695e566489d0c92087652591956ce24b004930814c6155ae130d433fe7f4af3499ff39e86accb6b1b9f514063b
6
+ metadata.gz: 911489f59ff0b4477c16cdb5ea71fcb3cd7daf1d0f6f43bad390afdc5cb0b00ff3da0b75fd368d8ed0040e7ac31436e072f11acfe69de64df0c0b5d19573bbc3
7
+ data.tar.gz: 760c126b1289e8c01868fae1e78c6adc700e2b9875478c1c3d5f7ed668a50db9a23fe99fce0fe86e0d5c6dc29fca98f847f8948aff38ed004969008e68184a25
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop_todo.yml CHANGED
@@ -0,0 +1,17 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-01-18 04:14:35 UTC using RuboCop version 1.69.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 13
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: EnforceForPrefixed.
12
+ Rails/Delegate:
13
+ Exclude:
14
+ - 'lib/wikibase_representable/model/entity_id_value.rb'
15
+ - 'lib/wikibase_representable/model/item.rb'
16
+ - 'lib/wikibase_representable/model/statement.rb'
17
+ - 'lib/wikibase_representable/model/time_value.rb'
@@ -2,8 +2,8 @@
2
2
 
3
3
  module WikibaseRepresentable
4
4
  module Model
5
- # Wraps a hash of Term arrays keyed by language code.
6
- class AliasGroupList < Hash
5
+ # Hash of alias lists keyed by language code.
6
+ class AliasGroupHash < Hash
7
7
  def aliases_for_language(language_code)
8
8
  fetch(language_code, nil)
9
9
  end
@@ -12,7 +12,7 @@ module WikibaseRepresentable
12
12
  end
13
13
 
14
14
  def state
15
- [@type, @value]
15
+ [type, value]
16
16
  end
17
17
 
18
18
  def ==(other)
@@ -13,7 +13,7 @@ module WikibaseRepresentable
13
13
  end
14
14
 
15
15
  def state
16
- [@id, @numeric_id, @entity_type]
16
+ [id, numeric_id, entity_type]
17
17
  end
18
18
 
19
19
  def ==(other)
@@ -13,19 +13,19 @@ module WikibaseRepresentable
13
13
  end
14
14
 
15
15
  def id
16
- @value.id
16
+ value.id
17
17
  end
18
18
 
19
19
  def entity_type
20
- @value.entity_type
20
+ value.entity_type
21
21
  end
22
22
 
23
23
  def numeric_id
24
- @value.numeric_id
24
+ value.numeric_id
25
25
  end
26
26
 
27
27
  def state
28
- [@type, @value]
28
+ [type, value]
29
29
  end
30
30
 
31
31
  def ==(other)
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'wikibase_representable/model/alias_group_list'
4
- require 'wikibase_representable/model/site_link_list'
5
- require 'wikibase_representable/model/statement_list'
6
- require 'wikibase_representable/model/term_list'
3
+ require 'wikibase_representable/model/alias_group_hash'
4
+ require 'wikibase_representable/model/site_link_hash'
5
+ require 'wikibase_representable/model/statement_hash'
6
+ require 'wikibase_representable/model/term_hash'
7
7
  require 'wikibase_representable/model/term'
8
8
 
9
9
  module WikibaseRepresentable
@@ -13,48 +13,44 @@ module WikibaseRepresentable
13
13
  class Item
14
14
  ENTITY_TYPE = 'item'
15
15
 
16
- attr_accessor :type, :id, :labels, :descriptions, :alias_groups, :site_links, :statements
16
+ attr_accessor :type, :id, :labels_hash, :descriptions_hash, :alias_groups_hash, :site_links_hash, :statements_hash
17
17
 
18
18
  def initialize(**kwargs)
19
19
  @type = ENTITY_TYPE
20
20
  @id = kwargs[:id]
21
- @labels = kwargs[:labels] || TermList.new
22
- @descriptions = kwargs[:descriptions] || TermList.new
23
- @alias_groups = kwargs[:alias_groups] || AliasGroupList.new
24
- @site_links = kwargs[:site_links] || SiteLinkList.new
25
- @statements = kwargs[:statements] || StatementList.new
21
+ @labels_hash = kwargs[:labels_hash] || TermHash.new
22
+ @descriptions_hash = kwargs[:descriptions_hash] || TermHash.new
23
+ @alias_groups_hash = kwargs[:alias_groups_hash] || AliasGroupHash.new
24
+ @site_links_hash = kwargs[:site_links_hash] || SiteLinkHash.new
25
+ @statements_hash = kwargs[:statements_hash] || StatementHash.new
26
26
  end
27
27
 
28
28
  def label(language_code)
29
- @labels.value_for_language(language_code)
29
+ labels_hash.value_for_language(language_code)
30
30
  end
31
31
 
32
32
  def aliases_for_language(language_code)
33
- @alias_groups.aliases_for_language(language_code)
33
+ alias_groups_hash.aliases_for_language(language_code)
34
34
  end
35
35
 
36
36
  def statements_by_property_id(property_id)
37
- @statements.statements_by_property_id(property_id)
37
+ statements_hash.statements_by_property_id(property_id)
38
38
  end
39
39
 
40
40
  def statements_by_property_id?(property_id)
41
- @statements.statements_by_property_id?(property_id)
41
+ statements_hash.statements_by_property_id?(property_id)
42
42
  end
43
43
 
44
44
  def site_link(site_id)
45
- @site_links.link_for_site(site_id)
45
+ site_links_hash.link_for_site(site_id)
46
46
  end
47
47
 
48
48
  def link_to_site?(site_id)
49
- @site_links.link_for_site?(site_id)
50
- end
51
-
52
- def empty?
53
- @labels.empty? && @descriptions.empty? && @alias_groups.empty? && @site_links.empty? && @statements.empty?
49
+ site_links_hash.link_for_site?(site_id)
54
50
  end
55
51
 
56
52
  def state
57
- [@type, @id, @labels, @descriptions, @alias_groups, @site_links, @statements]
53
+ [type, id, labels_hash, descriptions_hash, alias_groups_hash, site_links_hash, statements_hash]
58
54
  end
59
55
 
60
56
  def ==(other)
@@ -65,7 +61,7 @@ module WikibaseRepresentable
65
61
  self == other
66
62
  end
67
63
 
68
- alias claims statements
64
+ alias claims_hash statements_hash
69
65
  alias claims_by_property_id statements_by_property_id
70
66
  alias claims_by_property_id? statements_by_property_id?
71
67
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'wikibase_representable/model/alias_group_list'
4
- require 'wikibase_representable/model/statement_list'
5
- require 'wikibase_representable/model/term_list'
3
+ require 'wikibase_representable/model/alias_group_hash'
4
+ require 'wikibase_representable/model/statement_hash'
5
+ require 'wikibase_representable/model/term_hash'
6
6
  require 'wikibase_representable/model/term'
7
7
 
8
8
  module WikibaseRepresentable
@@ -11,36 +11,20 @@ module WikibaseRepresentable
11
11
  class Property
12
12
  ENTITY_TYPE = 'property'
13
13
 
14
- attr_accessor :type, :id, :data_type, :labels, :descriptions, :alias_groups, :statements
14
+ attr_accessor :type, :id, :data_type, :labels_hash, :descriptions_hash, :alias_groups_hash, :statements_hash
15
15
 
16
16
  def initialize(**kwargs)
17
17
  @type = ENTITY_TYPE
18
18
  @data_type = kwargs[:data_type]
19
19
  @id = kwargs[:id]
20
- @labels = kwargs[:labels] || TermList.new
21
- @descriptions = kwargs[:descriptions] || TermList.new
22
- @alias_groups = kwargs[:alias_groups] || AliasGroupList.new
23
- @statements = kwargs[:statements] || StatementList.new
24
- end
25
-
26
- def label(language_code, value)
27
- @labels.term(Term.new(language_code, value))
28
- end
29
-
30
- def description(language_code, value)
31
- @descriptions.term(Term.new(language_code, value))
32
- end
33
-
34
- def aliases(language_code, aliases)
35
- @alias_groups.aliases_for_language(language_code, aliases)
36
- end
37
-
38
- def empty?
39
- @labels.empty? && @descriptions.empty? && @alias_groups.empty? && @statements.empty?
20
+ @labels_hash = kwargs[:labels_hash] || TermHash.new
21
+ @descriptions_hash = kwargs[:descriptions_hash] || TermHash.new
22
+ @alias_groups_hash = kwargs[:alias_groups_hash] || AliasGroupHash.new
23
+ @statements_hash = kwargs[:statements_hash] || StatementHash.new
40
24
  end
41
25
 
42
26
  def state
43
- [@type, @id, @data_type, @labels, @descriptions, @alias_groups, @statements]
27
+ [type, id, data_type, labels_hash, descriptions_hash, alias_groups_hash, statements_hash]
44
28
  end
45
29
 
46
30
  def ==(other)
@@ -19,7 +19,7 @@ module WikibaseRepresentable
19
19
  end
20
20
 
21
21
  def state
22
- [@type, @property_id, @data_value, @hash]
22
+ [type, property_id, data_value, hash]
23
23
  end
24
24
 
25
25
  def ==(other)
@@ -13,7 +13,7 @@ module WikibaseRepresentable
13
13
  end
14
14
 
15
15
  def state
16
- [@site_id, @page_name, @badges]
16
+ [site_id, page_name, badges]
17
17
  end
18
18
 
19
19
  def ==(other)
@@ -3,7 +3,7 @@
3
3
  module WikibaseRepresentable
4
4
  module Model
5
5
  # Hash of SiteLink objects keyed by site id.
6
- class SiteLinkList < Hash
6
+ class SiteLinkHash < Hash
7
7
  def link_for_site(site_id)
8
8
  fetch(site_id, nil)
9
9
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module WikibaseRepresentable
4
4
  module Model
5
- # Hash of property ID => Snak array.
6
- class SnakList < Hash
5
+ # Hash of Snak lists keyed by property ID
6
+ class SnakHash < Hash
7
7
  def snaks_by_property_id(property_id)
8
8
  fetch(property_id, nil)
9
9
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'wikibase_representable/model/snak_list'
3
+ require 'wikibase_representable/model/snak_hash'
4
4
 
5
5
  module WikibaseRepresentable
6
6
  module Model
@@ -35,11 +35,11 @@ module WikibaseRepresentable
35
35
  end
36
36
 
37
37
  def property_id
38
- @main_snak.property_id
38
+ main_snak.property_id
39
39
  end
40
40
 
41
41
  def state
42
- [@main_snak, @type, @qualifiers, @qualifiers_order, @guid, @rank]
42
+ [main_snak, type, qualifiers, qualifiers_order, guid, rank]
43
43
  end
44
44
 
45
45
  def ==(other)
@@ -2,8 +2,8 @@
2
2
 
3
3
  module WikibaseRepresentable
4
4
  module Model
5
- # Wraps a hash of Statement arrays keyed by entity id.
6
- class StatementList < Hash
5
+ # Hash of Statement lists keyed by property id.
6
+ class StatementHash < Hash
7
7
  def statements_by_property_id(property_id)
8
8
  fetch(property_id, nil)
9
9
  end
@@ -12,7 +12,7 @@ module WikibaseRepresentable
12
12
  end
13
13
 
14
14
  def state
15
- [@language_code, @value]
15
+ [language_code, value]
16
16
  end
17
17
 
18
18
  def ==(other)
@@ -4,8 +4,8 @@ require 'wikibase_representable/model/term'
4
4
 
5
5
  module WikibaseRepresentable
6
6
  module Model
7
- # Wraps a hash of Term objects keyed by language code.
8
- class TermList < Hash
7
+ # Hash of Term objects keyed by language code.
8
+ class TermHash < Hash
9
9
  def term_for_language(language_code)
10
10
  fetch(language_code, nil)
11
11
  end
@@ -16,7 +16,7 @@ module WikibaseRepresentable
16
16
  end
17
17
 
18
18
  def state
19
- [@time, @time_zone, @before, @after, @precision, @calendar_model]
19
+ [time, time_zone, before, after, precision, calendar_model]
20
20
  end
21
21
 
22
22
  def ==(other)
@@ -13,31 +13,31 @@ module WikibaseRepresentable
13
13
  end
14
14
 
15
15
  def time
16
- @value.time
16
+ value.time
17
17
  end
18
18
 
19
19
  def time_zone
20
- @value.time_zone
20
+ value.time_zone
21
21
  end
22
22
 
23
23
  def before
24
- @value.before
24
+ value.before
25
25
  end
26
26
 
27
27
  def after
28
- @value.after
28
+ value.after
29
29
  end
30
30
 
31
31
  def precision
32
- @value.precision
32
+ value.precision
33
33
  end
34
34
 
35
35
  def calendar_model
36
- @value.calendar_model
36
+ value.calendar_model
37
37
  end
38
38
 
39
39
  def state
40
- [@type, @value]
40
+ [type, value]
41
41
  end
42
42
 
43
43
  def ==(other)
@@ -3,7 +3,7 @@
3
3
  require 'wikibase_representable/model/snak_data_value_helper'
4
4
  require 'wikibase_representable/model/statement_data_value_helper'
5
5
 
6
- require 'wikibase_representable/model/alias_group_list'
6
+ require 'wikibase_representable/model/alias_group_hash'
7
7
  require 'wikibase_representable/model/data_value'
8
8
  require 'wikibase_representable/model/entity_id'
9
9
  require 'wikibase_representable/model/entity_id_value'
@@ -11,11 +11,11 @@ require 'wikibase_representable/model/item'
11
11
  require 'wikibase_representable/model/property'
12
12
  require 'wikibase_representable/model/property_value_snak'
13
13
  require 'wikibase_representable/model/site_link'
14
- require 'wikibase_representable/model/site_link_list'
15
- require 'wikibase_representable/model/snak_list'
14
+ require 'wikibase_representable/model/site_link_hash'
15
+ require 'wikibase_representable/model/snak_hash'
16
16
  require 'wikibase_representable/model/statement'
17
- require 'wikibase_representable/model/statement_list'
17
+ require 'wikibase_representable/model/statement_hash'
18
18
  require 'wikibase_representable/model/term'
19
- require 'wikibase_representable/model/term_list'
19
+ require 'wikibase_representable/model/term_hash'
20
20
  require 'wikibase_representable/model/time_value'
21
21
  require 'wikibase_representable/model/time'
@@ -6,7 +6,7 @@ require 'wikibase_representable/representers/term_representer'
6
6
  module WikibaseRepresentable
7
7
  module Representers
8
8
  # Representer for a hash of language_codes => term arrays
9
- class AliasGroupListRepresenter < Representable::Decorator
9
+ class AliasGroupHashRepresenter < Representable::Decorator
10
10
  include Representable::JSON::Hash
11
11
 
12
12
  values decorator: TermRepresenter.for_collection, instance: ->(_fragment) { [] }
@@ -2,10 +2,10 @@
2
2
 
3
3
  require 'representable/json'
4
4
  require 'wikibase_representable/model'
5
- require 'wikibase_representable/representers/alias_group_list_representer'
6
- require 'wikibase_representable/representers/site_link_list_representer'
7
- require 'wikibase_representable/representers/statement_list_representer'
8
- require 'wikibase_representable/representers/term_list_representer'
5
+ require 'wikibase_representable/representers/alias_group_hash_representer'
6
+ require 'wikibase_representable/representers/site_link_hash_representer'
7
+ require 'wikibase_representable/representers/statement_hash_representer'
8
+ require 'wikibase_representable/representers/term_hash_representer'
9
9
 
10
10
  module WikibaseRepresentable
11
11
  module Representers
@@ -16,19 +16,21 @@ module WikibaseRepresentable
16
16
 
17
17
  property :type
18
18
  property :id
19
- property :labels, decorator: TermListRepresenter,
20
- class: TermList
21
- property :descriptions, decorator: TermListRepresenter,
22
- class: TermList
23
- property :alias_groups, as: 'aliases',
24
- decorator: AliasGroupListRepresenter,
25
- class: AliasGroupList
26
- property :statements, as: 'claims',
27
- decorator: StatementListRepresenter,
28
- class: StatementList
29
- property :site_links, as: 'sitelinks',
30
- decorator: SiteLinkListRepresenter,
31
- class: SiteLinkList
19
+ property :labels_hash, as: 'labels',
20
+ decorator: TermHashRepresenter,
21
+ class: TermHash
22
+ property :descriptions_hash, as: 'descriptions',
23
+ decorator: TermHashRepresenter,
24
+ class: TermHash
25
+ property :alias_groups_hash, as: 'aliases',
26
+ decorator: AliasGroupHashRepresenter,
27
+ class: AliasGroupHash
28
+ property :statements_hash, as: 'claims',
29
+ decorator: StatementHashRepresenter,
30
+ class: StatementHash
31
+ property :site_links_hash, as: 'site_links',
32
+ decorator: SiteLinkHashRepresenter,
33
+ class: SiteLinkHash
32
34
  end
33
35
  end
34
36
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  require 'representable/json'
4
4
  require 'wikibase_representable/model'
5
- require 'wikibase_representable/representers/alias_group_list_representer'
6
- require 'wikibase_representable/representers/statement_list_representer'
7
- require 'wikibase_representable/representers/term_list_representer'
5
+ require 'wikibase_representable/representers/alias_group_hash_representer'
6
+ require 'wikibase_representable/representers/statement_hash_representer'
7
+ require 'wikibase_representable/representers/term_hash_representer'
8
8
 
9
9
  module WikibaseRepresentable
10
10
  module Representers
@@ -16,16 +16,18 @@ module WikibaseRepresentable
16
16
  property :type
17
17
  property :data_type, as: 'datatype'
18
18
  property :id
19
- property :labels, decorator: TermListRepresenter,
20
- class: TermList
21
- property :descriptions, decorator: TermListRepresenter,
22
- class: TermList
23
- property :alias_groups, as: 'aliases',
24
- decorator: AliasGroupListRepresenter,
25
- class: AliasGroupList
26
- property :statements, as: 'claims',
27
- decorator: StatementListRepresenter,
28
- class: StatementList
19
+ property :labels_hash, as: 'labels',
20
+ decorator: TermHashRepresenter,
21
+ class: TermHash
22
+ property :descriptions_hash, as: 'descriptions',
23
+ decorator: TermHashRepresenter,
24
+ class: TermHash
25
+ property :alias_groups_hash, as: 'aliases',
26
+ decorator: AliasGroupHashRepresenter,
27
+ class: AliasGroupHash
28
+ property :statements_hash, as: 'claims',
29
+ decorator: StatementHashRepresenter,
30
+ class: StatementHash
29
31
  end
30
32
  end
31
33
  end
@@ -7,7 +7,7 @@ require 'wikibase_representable/representers/site_link_representer'
7
7
  module WikibaseRepresentable
8
8
  module Representers
9
9
  # Representer for a hash of (siteid => sitelink)
10
- class SiteLinkListRepresenter < Representable::Decorator
10
+ class SiteLinkHashRepresenter < Representable::Decorator
11
11
  include Representable::JSON::Hash
12
12
  include WikibaseRepresentable::Model
13
13
 
@@ -5,8 +5,8 @@ require 'wikibase_representable/representers/property_value_snak_representer'
5
5
 
6
6
  module WikibaseRepresentable
7
7
  module Representers
8
- # Representer for a list of property value snaks.
9
- class SnakListRepresenter < Representable::Decorator
8
+ # Representer for a hash of snak lists keyed by property ID.
9
+ class SnakHashRepresenter < Representable::Decorator
10
10
  include Representable::JSON::Hash
11
11
 
12
12
  values decorator: PropertyValueSnakRepresenter.for_collection, instance: ->(_fragment) { [] }
@@ -6,7 +6,7 @@ require 'wikibase_representable/representers/statement_representer'
6
6
  module WikibaseRepresentable
7
7
  module Representers
8
8
  # Representer for a hash of property IDs => statement arrays.
9
- class StatementListRepresenter < Representable::Decorator
9
+ class StatementHashRepresenter < Representable::Decorator
10
10
  include Representable::JSON::Hash
11
11
 
12
12
  values decorator: StatementRepresenter.for_collection, instance: ->(_fragment) { [] }
@@ -3,7 +3,7 @@
3
3
  require 'representable/json'
4
4
  require 'wikibase_representable/model'
5
5
  require 'wikibase_representable/representers/property_value_snak_representer'
6
- require 'wikibase_representable/representers/snak_list_representer'
6
+ require 'wikibase_representable/representers/snak_hash_representer'
7
7
 
8
8
  module WikibaseRepresentable
9
9
  module Representers
@@ -16,8 +16,8 @@ module WikibaseRepresentable
16
16
  decorator: PropertyValueSnakRepresenter,
17
17
  class: PropertyValueSnak
18
18
  property :type
19
- property :qualifiers, decorator: SnakListRepresenter,
20
- class: SnakList
19
+ property :qualifiers, decorator: SnakHashRepresenter,
20
+ class: SnakHash
21
21
  property :qualifiers_order, as: 'qualifiers-order'
22
22
  property :guid, as: 'id'
23
23
  property :rank
@@ -6,8 +6,8 @@ require 'wikibase_representable/representers/term_representer'
6
6
 
7
7
  module WikibaseRepresentable
8
8
  module Representers
9
- # Representer for term lists
10
- class TermListRepresenter < Representable::Decorator
9
+ # Representer for term hashes
10
+ class TermHashRepresenter < Representable::Decorator
11
11
  include Representable::JSON::Hash
12
12
  include WikibaseRepresentable::Model
13
13
 
@@ -1,18 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'wikibase_representable/representers/alias_group_list_representer'
3
+ require 'wikibase_representable/representers/alias_group_hash_representer'
4
4
  require 'wikibase_representable/representers/data_value_representer'
5
5
  require 'wikibase_representable/representers/entity_id_value_representer'
6
6
  require 'wikibase_representable/representers/entity_id_representer'
7
7
  require 'wikibase_representable/representers/item_representer'
8
8
  require 'wikibase_representable/representers/property_value_snak_representer'
9
9
  require 'wikibase_representable/representers/property_representer'
10
- require 'wikibase_representable/representers/site_link_list_representer'
10
+ require 'wikibase_representable/representers/site_link_hash_representer'
11
11
  require 'wikibase_representable/representers/site_link_representer'
12
- require 'wikibase_representable/representers/snak_list_representer'
13
- require 'wikibase_representable/representers/statement_list_representer'
12
+ require 'wikibase_representable/representers/snak_hash_representer'
13
+ require 'wikibase_representable/representers/statement_hash_representer'
14
14
  require 'wikibase_representable/representers/statement_representer'
15
- require 'wikibase_representable/representers/term_list_representer'
15
+ require 'wikibase_representable/representers/term_hash_representer'
16
16
  require 'wikibase_representable/representers/term_representer'
17
17
  require 'wikibase_representable/representers/time_value_representer'
18
18
  require 'wikibase_representable/representers/time_representer'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WikibaseRepresentable
4
- VERSION = '0.1.4'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikibase_representable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Holloway
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-14 00:00:00.000000000 Z
10
+ date: 2025-02-09 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: multi_json
@@ -65,6 +65,20 @@ dependencies:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '3.4'
68
+ - !ruby/object:Gem::Dependency
69
+ name: pry
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 0.15.2
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: 0.15.2
68
82
  - !ruby/object:Gem::Dependency
69
83
  name: rake
70
84
  requirement: !ruby/object:Gem::Requirement
@@ -93,6 +107,20 @@ dependencies:
93
107
  - - "~>"
94
108
  - !ruby/object:Gem::Version
95
109
  version: '3.13'
110
+ - !ruby/object:Gem::Dependency
111
+ name: simplecov
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: 0.22.0
117
+ type: :development
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: 0.22.0
96
124
  - !ruby/object:Gem::Dependency
97
125
  name: upennlib-rubocop
98
126
  requirement: !ruby/object:Gem::Requirement
@@ -115,6 +143,7 @@ executables: []
115
143
  extensions: []
116
144
  extra_rdoc_files: []
117
145
  files:
146
+ - ".rspec"
118
147
  - ".rubocop.yml"
119
148
  - ".rubocop_todo.yml"
120
149
  - LICENSE.txt
@@ -122,7 +151,7 @@ files:
122
151
  - Rakefile
123
152
  - lib/wikibase_representable.rb
124
153
  - lib/wikibase_representable/model.rb
125
- - lib/wikibase_representable/model/alias_group_list.rb
154
+ - lib/wikibase_representable/model/alias_group_hash.rb
126
155
  - lib/wikibase_representable/model/data_value.rb
127
156
  - lib/wikibase_representable/model/entity_id.rb
128
157
  - lib/wikibase_representable/model/entity_id_value.rb
@@ -130,30 +159,30 @@ files:
130
159
  - lib/wikibase_representable/model/property.rb
131
160
  - lib/wikibase_representable/model/property_value_snak.rb
132
161
  - lib/wikibase_representable/model/site_link.rb
133
- - lib/wikibase_representable/model/site_link_list.rb
162
+ - lib/wikibase_representable/model/site_link_hash.rb
134
163
  - lib/wikibase_representable/model/snak_data_value_helper.rb
135
- - lib/wikibase_representable/model/snak_list.rb
164
+ - lib/wikibase_representable/model/snak_hash.rb
136
165
  - lib/wikibase_representable/model/statement.rb
137
166
  - lib/wikibase_representable/model/statement_data_value_helper.rb
138
- - lib/wikibase_representable/model/statement_list.rb
167
+ - lib/wikibase_representable/model/statement_hash.rb
139
168
  - lib/wikibase_representable/model/term.rb
140
- - lib/wikibase_representable/model/term_list.rb
169
+ - lib/wikibase_representable/model/term_hash.rb
141
170
  - lib/wikibase_representable/model/time.rb
142
171
  - lib/wikibase_representable/model/time_value.rb
143
172
  - lib/wikibase_representable/representers.rb
144
- - lib/wikibase_representable/representers/alias_group_list_representer.rb
173
+ - lib/wikibase_representable/representers/alias_group_hash_representer.rb
145
174
  - lib/wikibase_representable/representers/data_value_representer.rb
146
175
  - lib/wikibase_representable/representers/entity_id_representer.rb
147
176
  - lib/wikibase_representable/representers/entity_id_value_representer.rb
148
177
  - lib/wikibase_representable/representers/item_representer.rb
149
178
  - lib/wikibase_representable/representers/property_representer.rb
150
179
  - lib/wikibase_representable/representers/property_value_snak_representer.rb
151
- - lib/wikibase_representable/representers/site_link_list_representer.rb
180
+ - lib/wikibase_representable/representers/site_link_hash_representer.rb
152
181
  - lib/wikibase_representable/representers/site_link_representer.rb
153
- - lib/wikibase_representable/representers/snak_list_representer.rb
154
- - lib/wikibase_representable/representers/statement_list_representer.rb
182
+ - lib/wikibase_representable/representers/snak_hash_representer.rb
183
+ - lib/wikibase_representable/representers/statement_hash_representer.rb
155
184
  - lib/wikibase_representable/representers/statement_representer.rb
156
- - lib/wikibase_representable/representers/term_list_representer.rb
185
+ - lib/wikibase_representable/representers/term_hash_representer.rb
157
186
  - lib/wikibase_representable/representers/term_representer.rb
158
187
  - lib/wikibase_representable/representers/time_representer.rb
159
188
  - lib/wikibase_representable/representers/time_value_representer.rb