Sha256: 00c64ea2cb98cb9af7ad951a607c61ad27710fbc8b4fe89d42fada74f38cf2c1

Contents?: true

Size: 968 Bytes

Versions: 4

Compression:

Stored size: 968 Bytes

Contents

require 'worldbank_as_dataframe/queriable'
module WorldbankAsDataframe

  class Indicator
    extend WorldbankAsDataframe::Queriable
    attr_reader :raw, :id, :name, :source, :note, :organization, :topics, :type

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

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

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

    def self.all
      find('all')
    end

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

    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
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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