Sha256: 7590bdeea34e427768205967c6c2d704737b11249adb6919b25ece0276bd879f

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

module WorldbankAsDataframe

  class ParamQuery < Query
  
    def initialize(name, id, model)
      super
    end
    
    def lending_type(lending_type)
      parsed = indifferent_number lending_type
      @query[:params].merge!({:lendingTypes => parsed})
      self
    end

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

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

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

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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
worldbank_as_dataframe-0.2.1 lib/worldbank_as_dataframe/param_query.rb
worldbank_as_dataframe-0.2 lib/worldbank_as_dataframe/param_query.rb
worldbank_as_dataframe-0.1.1 lib/worldbank_as_dataframe/param_query.rb
worldbank_as_dataframe-0.1.0 lib/worldbank_as_dataframe/param_query.rb