Class: Algorithmia
- Inherits:
-
Object
- Object
- Algorithmia
- 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
-
#api_key ⇒ Object
writeonly
Sets the attribute api_key.
Class Method Summary collapse
-
.api_key ⇒ Object
Authentication stuffs.
- .api_key=(api_key) ⇒ Object
- .api_key? ⇒ Boolean
- .call(endpoint, input) ⇒ Object
Instance Attribute Details
#api_key=(value) ⇒ Object (writeonly)
Sets the attribute api_key
6 7 8 |
# File 'lib/algorithmia/authentication.rb', line 6 def api_key=(value) @api_key = value end |
Class Method Details
.api_key ⇒ Object
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
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 |