Class: WorldBank::DataQuery

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

Instance Attribute Summary

Attributes inherited from Query

#pages, #total

Instance Method Summary collapse

Methods inherited from Query

#cycle, #dates, #fetch, #format, #id, #language, #most_recent_values, #next, #page, #per_page, #raw

Constructor Details

#initialize(name, id, model) ⇒ DataQuery

Returns a new instance of DataQuery.



5
6
7
8
9
# File 'lib/world_bank/data_query.rb', line 5

def initialize(name, id, model)
  super
  @param_dir = []
  @params_filled = false
end

Instance Method Details

#country(country) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/world_bank/data_query.rb', line 32

def country(country)
  ensure_unconflicting_qualifiers
  parsed = indifferent_type country
  parsed = ensure_country_id parsed
  @param_dir = ['countries', parsed]
  self
end

#income_level(income_level) ⇒ Object



18
19
20
21
22
23
# File 'lib/world_bank/data_query.rb', line 18

def income_level(income_level)
  ensure_unconflicting_qualifiers
  parsed = indifferent_number income_level
  @param_dir = ['incomeLevels', parsed]
  self
end

#indicator(indicators) ⇒ Object Also known as: find



40
41
42
43
44
# File 'lib/world_bank/data_query.rb', line 40

def indicator(indicators)
  parsed = indifferent_number indicators
  @id = parsed
  self
end

#lending_type(lending_type) ⇒ Object



11
12
13
14
15
16
# File 'lib/world_bank/data_query.rb', line 11

def lending_type(lending_type)
  ensure_unconflicting_qualifiers
  parsed = indifferent_number lending_type
  @param_dir = ['lendingTypes', parsed]
  self
end

#region(regions) ⇒ Object



25
26
27
28
29
30
# File 'lib/world_bank/data_query.rb', line 25

def region(regions)
  ensure_unconflicting_qualifiers
  parsed = indifferent_number regions
  @param_dir = ['countries', parsed]
  self
end

#source(sources) ⇒ Object



47
48
49
50
51
52
# File 'lib/world_bank/data_query.rb', line 47

def source(sources)
  ensure_unconflicting_qualifiers
  parsed = indifferent_number sources
  @param_dir = ['sources', parsed]
  self
end