Module: Barton

Defined in:
lib/barton.rb,
lib/barton/app.rb,
lib/barton/core.rb,
lib/barton/version.rb

Defined Under Namespace

Modules: Data, Find, Setup Classes: App

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configObject

Configuration options for the Gem



38
39
40
41
# File 'lib/barton/core.rb', line 38

def self.config
  #puts ENV['RAKE_ENV']
  #Data.config
end

.data_loadedObject



5
6
7
# File 'lib/barton.rb', line 5

def data_loaded
  @@data_loaded ||= false
end

.data_loaded=(bool) ⇒ Object



9
10
11
# File 'lib/barton.rb', line 9

def data_loaded=(bool)
  @@data_loaded = bool
end

.electorates(query = {}) ⇒ Object

Returns an array of electorates matching the search criteria

Accepts a hash of criteria
  :id
  :tags
  :geo
  :address
Returns an array of hashes


16
17
18
# File 'lib/barton/core.rb', line 16

def Barton.electorates( query = {} )
  Find.electorates( query )
end

.setupObject

Loads electoral data from the yaml files into elasticsearch



28
29
30
31
32
33
34
35
# File 'lib/barton/core.rb', line 28

def self.setup
  Data.config
  Data.purge_es
  Dir['data/*.yaml'].each do |f|
    Setup.load_file( f )
  end
  Barton.data_loaded = true
end

Instance Method Details

#membersObject

Returns an array of member matching the search criteria

Accepts a hash of criteria
Returns an array of hashes


23
24
25
# File 'lib/barton/core.rb', line 23

def members
  # TBA
end