Class: WorldbankAsDataframe::Indicator

Inherits:
Object
  • Object
show all
Extended by:
Queriable
Defined in:
lib/worldbank_as_dataframe/indicator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Queriable

format, income_level, language, lending_type, most_recent_values, page, per_page, region

Constructor Details

#initialize(values = {}) ⇒ Indicator

Returns a new instance of Indicator.



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/worldbank_as_dataframe/indicator.rb', line 28

def initialize(values={})
  @raw = values
  @id = values['id']
  @name = values['name']
  @source = WorldbankAsDataframe::Source.new(values['source'])
  @note = values['sourceNote']
  @organization = values['sourceOrganization']
  @topics = []
  values['topics'].each do |topic| 
    @topics << WorldbankAsDataframe::Topic.new(topic)
  end
  @type = 'indicator'
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/worldbank_as_dataframe/indicator.rb', line 6

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/worldbank_as_dataframe/indicator.rb', line 6

def name
  @name
end

#noteObject (readonly)

Returns the value of attribute note.



6
7
8
# File 'lib/worldbank_as_dataframe/indicator.rb', line 6

def note
  @note
end

#organizationObject (readonly)

Returns the value of attribute organization.



6
7
8
# File 'lib/worldbank_as_dataframe/indicator.rb', line 6

def organization
  @organization
end

#rawObject (readonly)

Returns the value of attribute raw.



6
7
8
# File 'lib/worldbank_as_dataframe/indicator.rb', line 6

def raw
  @raw
end

#sourceObject (readonly)

Returns the value of attribute source.



6
7
8
# File 'lib/worldbank_as_dataframe/indicator.rb', line 6

def source
  @source
end

#topicsObject (readonly)

Returns the value of attribute topics.



6
7
8
# File 'lib/worldbank_as_dataframe/indicator.rb', line 6

def topics
  @topics
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/worldbank_as_dataframe/indicator.rb', line 6

def type
  @type
end

Class Method Details

.allObject



20
21
22
# File 'lib/worldbank_as_dataframe/indicator.rb', line 20

def self.all
  find('all')
end

.countryObject



8
9
10
# File 'lib/worldbank_as_dataframe/indicator.rb', line 8

def self.country
  find('all').country(arg)
end


16
17
18
# File 'lib/worldbank_as_dataframe/indicator.rb', line 16

def self.featured
  find('all').featured_indicators
end

.fetch(arg) ⇒ Object



12
13
14
# File 'lib/worldbank_as_dataframe/indicator.rb', line 12

def self.fetch(arg)
  find(arg).fetch
end

.find(id) ⇒ Object



24
25
26
# File 'lib/worldbank_as_dataframe/indicator.rb', line 24

def self.find(id)
  WorldbankAsDataframe::ParamQuery.new('indicator', id, self)
end