refocus 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/refocus/aspects.rb +5 -2
- data/lib/refocus/http.rb +8 -0
- data/lib/refocus/path_helper.rb +12 -0
- data/lib/refocus/subjects.rb +5 -2
- data/lib/refocus/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: ffbe55500e7ba82291cf038d936dd0e535558733
|
4
|
+
data.tar.gz: 5c6036bbf3f0129c8f8efc8a5a7158a2647d38ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82b3b152fc392f96d270595bd2770c89d0a8c00b3d7fe1dcf0e839e5571560f73311dde0474953794d856fc2fe9b209ebda36b219aa5b66ed7c59568b8cee7bd
|
7
|
+
data.tar.gz: d4adfbed9581257df45ba067ecdf8801b9e5c9bf2de906766ea80718986217a3fcfd08fe04248dd89c3ac2eaf38af6c4582708993cc7f60ec7c713314dda43a5
|
data/.gitignore
CHANGED
data/lib/refocus/aspects.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
require "refocus/http"
|
2
2
|
require "refocus/json_helper"
|
3
|
+
require "refocus/path_helper"
|
3
4
|
|
4
5
|
module Refocus
|
5
6
|
class Aspects
|
6
7
|
include JsonHelper
|
8
|
+
include PathHelper
|
7
9
|
|
8
10
|
attr_reader :http
|
9
11
|
|
@@ -15,9 +17,10 @@ module Refocus
|
|
15
17
|
json(http.get(""))
|
16
18
|
end
|
17
19
|
|
18
|
-
def create(
|
20
|
+
def create(name:, options: {} )
|
21
|
+
parent, child = parent_and_name(name)
|
19
22
|
path = parent ? "#{parent}/child" : ""
|
20
|
-
body = default_options.merge("name" =>
|
23
|
+
body = default_options.merge("name" => child).merge(options)
|
21
24
|
json(http.post(path, body: body))
|
22
25
|
end
|
23
26
|
|
data/lib/refocus/http.rb
CHANGED
@@ -17,6 +17,14 @@ module Refocus
|
|
17
17
|
connection(path).get(headers: headers, expects: 200)
|
18
18
|
end
|
19
19
|
|
20
|
+
def patch(path, body:)
|
21
|
+
connection(path).put(body: convert(body), headers: headers, expects: 201)
|
22
|
+
end
|
23
|
+
|
24
|
+
def put(path, body:)
|
25
|
+
connection(path).put(body: convert(body), headers: headers, expects: 201)
|
26
|
+
end
|
27
|
+
|
20
28
|
def delete(path)
|
21
29
|
connection(path).delete(headers: headers, expects: 200)
|
22
30
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Refocus
|
2
|
+
module PathHelper
|
3
|
+
# Given a dot-separated string, returns the parent and name.
|
4
|
+
# Returns nil for parent if there are no dots.
|
5
|
+
def parent_and_name(name)
|
6
|
+
array = name.split(".")
|
7
|
+
parent = array.length == 1 ? nil : array[0..-2].join(".")
|
8
|
+
name = array[-1]
|
9
|
+
[parent, name]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/refocus/subjects.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
require "refocus/http"
|
2
2
|
require "refocus/json_helper"
|
3
|
+
require "refocus/path_helper"
|
3
4
|
|
4
5
|
module Refocus
|
5
6
|
class Subjects
|
6
7
|
include JsonHelper
|
8
|
+
include PathHelper
|
7
9
|
|
8
10
|
attr_reader :http
|
9
11
|
|
@@ -15,9 +17,10 @@ module Refocus
|
|
15
17
|
json(http.get(""))
|
16
18
|
end
|
17
19
|
|
18
|
-
def create(
|
20
|
+
def create(name:, options: {})
|
21
|
+
parent, child = parent_and_name(name)
|
19
22
|
path = parent ? "#{parent}/child" : ""
|
20
|
-
body = options.merge({"name" =>
|
23
|
+
body = options.merge({"name" => child})
|
21
24
|
json(http.post(path, body: body))
|
22
25
|
end
|
23
26
|
|
data/lib/refocus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refocus
|
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
|
- Michael Shea
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/refocus/client.rb
|
103
103
|
- lib/refocus/http.rb
|
104
104
|
- lib/refocus/json_helper.rb
|
105
|
+
- lib/refocus/path_helper.rb
|
105
106
|
- lib/refocus/perspectives.rb
|
106
107
|
- lib/refocus/samples.rb
|
107
108
|
- lib/refocus/samples/collector.rb
|