Class: WorldBank::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/world_bank/data.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values = {}) ⇒ Data

Returns a new instance of Data.



63
64
65
66
67
68
69
70
71
# File 'lib/world_bank/data.rb', line 63

def initialize(values={})
  @raw = values
  @name = values['indicator'].delete('value')
  @id = values['indicator'].delete('id')
  @value = values.delete('value')
  @date = values.delete('date')
  values.delete('indicator')
  @others = values
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



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

def date
  @date
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#othersObject (readonly)

Returns the value of attribute others.



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

def others
  @others
end

#rawObject (readonly)

Returns the value of attribute raw.



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

def raw
  @raw
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Class Method Details

.allObject



55
56
57
# File 'lib/world_bank/data.rb', line 55

def self.all
  find('all')
end

.country(arg) ⇒ Object



47
48
49
# File 'lib/world_bank/data.rb', line 47

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

.fetch(arg) ⇒ Object



51
52
53
# File 'lib/world_bank/data.rb', line 51

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

.find(id) ⇒ Object



59
60
61
# File 'lib/world_bank/data.rb', line 59

def self.find(id)
  WorldBank::DataQuery.new('indicators', id, self)
end

.format(arg) ⇒ Object



7
8
9
# File 'lib/world_bank/data.rb', line 7

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

.id(arg) ⇒ Object



11
12
13
# File 'lib/world_bank/data.rb', line 11

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

.income_level(arg) ⇒ Object



35
36
37
# File 'lib/world_bank/data.rb', line 35

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

.language(arg) ⇒ Object



31
32
33
# File 'lib/world_bank/data.rb', line 31

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

.lending_type(arg) ⇒ Object



39
40
41
# File 'lib/world_bank/data.rb', line 39

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

.most_recent_values(arg) ⇒ Object



19
20
21
# File 'lib/world_bank/data.rb', line 19

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

.page(arg) ⇒ Object



23
24
25
# File 'lib/world_bank/data.rb', line 23

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

.per_pageObject



27
28
29
# File 'lib/world_bank/data.rb', line 27

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

.rawObject



15
16
17
# File 'lib/world_bank/data.rb', line 15

def self.raw
  find('all').raw
end

.region(arg) ⇒ Object



43
44
45
# File 'lib/world_bank/data.rb', line 43

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