Class: Reality::Extras::Quandl::Economy

Inherits:
Object
  • Object
show all
Defined in:
lib/reality/extras/quandl.rb

Instance Method Summary collapse

Constructor Details

#initialize(country) ⇒ Economy

Returns a new instance of Economy.



7
8
9
# File 'lib/reality/extras/quandl.rb', line 7

def initialize(country)
  @country = country
end

Instance Method Details

#gdpObject



11
12
13
14
15
# File 'lib/reality/extras/quandl.rb', line 11

def gdp
  gdp = fetch("ODA/#{@country.iso3_code}_NGDPD")
  gdp = gdp.to_i * 1_000_000_000
  Reality::Measure(gdp, '$')
end

#inflationObject



17
18
19
20
# File 'lib/reality/extras/quandl.rb', line 17

def inflation
  inflation = fetch("ODA/#{@country.iso3_code}_PCPIPCH")
  Reality::Measure(inflation, '%')
end

#inspectObject



27
28
29
# File 'lib/reality/extras/quandl.rb', line 27

def inspect
  "#<Reality::Quandl::Economy (%s)>" % [@country.name]
end

#unemploymentObject



22
23
24
25
# File 'lib/reality/extras/quandl.rb', line 22

def unemployment
  unemployment = fetch("ODA/#{@country.iso3_code}_LUR")
  Reality::Measure(unemployment, '%')
end