memoir 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/memoir.rb +1 -0
- data/lib/memoir/client.rb +5 -1
- data/lib/memoir/data_set.rb +1 -5
- data/lib/memoir/error.rb +10 -0
- data/lib/memoir/request.rb +2 -1
- data/lib/memoir/response.rb +9 -2
- data/lib/memoir/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 796a35d84795be6d68fd0fb93f6334d9e3580b99
|
4
|
+
data.tar.gz: 480ad5612349c69a5ccb6f62636d6f7f2084a900
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1a701e9c6d77d733f4a0ee30076ecfce59e10fad41111edc86c588fe88b3045624c42d7e7aed52ac98a0549d3eaeeb0855a844b9c19359f41869e53ad494fc5
|
7
|
+
data.tar.gz: b738cead5216b952f2fb883a6999a7bac6c2c34eb9a314ddde5410ab61ddaeab8e553bd4a870a17c584fd3e773d7897ad9696bc959f22e5db0404c4595460bfc
|
data/lib/memoir.rb
CHANGED
@@ -16,6 +16,7 @@ module Memoir
|
|
16
16
|
require File.join(File.dirname(__FILE__), 'memoir', 'query')
|
17
17
|
require File.join(File.dirname(__FILE__), 'memoir', 'request')
|
18
18
|
require File.join(File.dirname(__FILE__), 'memoir', 'data_set')
|
19
|
+
require File.join(File.dirname(__FILE__), 'memoir', 'error')
|
19
20
|
require File.join(File.dirname(__FILE__), 'memoir', 'response')
|
20
21
|
require File.join(File.dirname(__FILE__), 'memoir', 'client')
|
21
22
|
end
|
data/lib/memoir/client.rb
CHANGED
@@ -21,7 +21,11 @@ class Memoir::Client
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def run(request)
|
24
|
-
|
24
|
+
response = connection.post API_QUERY_URL, request.to_h do |req|
|
25
|
+
req.params['arrays'] = true if request.arrays
|
26
|
+
end
|
27
|
+
|
28
|
+
Memoir::Response.new response
|
25
29
|
end
|
26
30
|
|
27
31
|
def dry_run(request)
|
data/lib/memoir/data_set.rb
CHANGED
@@ -10,10 +10,6 @@ class Memoir::DataSet
|
|
10
10
|
@global_annotations = data_set['globalAnnotations'] || []
|
11
11
|
@tsuids = data_set['tsuids'] || []
|
12
12
|
@query = query || {}
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
def dps=(dps_object)
|
17
|
-
@dps = dps_object.instance_of?(Array) ? dps_object.to_h : dps_object
|
13
|
+
@dps = data_set['dps']
|
18
14
|
end
|
19
15
|
end
|
data/lib/memoir/error.rb
ADDED
data/lib/memoir/request.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Memoir::Request
|
2
|
-
attr_accessor :start_time, :end_time, :queries, :options
|
2
|
+
attr_accessor :start_time, :end_time, :queries, :options, :arrays
|
3
3
|
|
4
4
|
VALID_OPTIONS = {
|
5
5
|
no_annotations: 'noAnnotations',
|
@@ -18,6 +18,7 @@ class Memoir::Request
|
|
18
18
|
@end_time = end_time
|
19
19
|
@queries = []
|
20
20
|
@options = options
|
21
|
+
@arrays = false
|
21
22
|
end
|
22
23
|
|
23
24
|
def <<(query)
|
data/lib/memoir/response.rb
CHANGED
@@ -1,11 +1,18 @@
|
|
1
1
|
class Memoir::Response
|
2
|
-
attr_accessor :data_sets, :stats_summary, :status, :raw
|
2
|
+
attr_accessor :data_sets, :stats_summary, :status, :raw, :error
|
3
|
+
|
4
|
+
STATUS_OK = 200
|
3
5
|
|
4
6
|
def initialize(faraday_response)
|
5
7
|
@data_sets = []
|
6
8
|
@status = faraday_response.status
|
7
9
|
@raw = faraday_response.body
|
8
|
-
|
10
|
+
|
11
|
+
if status == STATUS_OK
|
12
|
+
parse_response(raw)
|
13
|
+
else
|
14
|
+
@error = Memoir::Error.new(raw['error'])
|
15
|
+
end
|
9
16
|
end
|
10
17
|
|
11
18
|
private
|
data/lib/memoir/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memoir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Kimle
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- lib/memoir/client.rb
|
156
156
|
- lib/memoir/data_set.rb
|
157
157
|
- lib/memoir/downsample.rb
|
158
|
+
- lib/memoir/error.rb
|
158
159
|
- lib/memoir/errors.rb
|
159
160
|
- lib/memoir/errors/argument_error.rb
|
160
161
|
- lib/memoir/errors/request_error.rb
|