Class: NexosisApi::SessionResponse

Inherits:
Session
  • Object
show all
Defined in:
lib/nexosis_api/session_response.rb

Overview

Class to parse the results from a new session

Instance Attribute Summary collapse

Attributes inherited from Session

#column_metadata, #datasource_name, #end_date, #extra_parameters, #links, #messages, #model_id, #name, #prediction_domain, #prediction_intervals, #requested_date, #result_interval, #session_id, #start_date, #status, #status_history, #supports_feature_importance, #target_column, #type

Instance Method Summary collapse

Constructor Details

#initialize(forecast_hash) ⇒ SessionResponse

Returns a new instance of SessionResponse.



6
7
8
9
10
11
12
13
14
15
16
17
18
# 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

Instance Attribute Details

#datasets_allottedObject (readonly)

Returns the value of attribute datasets_allotted.



20
21
22
# File 'lib/nexosis_api/session_response.rb', line 20

def datasets_allotted
  @datasets_allotted
end

#datasets_currentObject (readonly)

Returns the value of attribute datasets_current.



22
23
24
# File 'lib/nexosis_api/session_response.rb', line 22

def datasets_current
  @datasets_current
end

#predictions_allottedObject (readonly)

Returns the value of attribute predictions_allotted.



23
24
25
# File 'lib/nexosis_api/session_response.rb', line 23

def predictions_allotted
  @predictions_allotted
end

#predictions_currentObject (readonly)

Returns the value of attribute predictions_current.



24
25
26
# File 'lib/nexosis_api/session_response.rb', line 24

def predictions_current
  @predictions_current
end

#sessions_allottedObject (readonly)

Returns the value of attribute sessions_allotted.



25
26
27
# File 'lib/nexosis_api/session_response.rb', line 25

def sessions_allotted
  @sessions_allotted
end

#sessions_currentObject (readonly)

Returns the value of attribute sessions_current.



26
27
28
# File 'lib/nexosis_api/session_response.rb', line 26

def sessions_current
  @sessions_current
end