class NexosisApi::DatasetSummary

class to hold the parsed results of a dataset

Attributes

column_metadata[RW]

Descriptive information about the columns @return [Array of NexosisApi::Column]

dataset_name[RW]

The name of the dataset uploaded and saved @return [String]

dataset_size[R]

number of estimated bytes required to store the dataset @return [Integer] @since 2.3.0

Public Class Methods

new(data_hash) click to toggle source
# 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

Public Instance Methods

timeseries?() click to toggle source

Helper method which tells you whether or not this dataset has a column with timestamp role. @note Often helpful for implmenters as non-timeseries datasets cannot be sent to forecast or impact sessions @since 1.3.0

# File lib/nexosis_api/dataset_summary.rb, line 43
def timeseries?
  !@column_metadata.select { |dc| dc.role == NexosisApi::ColumnRole::TIMESTAMP }.empty?
end