Class: RubySpark::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_spark/core.rb

Direct Known Subclasses

Tinker

Defined Under Namespace

Classes: ApiError

Instance Method Summary collapse

Constructor Details

#initialize(core_id, access_token = RubySpark.access_token) ⇒ Core

Returns a new instance of Core.



6
7
8
9
10
11
# File 'lib/ruby_spark/core.rb', line 6

def initialize(core_id, access_token = RubySpark.access_token)
  raise RubySpark::ConfigurationError.new("Access Token not defined") if access_token.nil?

  @access_token = access_token
  @core_id    = core_id
end

Instance Method Details

#function(function_name, arguments) ⇒ Object



27
28
29
30
31
32
# File 'lib/ruby_spark/core.rb', line 27

def function(function_name, arguments)
  response = post(function_name, :params => arguments)
  handle(response) do
    response["return_value"]
  end
end

#infoObject



13
14
15
16
17
18
# File 'lib/ruby_spark/core.rb', line 13

def info
  response = get("")
  handle(response) do
    response
  end
end

#variable(variable_name) ⇒ Object



20
21
22
23
24
25
# File 'lib/ruby_spark/core.rb', line 20

def variable(variable_name)
  response = get(variable_name)
  handle(response) do
    response["TEMPORARY_allTypes"]["number"]
  end
end