Module: Everypolitician
- Defined in:
- lib/everypolitician.rb,
lib/everypolitician/version.rb
Defined Under Namespace
Classes: Country, Index, LegislativePeriod, Legislature
Constant Summary
collapse
- VERSION =
'0.16.0'.freeze
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.countries ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/everypolitician.rb', line 18
def self.countries
@countries ||= begin
JSON.parse(open(countries_json).read, symbolize_names: true).map do |c|
Country.new(c)
end
end
end
|
.countries_json ⇒ Object
13
14
15
16
|
# File 'lib/everypolitician.rb', line 13
def self.countries_json
@countries_json ||= 'https://raw.githubusercontent.com/' \
'everypolitician/everypolitician-data/master/countries.json'
end
|
Class Method Details
.country(slug) ⇒ Object
26
27
28
|
# File 'lib/everypolitician.rb', line 26
def self.country(slug)
Country.find(slug)
end
|
.country_legislature(country_slug, legislature_slug) ⇒ Object
34
35
36
37
38
|
# File 'lib/everypolitician.rb', line 34
def self.country_legislature(country_slug, legislature_slug)
country = Country.find(country_slug)
legislature = country.legislature(legislature_slug)
[country, legislature]
end
|
.legislature(country_slug, legislature_slug) ⇒ Object
30
31
32
|
# File 'lib/everypolitician.rb', line 30
def self.legislature(country_slug, legislature_slug)
Legislature.find(country_slug, legislature_slug)
end
|