Module: Everypolitician
- Defined in:
- lib/everypolitician.rb,
lib/everypolitician/index.rb,
lib/everypolitician/country.rb,
lib/everypolitician/version.rb,
lib/everypolitician/legislature.rb,
lib/everypolitician/legislative_period.rb
Defined Under Namespace
Classes: Country, Index, LegislativePeriod, Legislature
Constant Summary
collapse
- VERSION =
'0.20.0'.freeze
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.countries ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/everypolitician.rb', line 19
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
14
15
16
17
|
# File 'lib/everypolitician.rb', line 14
def self.countries_json
@countries_json ||= 'https://raw.githubusercontent.com/' \
'everypolitician/everypolitician-data/master/countries.json'
end
|
Class Method Details
.country(slug) ⇒ Object
27
28
29
|
# File 'lib/everypolitician.rb', line 27
def self.country(slug)
Country.find(slug)
end
|
.country_legislature(country_slug, legislature_slug) ⇒ Object
35
36
37
38
39
|
# File 'lib/everypolitician.rb', line 35
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
31
32
33
|
# File 'lib/everypolitician.rb', line 31
def self.legislature(country_slug, legislature_slug)
Legislature.find(country_slug, legislature_slug)
end
|