Class: Quandl::Data
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from ModelBase
#data_fields, #inspect, #to_a
Constructor Details
#initialize(data, options = {}) ⇒ Data
Returns a new instance of Data.
15
16
17
18
19
|
# File 'lib/quandl/model/data.rb', line 15
def initialize(data, options = {})
converted_column_names = options[:meta]['column_names'].map { |cn| Quandl::Util.methodize(cn) }
@raw_data = Quandl::Util.convert_to_dates(Hash[converted_column_names.zip(data)])
@meta = options[:meta]
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
27
28
29
30
|
# File 'lib/quandl/model/data.rb', line 27
def method_missing(method_name, *args, &block)
return @meta[method_name.to_s] if @meta.key?(method_name.to_s)
super
end
|
Class Method Details
.create_list_from_response(_response, data) ⇒ Object
5
6
7
8
9
|
# File 'lib/quandl/model/data.rb', line 5
def self.create_list_from_response(_response, data)
values = data['dataset_data'].delete('data')
metadata = data['dataset_data']
Quandl::List.new(self, values, metadata)
end
|
.list_path ⇒ Object
11
12
13
|
# File 'lib/quandl/model/data.rb', line 11
def self.list_path
'datasets/:database_code/:dataset_code/data'
end
|
Instance Method Details
#column_names ⇒ Object
21
22
23
|
# File 'lib/quandl/model/data.rb', line 21
def column_names
@meta['column_names']
end
|