algorithmia 0.9.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 221b1eceac956d96b62ff29d39f7d3f922f17607
4
- data.tar.gz: 9a95bdc4128ca4bfbbc72e2be46e6279cb807eed
3
+ metadata.gz: 58520146bbbd4bf21f0d0c7c7accc707d70c4026
4
+ data.tar.gz: 3833bedd5cc9467ab53359501e0604da85df5b9f
5
5
  SHA512:
6
- metadata.gz: 7ce500a43c125a943e498913dba6a5f99d2652c73d7a7db8f198759cf380475db0afd590f3a05b37369dd3f858c6df68e77e498bd51989c4a8e14e0830bdcea4
7
- data.tar.gz: 2dc4531f7708d00e13806eb6102b91e81eff0404eace4e42824e0ae91ed877ad7d8669a4fb335be563eb8095ed651d4e611824ef40605929bc8da65b156852c9
6
+ metadata.gz: 18d2c1fe796f70c1c61ca7d59b0cb7545c8f3ff4ab0ef96ea525826485654f7bc2974821e6995cacc3c5fa63d7cb8872e8a15187c0e1301483babbee8b35e541
7
+ data.tar.gz: 967c7bdea28778abb6777dc15f9318e145919be74621a12c07931659662739a25b10a54afd1c1965c4a74687271d41a4cd64dddd0f1032cc9ac5a388d1a51a8d
data/README.md CHANGED
@@ -4,172 +4,192 @@ The Algorithmia Ruby client is a wrapper for making calls to the Algorithmia API
4
4
 
5
5
  With Algorithmia, you can leverage algorithms written in any language by including them in your Ruby project with a simple API call! Browse the collection of algorithms available on [Algorithmia.com](http://algorithmia.com).
6
6
 
7
- ## Installation
8
- Add this line to your application's Gemfile:
7
+ ## Getting started
8
+
9
+ The Algorithmia ruby client is [available on rubygems](https://rubygems.org/gems/algorithmia).
10
+ Simply add `gem 'algorithmia'` to your application's Gemfile and run `bundle install`.
11
+
12
+ Then create an Algorithmia client and authenticate with your API key:
9
13
 
10
14
  ```ruby
11
- gem 'algorithmia'
15
+ require 'algorithmia'
16
+
17
+ client = Algorithmia.client('YOUR_API_KEY')
12
18
  ```
13
19
 
14
- And then execute:
20
+ You are now ready to call algorithms.
15
21
 
16
- ```bash
17
- $ bundle
18
- ```
22
+ ## Calling algorithms
23
+
24
+ The following examples of calling algorithms are organized by type of input/output which vary between algorithms.
25
+
26
+ Note: a single algorithm may have different input and output types, or accept multiple types of input,
27
+ so consult the algorithm's description for usage examples specific to that algorithm.
28
+
29
+ ### Text input/output
30
+
31
+ Call an algorithm with text input by simply passing a string into its `pipe` method.
32
+ If the algorithm output is text, then the result field of the response will be a string.
19
33
 
20
- Or install it yourself as:
21
- ```bash
22
- $ gem install algorithmia
34
+ ```ruby
35
+ algo = client.algo('demo/Hello/0.1.1')
36
+ puts algo.pipe('HAL 9000').result
37
+ # -> Hello HAL 900
23
38
  ```
24
39
 
25
- ## Basic Usage
40
+ ### JSON input/output
26
41
 
27
- To call to the API, the gem uses a client model. Create and configure a client object with your API key to start making requests.
42
+ Call an algorithm with JSON input by simply passing in a type that can be serialized to JSON, like an `Array` or `Hash`.
43
+ For algorithms that return JSON, the result field of the response will be the appropriate deserialized type.
28
44
 
29
45
  ```ruby
30
- require algorithmia
46
+ algo = client.algo('WebPredict/ListAnagrams/0.1.0')
47
+ result = algo.pipe(["transformer", "terraforms", "retransform"]).result
48
+ # -> ["transformer","retransform"]
49
+ ```
31
50
 
32
- # Create a new client instance & set your API key
33
- client = Algorithmia.client('YOUR_API_KEY')
51
+ Alternatively, if your input is already serialized to JSON, you may call `pipe_json`:
34
52
 
35
- algorithm = 'demo/Hello/0.1.1'
36
- algorithm_result = client.algo(algorithm).pipe("HAL 9000").result
37
- puts algorithm_result
38
- # => Hello HAL 9000
53
+ ```ruby
54
+ algo = client.algo('WebPredict/ListAnagrams/0.1.0')
55
+ result = algo.pipe_json('["transformer", "terraforms", "retransform"]').result
56
+ # -> ["transformer","retransform"]
39
57
  ```
40
58
 
41
- ### Algorithm Objects
59
+ ### Binary input/output
42
60
 
43
- When you call `.algo` on your client, it will return a new instance of `Algorithmia::Algorithm`. On this object, you have the the following methods:
44
- - `pipe`: the default method to calling an algorithm (recommended)
45
- - `pipeJson`
46
- - `set_options`: set query parameters on your request
61
+ Call an algorithm with Binary input by passing an `ASCII-8BIT`-encoded string into the `pipe` method.
62
+ Similarly, if the algorithm response is binary data, then the result field of the response will be an `ASCII-8BIT` string.
63
+ In practice, this involves working with methods like `IO.binread` and `IO.binwrite`.
47
64
 
48
65
  ```ruby
49
- algorithm = client.algo('demo/Hello/0.1.1')
50
- # => #<Algorithmia::Algorithm:0x007f80ea092fc8 @client=Algorithmia::Client, @endpoint="demo/Hello/0.1.1", @query_options={:timeout=>300, :stdout=>false, :output=>"default"}>
51
-
52
- # Pass in a hash of options to override the default query parameters
53
- algorithm.set_options({'timeout': 500})
54
- # => {:timeout=>500, :stdout=>false, :output=>"default"}
55
-
56
- # Use these helper methods to enable stdout or change the timeout value
57
- algorithm.set_timeout(500)
58
- # => 500
59
- algorithm.enable_stdout
60
- # => true
61
- algorithm
62
- # => #<Algorithmia::Algorithm:0x007fa008b02de0 @client=Algorithmia::Client, @endpoint="demo/hello", @query_options={:timeout=>500, :stdout=>true, :output=>"default"}>
63
-
64
- # Pass the input to the algorithm
65
- result = algorithm.pipe('HAL 9000')
66
- # => Hello HAL 9000
66
+ input = File.binread("/path/to/bender.png")
67
+ result = client.algo("opencv/SmartThumbnail/0.1").pipe(input).result
68
+ # -> [ASCII-8BIT string of binary data]
67
69
  ```
68
70
 
69
- ### Algorithm Responses
70
-
71
- When a successful response from the algorithm is returned, a new Algorithmia::Response object is created.
72
-
73
- ``` ruby
74
- # Call an algorithm
75
- algorithm_response = client.algo(algorithm).pipe("HAL 9000").result
76
- puts algorithm_response
77
- # => #<Algorithmia::Response:0x007f9fc2845850 @json={:result=>0.14970585904042558, :metadata=>{:content_type=>"json", :duration=>0.0006857780000000001}}>
78
-
79
- # Get the raw json returned from the API
80
- puts algorithm_response.json
81
- # => {:result=>0.14970585904042558, :metadata=>{:content_type=>"json", :duration=>0.0006857780000000001}}
82
-
83
- # Use any one of the following helper methods to understand the response
84
- puts algorithm_response.result
85
- # => 0.14970585904042558
86
- puts algorithm_response.metadata
87
- # => {:content_type=>"json", :duration=>0.0006857780000000001}
88
- puts algorithm_response.duration
89
- # => 0.0006857780000000001
90
- puts algorithm_response.content_type
91
- # => "json"
92
- puts algorithm_response.stdout
93
- # => nil
94
- puts algorithm_response.alerts
95
- # => nil
71
+ ### Error handling
72
+
73
+ API errors and Algorithm exceptions will be raised when calling `pipe`:
74
+
75
+ ```ruby
76
+ client.algo('util/whoopsWrongAlgo').pipe('Hello, world!')
77
+ # -> Algorithmia::Errors::NotFoundError: algorithm algo://util/whoopsWrongAlgo not found
96
78
  ```
97
79
 
98
- ### The Data API
80
+ And you can rescue Algorithm errors separate from other errors:
99
81
 
100
- The client also allows you to work with the Algorithmia Data API. You can manage your files and directories using DataObjects. There are two types of DataObjects: `DataFile` and `DataDirectory`.
82
+ ```ruby
83
+ begin
84
+ client.algo('demo/Hello').pipe('world!')
85
+ rescue Algorithmia::Errors::AlgorithmError => e
86
+ puts "Algorithm Error: #{e.message}"
87
+ puts e.stacktrace
88
+ rescue => e
89
+ puts "Error: #{e.message}"
90
+ end
101
91
 
102
- #### DataFiles
92
+ ```
93
+
94
+ ### Request options
95
+
96
+ The client exposes options that can configure algorithm requests.
97
+ This includes support for changing the timeout or indicating that the API should include stdout in the response.
103
98
 
104
99
  ```ruby
105
- file = client.file('data://test_user/test/sample_file.txt')
106
- => #<Algorithmia::DataFile:0x007ffbaa8747d8 @client=#<Algorithmia::Client:0x007ffbab0fc798 @api_key="YOUR_API_KEY">, @data_uri="data://test_user/test/sample_file.txt", @url="/data/test_user/test/sample_file.txt">
100
+ algo = client.algo('demo/Hello/0.1.1').set(timeout: 10, stdout: true)
101
+ response = algo.pipe('HAL 9000')
102
+ stdout = response.stdout
103
+ ```
107
104
 
108
- file.put_file('/path/to/local/file/sample_file.txt')
109
- # => true
105
+ Note: `stdout: true` is ignored if you do not have access to the algorithm source.
110
106
 
111
- file.exists?
112
- # => true
113
107
 
114
- # Write a string to the file. This will overwrite any existing content!
115
- file.put("This is the contents of the file.")
116
- # => true
108
+ ## Working with data
117
109
 
118
- # Get the file and write to a local file
119
- file.get_file
120
- # => #<File:/var/folders/yl/vv6ws5196cvb61xzwrg8l3vm0000gp/T/test.txt20160328-94761-i8cqxg>
110
+ The Algorithmia Java client also provides a way to manage both Algorithmia hosted data
111
+ and data from Dropbox or S3 accounts that you've connected to you Algorithmia account.
121
112
 
122
- file.get
123
- # => "This is the contents of the file."
113
+ This client provides a `DataFile` type (generally created by `client.file(uri)`)
114
+ and a `DataDir` type (generally created by `client.dir(uri)`) that provide methods for managing your data.
124
115
 
125
- file.delete
126
- # => true
116
+ ### Create directories
117
+
118
+ Create directories by instantiating a `DataDirectory` object and calling `create`:
119
+
120
+ ```ruby
121
+ client.dir("data://.my/robots").create
122
+ client.dir("dropbox://robots").create
127
123
  ```
128
124
 
129
- #### DataDirectories
125
+ ### Upload files to a directory
126
+
127
+ Upload files by calling `put` on a `DataFile` object, or by calling `putFile` on a `DataDirectory` object.
130
128
 
131
129
  ```ruby
132
- # Create a DataDirectory object
133
- dir = client.dir('data://test_user/test')
134
- # => #<Algorithmia::DataDirectory:0x007ffbab0fc748 @client=#<Algorithmia::Client:0x007ffbab0fc798 @api_key="YOUR_API_KEY">, @data_uri="data://test_user/test", @url="/data/test_user/test">
130
+ robots = client.dir("data://.my/robots")
131
+
132
+ # Upload local file
133
+ robots.put_file("/path/to/Optimus_Prime.png")
134
+ # Write a text file
135
+ robots.file("Optimus_Prime.txt").put("Leader of the Autobots")
136
+ # Write a binary file
137
+ robots.file("Optimus_Prime.key").put([71, 101, 101, 107].pack('C*'))
138
+ ```
139
+
140
+ ### Download contents of file
135
141
 
136
- # Create a new directory
137
- dir.create
138
- # => true
142
+ Download files by calling `get` or `get_file` on a `DataFile` object:
143
+
144
+ ```ruby
145
+ # Download file and get the file handle
146
+ t800File = client.file("data://.my/robots/T-800.png").get_file
139
147
 
140
- dir.exists?
141
- # => true
148
+ # Get file's contents as a string
149
+ t800Text = client.file("data://.my/robots/T-800.txt").get
142
150
 
143
- # Get a new DataDirectory object for the parent directory
144
- dir.parent
145
- # => #<Algorithmia::DataDirectory:0x007ffba924e148 @client=#<Algorithmia::Client:0x007ffbab0fc798 @api_key="YOUR_API_KEY">, @data_uri="data://test_user", @url="/data/test_user">
151
+ # Get file's contents as JSON
152
+ t800JsonString = client.file("data://.my/robots/T-800.txt").get
153
+ t800Json = JSON.parse(t800JsonString)
146
154
 
147
- # Delete the directory
148
- dir.delete
149
- # => true
155
+ # Get file's contents as a byte array
156
+ t800Bytes = client.file("data://.my/robots/T-800.png").get
150
157
  ```
151
158
 
152
- ##### Working with directories:
159
+ ### Delete files and directories
153
160
 
154
- You can iterate over all contents in a directory, only the sub-directories, or the files within the directory by using of the the `each` methods provided. If no block is given to the method, an enumerator will be returned:
161
+ Delete files and directories by calling delete on their respective `DataFile` or `DataDirectory` object.
162
+ DataDirectories take an optional `force` parameter that indicates whether the directory should be deleted
163
+ if it contains files or other directories.
155
164
 
156
165
  ```ruby
157
- # Return an enumerator for all directory contents, each sub-directory, or each file in the directory
158
- dir.each
159
- dir.each_directory
160
- dir.each_file
161
- # => #<Enumerator: #<Algorithmia::DataDirectory:0x007ffba89bbcd8 @client=#<Algorithmia::Client:0x007ffbab0fc798 @api_key="YOUR_API_KEY">, @data_uri="data://test_user/test_two", @url="/data/test_user/test_two">:each>
162
-
163
- # Iterate all directory contents, each sub-directory, or each file in the directory
164
- dir.each { |item| block }
165
- dir.each_directory { |dir| block }
166
- dir.each_file { |file| block }
166
+ client.file("data://.my/robots/C-3PO.txt").delete
167
+
168
+ client.dir("data://.my/robots").delete(false)
167
169
  ```
168
170
 
171
+ ### List directory contents
169
172
 
170
- ## Stuck? Need help?
173
+ Iterate over the contents of a directory using the iterated returned
174
+ by calling `each`, `each_directory`, or `each_file` on a `DataDirectory` object.
175
+ If no block is given to the method, an enumerator will be returned.
171
176
 
172
- Check out our guides, tutorials, and how-tos in the [Algorithmia Developer Center](http://developers.algorithmia.com) as well as finding more specifics in our [API documentation](http://docs.algorithmia.com).
177
+ ```ruby
178
+ # List top level directories
179
+ client.dir("data://.my").each_dir do |dir|
180
+ puts "Directory " + dir.data_uri
181
+ end
182
+
183
+ # List files in the 'robots' directory
184
+ client.dir("data://.my/robots").each_file do |file|
185
+ puts "File " + file.data_uri
186
+ end
187
+
188
+ # Iterate all directory contents
189
+ client.dir("dropbox://").each do |item|
190
+ puts file.data_uri
191
+ end
192
+ ```
173
193
 
174
194
  ## Development
175
195
 
@@ -181,6 +201,3 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
181
201
 
182
202
  Bug reports and pull requests are welcome on [GitHub](https://github.com/algorithmiaio/algorithmia-ruby). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
183
203
 
184
- ## Not Yet Implemented:
185
- - Tests! :scream:
186
-
@@ -24,8 +24,8 @@ module Algorithmia
24
24
  Algorithmia::UnauthenticatedClient.new.dir(data_uri)
25
25
  end
26
26
 
27
- def client(api_key=nil)
28
- Algorithmia::Client.new(api_key)
27
+ def client(api_key=nil, base_url=nil)
28
+ Algorithmia::Client.new(api_key, base_url)
29
29
  end
30
30
  end
31
31
  end
@@ -4,46 +4,27 @@ module Algorithmia
4
4
  def initialize(client, endpoint)
5
5
  @client = client
6
6
  @endpoint = '/v1/algo/' + endpoint
7
- @query = {
8
- timeout: 300,
9
- stdout: false,
10
- output: 'default'
11
- }
7
+ @query = {}
12
8
  end
13
9
 
14
- def set_options(options_hash)
10
+ def set(options_hash)
15
11
  @query.update(options_hash)
16
- end
17
-
18
- def set_timeout(timeout)
19
- @query[:timeout] = timeout.to_i
20
- end
21
-
22
- def enable_stdout
23
- @query[:stdout] = true
12
+ self
24
13
  end
25
14
 
26
15
  def pipe(input)
27
- content_type = case
28
- when input.kind_of?(String) && input.encoding == Encoding::ASCII_8BIT
29
- 'application/octet-stream'
30
- when input.kind_of?(String)
31
- 'text/plain'
32
- else
33
- 'application/json'
34
- end
35
-
36
- headers = {
37
- 'Content-Type' => content_type
38
- }
39
-
40
- response = Algorithmia::Requester.new(@client).post(@endpoint, input, query: @query, headers: headers)
16
+ client_timeout = (@query[:timeout] || 300) + 10
17
+ response = Algorithmia::Requester.new(@client).post(@endpoint, input, query: @query, headers: {}, timeout: client_timeout)
41
18
  Algorithmia::Response.new(response.parsed_response, @query[:output])
42
19
  end
43
20
 
44
21
  def pipe_json(input)
45
- response = Algorithmia::Requester.new(@client).post(@endpoint, input, query: @query, headers: {})
46
- Algorithmia::Response.new(response.parsed_response)
22
+ client_timeout = (@query[:timeout] || 300) + 10
23
+ headers = {
24
+ 'Content-Type' => 'application/json'
25
+ }
26
+ response = Algorithmia::Requester.new(@client).post(@endpoint, input, query: @query, headers: headers, timeout: client_timeout)
27
+ Algorithmia::Response.new(response.parsed_response, @query[:output])
47
28
  end
48
29
  end
49
30
  end
@@ -26,18 +26,7 @@ module Algorithmia
26
26
  end
27
27
 
28
28
  def put(data)
29
- content_type = case
30
- when data.kind_of?(String) && data.encoding == Encoding::ASCII_8BIT
31
- 'application/octet-stream'
32
- when data.kind_of?(String)
33
- 'text/plain'
34
- else
35
- 'application/json'
36
- end
37
-
38
- headers = {'Content-Type' => content_type }
39
- Algorithmia::Requester.new(@client).put(@url, data, headers: headers)
40
- true
29
+ Algorithmia::Requester.new(@client).put(@url, data, headers: {})
41
30
  end
42
31
 
43
32
  alias_method :put_json, :put
@@ -9,12 +9,20 @@ module Algorithmia
9
9
  end
10
10
  end
11
11
 
12
+ class AlgorithmError < Error;
13
+ attr_reader :stacktrace
14
+ def initialize(message, response, stacktrace)
15
+ super(message, response)
16
+ @stacktrace = stacktrace
17
+ end
18
+ end
19
+
12
20
  class ApiKeyEmptyError < Error; end
13
21
  class ApiKeyInvalidError < Error; end
14
22
  class InternalServerError < Error; end
15
23
  class JsonParseError < Error; end
16
24
  class NotFoundError < Error; end
17
25
  class UnauthorizedError < Error; end
18
- class UnknownError < Error; end
26
+ class ApiError < Error; end
19
27
  end
20
28
  end
@@ -8,7 +8,6 @@ module Algorithmia
8
8
  self.class.base_uri client.api_address
9
9
  @client = client
10
10
  @default_headers = {
11
- 'Content-Type' => 'application/json',
12
11
  'User-Agent' => 'Algorithmia Ruby Client'
13
12
  }
14
13
  unless @client.api_key.nil?
@@ -24,14 +23,20 @@ module Algorithmia
24
23
  response
25
24
  end
26
25
 
27
- def post(endpoint, body, query: {}, headers: {})
26
+ def post(endpoint, body, query: {}, headers: {}, timeout: 60)
28
27
  headers = merge_headers(headers)
29
28
 
30
- if headers['Content-Type'] == 'application/json'
31
- body = body.to_json
29
+ headers['Content-Type'] ||= case
30
+ when body.kind_of?(String) && body.encoding == Encoding::ASCII_8BIT
31
+ 'application/octet-stream'
32
+ when body.kind_of?(String)
33
+ 'text/plain'
34
+ else
35
+ body = body.to_json
36
+ 'application/json'
32
37
  end
33
38
 
34
- response = self.class.post(endpoint, body: body, query: query, headers: headers)
39
+ response = self.class.post(endpoint, body: body, query: query, headers: headers, timeout: timeout)
35
40
  check_for_errors(response)
36
41
  response
37
42
  end
@@ -39,8 +44,14 @@ module Algorithmia
39
44
  def put(endpoint, body, query: {}, headers: {})
40
45
  headers = merge_headers(headers)
41
46
 
42
- if headers['Content-Type'] == 'application/json'
43
- body = body.to_json
47
+ headers['Content-Type'] ||= case
48
+ when body.kind_of?(String) && body.encoding == Encoding::ASCII_8BIT
49
+ 'application/octet-stream'
50
+ when body.kind_of?(String)
51
+ 'text/plain'
52
+ else
53
+ body = body.to_json
54
+ 'application/json'
44
55
  end
45
56
 
46
57
  response = self.class.put(endpoint, body: body, query: query, headers: headers)
@@ -67,55 +78,27 @@ module Algorithmia
67
78
  def check_for_errors(response)
68
79
  if response.code >= 200 && response.code < 300
69
80
  if response.is_a?(Hash) and response['error']
70
- parse_error_message(response) if response['error']
81
+ error = response['error']
82
+ raise Errors::AlgorithmError.new(error["message"], response, error["stacktrace"])
71
83
  end
72
84
  return
73
85
  end
74
86
 
87
+ message = response.dig("error", "message") if response.is_a?(Hash)
75
88
 
76
89
  case response.code
77
90
  when 401
78
- if response.nil?
79
- raise Errors::UnauthorizedError.new("The request you are making requires authorization. Please check that you have permissions & that you've set your API key.", nil)
80
- end
81
- raise Errors::UnauthorizedError.new(response["error"]["message"], response)
82
- when 400
83
- if response.nil?
84
- raise Errors::NotFoundError.new("The request was invalid", nil)
85
- end
86
- parse_error_message(response)
91
+ message ||= "The request you are making requires authorization. Please check that you have permissions & that you've set your API key."
92
+ raise Errors::UnauthorizedError.new(message, response)
87
93
  when 404
88
- if response.nil?
89
- raise Errors::NotFoundError.new("The URI requested is invalid or the resource requested does not exist.", nil)
90
- end
91
- raise Errors::NotFoundError.new(response["error"]["message"], response)
92
- when 500
93
- if response.nil?
94
- raise Errors::InternalServerError.new("Whoops! Something is broken.", nil)
95
- end
96
- raise Errors::InternalServerError.new(response["error"]["message"], response)
97
- else
98
- if response.nil?
99
- raise Errors::UnknownError.new("An unknown error occurred", nil)
100
- end
101
- raise Errors::UnknownError.new("message: #{response["error"]["message"]} stacktrace: #{error["stacktrace"]}", response)
102
- end
103
- end
104
-
105
- def parse_error_message(response)
106
- error = response['error']
107
-
108
- case error["message"]
109
- when 'authorization required'
110
- raise Errors::ApiKeyInvalidError.new("The API key you sent is invalid! Please set `Algorithmia::Client.api_key` with the key provided with your account.", response)
111
- when 'Failed to parse input, input did not parse as valid json'
112
- raise Errors::JsonParseError.new("Unable to parse the input. Please make sure it matches the expected input of the algorithm and can be parsed into JSON.", response)
94
+ message ||= "The URI requested is invalid or the resource requested does not exist."
95
+ raise Errors::NotFoundError.new(message, response)
96
+ when 500..599
97
+ message ||= "Whoops! Something is broken."
98
+ raise Errors::InternalServerError.new(message, response)
113
99
  else
114
- if error["stacktrace"].nil?
115
- raise Errors::UnknownError.new(error["message"], response)
116
- else
117
- raise Errors::UnknownError.new("message: #{error["message"]} stacktrace: #{error["stacktrace"]}", response)
118
- end
100
+ message ||= "#{response.code} - an unknown error occurred"
101
+ raise Errors::ApiError.new(message, response)
119
102
  end
120
103
  end
121
104
 
@@ -1,3 +1,3 @@
1
1
  module Algorithmia
2
- VERSION = "0.9.4"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algorithmia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algorithmia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-06 00:00:00.000000000 Z
11
+ date: 2016-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  version: '0'
131
131
  requirements: []
132
132
  rubyforge_project:
133
- rubygems_version: 2.4.8
133
+ rubygems_version: 2.5.1
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: A Ruby client for making API calls to Algorithmia