Class: WorldBank::ParamQuery

Inherits:
Query
  • Object
show all
Defined in:
lib/world_bank/param_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) ⇒ ParamQuery

Returns a new instance of ParamQuery.



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

def initialize(name, id, model)
  super
end

Instance Method Details

#country(country) ⇒ Object



27
28
29
30
31
32
# File 'lib/world_bank/param_query.rb', line 27

def country(country)
  parsed = indifferent_type country
  parsed = ensure_country_id parsed
  @query[:params].merge!({:countries => parsed})
  self
end


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

def featured_indicators
  @query[:params].merge!({:featured => 1})
  self
end

#income_level(income_levels) ⇒ Object



15
16
17
18
19
# File 'lib/world_bank/param_query.rb', line 15

def income_level(income_levels)
  parsed = indifferent_number income_levels
  @query[:params].merge!({:incomeLevels => parsed})
  self
end

#indicator(indicators) ⇒ Object



34
35
36
37
38
# File 'lib/world_bank/param_query.rb', line 34

def indicator(indicators)
  parsed = indifferent_number indicators
  @query[:params].merge!({:indicators => parsed})
  self
end

#lending_type(lending_type) ⇒ Object



9
10
11
12
13
# File 'lib/world_bank/param_query.rb', line 9

def lending_type(lending_type)
  parsed = indifferent_number lending_type
  @query[:params].merge!({:lendingTypes => parsed})
  self
end

#region(regions) ⇒ Object



21
22
23
24
25
# File 'lib/world_bank/param_query.rb', line 21

def region(regions)
  parsed = indifferent_number regions
  @query[:params].merge!({:countries => parsed})
  self
end

#source(sources) ⇒ Object



45
46
47
48
49
# File 'lib/world_bank/param_query.rb', line 45

def source(sources)
  parsed = indifferent_number sources
  @query[:params].merge!({:sources => parsed})
  self
end