class NexosisApi::SessionResponse

Class to parse the results from a new session

Attributes

datasets_allotted[R]
datasets_current[R]
predictions_allotted[R]
predictions_current[R]
sessions_allotted[R]
sessions_current[R]

Public Class Methods

new(forecast_hash) click to toggle source
Calls superclass method NexosisApi::Session::new
# File lib/nexosis_api/session_response.rb, line 6
def initialize(forecast_hash)
  val_map = {
    'Nexosis-Account-DataSetCount-Allotted' => :@datasets_allotted,
    'Nexosis-Account-DataSetCount-Current' => :@datasets_current,
    'Nexosis-Account-PredictionCount-Allotted' => :@predictions_allotted,
    'Nexosis-Account-PredictionCount-Current' => :@predictions_current,
    'Nexosis-Account-SessionCount-Allotted' => :@sessions_allotted,
    'Nexosis-Account-SessionCount-Current' => :@sessions_current
  }
  super(forecast_hash['session']) unless forecast_hash['session'].nil?
  super(forecast_hash.reject { |k, _v| k.to_s.downcase.start_with? 'nexosis-account' }) if forecast_hash['session'].nil?
  val_map.each { |k, _v| instance_variable_set(val_map[k], forecast_hash[k]) }
end