Class: WikidataPositionHistory::MandateRow

Inherits:
SPARQL::QueryRow show all
Defined in:
lib/sparql/mandates_query.rb

Overview

Represents a single row returned from the Mandates query

Instance Method Summary collapse

Methods inherited from SPARQL::QueryRow

#initialize

Constructor Details

This class inherits a constructor from WikidataPositionHistory::SPARQL::QueryRow

Instance Method Details

#acting?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/sparql/mandates_query.rb', line 79

def acting?
  nature == 'Q4676846'
end

#end_dateObject



87
88
89
# File 'lib/sparql/mandates_query.rb', line 87

def end_date
  date_from(:end_date, :end_precision)
end

#natureObject

TODO: switch to item_from



75
76
77
# File 'lib/sparql/mandates_query.rb', line 75

def nature
  QueryService::WikidataItem.new(row.dig(:nature, :value)).id
end

#nextObject

TODO: switch to item_from



70
71
72
# File 'lib/sparql/mandates_query.rb', line 70

def next
  QueryService::WikidataItem.new(row.dig(:next, :value)).qlink
end

#officeholderObject



60
61
62
# File 'lib/sparql/mandates_query.rb', line 60

def officeholder
  item_from(:item)
end

#ordinalObject



56
57
58
# File 'lib/sparql/mandates_query.rb', line 56

def ordinal
  raw(:ordinal)
end

#prevObject

TODO: switch to item_from



65
66
67
# File 'lib/sparql/mandates_query.rb', line 65

def prev
  QueryService::WikidataItem.new(row.dig(:prev, :value)).qlink
end

#start_dateObject



83
84
85
# File 'lib/sparql/mandates_query.rb', line 83

def start_date
  date_from(:start_date, :start_precision)
end