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, #prediction_domain, #prediction_intervals, #requested_date, #result_interval, #session_id, #start_date, #status, #status_history, #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
19
20
21
22
# 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
  }
  forecast_hash.each do |k, v|
    if (k == 'session')
      super(v) unless v.nil?
    else
      instance_variable_set(val_map[k], v) unless val_map[k].nil?
    end
  end
end

Instance Attribute Details

#datasets_allottedObject (readonly)

Returns the value of attribute datasets_allotted.


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

def datasets_allotted
  @datasets_allotted
end

#datasets_currentObject (readonly)

Returns the value of attribute datasets_current.


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

def datasets_current
  @datasets_current
end

#predictions_allottedObject (readonly)

Returns the value of attribute predictions_allotted.


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

def predictions_allotted
  @predictions_allotted
end

#predictions_currentObject (readonly)

Returns the value of attribute predictions_current.


28
29
30
# File 'lib/nexosis_api/session_response.rb', line 28

def predictions_current
  @predictions_current
end

#sessions_allottedObject (readonly)

Returns the value of attribute sessions_allotted.


29
30
31
# File 'lib/nexosis_api/session_response.rb', line 29

def sessions_allotted
  @sessions_allotted
end

#sessions_currentObject (readonly)

Returns the value of attribute sessions_current.


30
31
32
# File 'lib/nexosis_api/session_response.rb', line 30

def sessions_current
  @sessions_current
end