refocus 0.1.1 → 0.1.2
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/Gemfile.lock +3 -1
- data/bin/refocus +6 -0
- data/lib/refocus/aspects.rb +4 -0
- data/lib/refocus/cli.rb +9 -0
- data/lib/refocus/cli/samples.rb +20 -0
- data/lib/refocus/http.rb +3 -3
- data/lib/refocus/samples.rb +20 -0
- data/lib/refocus/samples/collector.rb +1 -1
- data/lib/refocus/subjects.rb +4 -0
- data/lib/refocus/version.rb +1 -1
- data/refocus.gemspec +1 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74f03cae9bfb4771dbf702946e7a28721687a213
|
4
|
+
data.tar.gz: 1191ca2edb1b09db54f68f3766792ca52644ebb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb00a8ae1c20951017a799c78b4aa24aabfebbad4b794433573b3867ec5c89bdb97e34ff6eb51da60f325bca16b1c508c369adbdaa098107cbd14c29c2a1b795
|
7
|
+
data.tar.gz: 0fa6697556d2df01b23a2b44927ed2abff941038cef24e2de7a4e8da361c4fad63194c1d4afa4dd7428f3b563fc3197b923d0cc5e19887f71f805eb0a496fe9b
|
data/Gemfile.lock
CHANGED
data/bin/refocus
ADDED
data/lib/refocus/aspects.rb
CHANGED
data/lib/refocus/cli.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "refocus/cli"
|
2
|
+
require "json"
|
3
|
+
|
4
|
+
module Refocus
|
5
|
+
class GetSampleCommand < Clamp::Command
|
6
|
+
|
7
|
+
option ["-s", "--subject"], "SUBJECT", "subject to get a sample for", required: true
|
8
|
+
option ["-a", "--aspect"], "ASPECT", "aspect to get a sample for", required: true
|
9
|
+
|
10
|
+
def execute
|
11
|
+
puts JSON.pretty_generate(Refocus.client.samples.get(subject: subject, aspect: aspect))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Cli.class_eval do
|
16
|
+
subcommand "samples:get", "Print a sample", GetSampleCommand
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
data/lib/refocus/http.rb
CHANGED
@@ -9,8 +9,8 @@ module Refocus
|
|
9
9
|
@content_type = content_type
|
10
10
|
end
|
11
11
|
|
12
|
-
def post(path, body:)
|
13
|
-
connection(path).post(body: convert(body), headers: headers, expects:
|
12
|
+
def post(path, body:, expects: 201)
|
13
|
+
connection(path).post(body: convert(body), headers: headers, expects: expects)
|
14
14
|
end
|
15
15
|
|
16
16
|
def get(path)
|
@@ -18,7 +18,7 @@ module Refocus
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def patch(path, body:)
|
21
|
-
connection(path).
|
21
|
+
connection(path).patch(body: convert(body), headers: headers, expects: 200)
|
22
22
|
end
|
23
23
|
|
24
24
|
def put(path, body:)
|
data/lib/refocus/samples.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
require "refocus/http"
|
2
|
+
require "refocus/json_helper"
|
3
|
+
|
2
4
|
module Refocus
|
3
5
|
class Samples
|
6
|
+
include JsonHelper
|
7
|
+
|
4
8
|
attr_reader :http
|
5
9
|
|
6
10
|
def initialize(url:, token:)
|
@@ -10,6 +14,22 @@ module Refocus
|
|
10
14
|
def collector
|
11
15
|
Collector.new(http: http)
|
12
16
|
end
|
17
|
+
|
18
|
+
def submit(name:, aspect:, value:)
|
19
|
+
c = collector
|
20
|
+
c.add(name: name, aspect: aspect, value: value)
|
21
|
+
c.submit
|
22
|
+
end
|
23
|
+
|
24
|
+
def list(limit: nil)
|
25
|
+
params = ""
|
26
|
+
params = params + "?limit=#{limit}" if limit
|
27
|
+
json(http.get(params))
|
28
|
+
end
|
29
|
+
|
30
|
+
def get(subject:, aspect:)
|
31
|
+
json(http.get(URI.escape("#{subject}\|#{aspect}")))
|
32
|
+
end
|
13
33
|
end
|
14
34
|
end
|
15
35
|
|
data/lib/refocus/subjects.rb
CHANGED
data/lib/refocus/version.rb
CHANGED
data/refocus.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Shea
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: clamp
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: Ruby client for https://github.com/salesforce/refocus
|
84
98
|
email:
|
85
99
|
- michael.shea@heroku.com
|
@@ -96,9 +110,12 @@ files:
|
|
96
110
|
- README.md
|
97
111
|
- Rakefile
|
98
112
|
- bin/console
|
113
|
+
- bin/refocus
|
99
114
|
- bin/setup
|
100
115
|
- lib/refocus.rb
|
101
116
|
- lib/refocus/aspects.rb
|
117
|
+
- lib/refocus/cli.rb
|
118
|
+
- lib/refocus/cli/samples.rb
|
102
119
|
- lib/refocus/client.rb
|
103
120
|
- lib/refocus/http.rb
|
104
121
|
- lib/refocus/json_helper.rb
|