Class: Algorithmia

Inherits:
Object
  • Object
show all
Includes:
HTTParty, Singleton
Defined in:
lib/algorithmia/http.rb,
lib/algorithmia.rb,
lib/algorithmia/base.rb,
lib/algorithmia/version.rb,
lib/algorithmia/authentication.rb

Overview

Algorithmia Ruby wrapper. Released under the MIT License github.com/bih/algorithmia

Defined Under Namespace

Classes: Result

Constant Summary collapse

VERSION =
"0.2.0"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#api_key=(value) ⇒ Object (writeonly)

Sets the attribute api_key

Parameters:

  • value

    the value to set the attribute api_key to.



6
7
8
# File 'lib/algorithmia/authentication.rb', line 6

def api_key=(value)
  @api_key = value
end

Class Method Details

.api_keyObject

Authentication stuffs.



9
10
11
# File 'lib/algorithmia/authentication.rb', line 9

def self.api_key
  @api_key
end

.api_key=(api_key) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/algorithmia/authentication.rb', line 17

def self.api_key=(api_key)
  if not api_key.is_a?(String) or api_key.to_s.empty?
    raise AlgorithmiaApiKeyTooShort.new("Invalid Algorithmia API key")
  end

  @api_key = api_key
end

.api_key?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/algorithmia/authentication.rb', line 13

def self.api_key?
  not @api_key.nil?
end

.call(endpoint, input) ⇒ Object



15
16
17
# File 'lib/algorithmia.rb', line 15

def self.call(endpoint, input)
  post_http("/#{endpoint}", input.to_json)
end