Sha256: 8685198027718344d4bcec8f6dbad5d2b6f1d62053e901143e9d7036b3fb8666
Contents?: true
Size: 1000 Bytes
Versions: 3
Compression:
Stored size: 1000 Bytes
Contents
require 'worldbank_as_dataframe/queriable' module WorldbankAsDataframe class Data extend WorldbankAsDataframe::Queriable attr_reader :raw, :name, :id, :value, :date, :others def self.raw find('all').raw end def self.country(arg) find('all').country(arg) end def self.fetch(arg) find(arg).fetch end def self.all find('all') end def self.find(id) WorldbankAsDataframe::DataQuery.new('indicator', id, self) end 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 def to_h hdr = @name suffix = nil suffix = " for #{@others['country']['value']}" rescue '' hdr += suffix {'Timestamps' => Date.new(@date.to_i, 12, 31), hdr => @value } end end end
Version data entries
3 entries across 3 versions & 1 rubygems