Class: NexosisApi::DatasetSummary
- Inherits:
-
Object
- Object
- NexosisApi::DatasetSummary
- Defined in:
- lib/nexosis_api/dataset_summary.rb
Overview
class to hold the parsed results of a dataset
Instance Attribute Summary collapse
-
#column_metadata ⇒ Array of NexosisApi::Column
Descriptive information about the columns.
-
#dataset_name ⇒ String
The name of the dataset uploaded and saved.
-
#dataset_size ⇒ Integer
readonly
number of estimated bytes required to store the dataset.
-
#links ⇒ Array of NexosisApi::Link
Helpful links to more information about this dataset.
Instance Method Summary collapse
-
#initialize(data_hash) ⇒ DatasetSummary
constructor
A new instance of DatasetSummary.
-
#timeseries? ⇒ Boolean
Helper method which tells you whether or not this dataset has a column with timestamp role.
Constructor Details
#initialize(data_hash) ⇒ DatasetSummary
Returns a new instance of DatasetSummary.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/nexosis_api/dataset_summary.rb', line 4 def initialize(data_hash) data_hash.each do |k, v| if (k == 'dataSetName') @dataset_name = v unless v.nil? elsif (k == 'columns') @column_metadata = v.reject { |_key, value| value.nil? } .map do |col_key, col_val| NexosisApi::Column.new(col_key, col_val) end elsif (k == 'dataSetSize') @dataset_size = v.to_i elsif (k == 'links') @links = v.reject(&:nil?).map { |l| NexosisApi::Link.new(l) } end end end |
Instance Attribute Details
#column_metadata ⇒ Array of NexosisApi::Column
Descriptive information about the columns
27 28 29 |
# File 'lib/nexosis_api/dataset_summary.rb', line 27 def @column_metadata end |
#dataset_name ⇒ String
The name of the dataset uploaded and saved
23 24 25 |
# File 'lib/nexosis_api/dataset_summary.rb', line 23 def dataset_name @dataset_name end |
#dataset_size ⇒ Integer (readonly)
number of estimated bytes required to store the dataset
32 33 34 |
# File 'lib/nexosis_api/dataset_summary.rb', line 32 def dataset_size @dataset_size end |
#links ⇒ Array of NexosisApi::Link
Helpful links to more information about this dataset
37 38 39 |
# File 'lib/nexosis_api/dataset_summary.rb', line 37 def links @links end |
Instance Method Details
#timeseries? ⇒ Boolean
Often helpful for implmenters as non-timeseries datasets
Helper method which tells you whether or not this dataset has a column with timestamp role. cannot be sent to forecast or impact sessions
43 44 45 |
# File 'lib/nexosis_api/dataset_summary.rb', line 43 def timeseries? !@column_metadata.select { |dc| dc.role == NexosisApi::ColumnRole::TIMESTAMP }.empty? end |