jerakia-client 0.1.0 → 0.2.0
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/lib/jerakia/client.rb +4 -1
- data/lib/jerakia/client/cli/lookup.rb +19 -2
- data/lib/jerakia/client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b71a936385fef4bf6308dde9bca65091f03ea86c
|
4
|
+
data.tar.gz: a4560a41ac5ba91e514b2d624b54bdf9861809a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1adb502903d8e8384557ffe71f58e45e666461e49324ca8d53feb314c95789efaccf65bef008fcf4242673023fdc76ec6ded9390fbef0714875c10d251b38678
|
7
|
+
data.tar.gz: ac742e582b94a176584a5f45858353908c2cd00227e7ec315aea4692ed93d11df47dd22440358554ce7dc178c3cd7ef0404dfd1d32d297db72c7985685d28cef
|
data/lib/jerakia/client.rb
CHANGED
@@ -61,7 +61,10 @@ class Jerakia
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def put(url_path, params)
|
64
|
-
headers = {
|
64
|
+
headers = {
|
65
|
+
'X-Authentication' => token,
|
66
|
+
:content_type => :json
|
67
|
+
}
|
65
68
|
url = url_address + url_path
|
66
69
|
begin
|
67
70
|
response = RestClient.put(url, params.to_json, headers)
|
@@ -48,6 +48,11 @@ class Jerakia
|
|
48
48
|
type: :string,
|
49
49
|
default: 'first',
|
50
50
|
desc: 'Lookup type'
|
51
|
+
option :metadata,
|
52
|
+
aliases: :m,
|
53
|
+
type: :hash,
|
54
|
+
default: {},
|
55
|
+
desc: 'Metadata to send with the request'
|
51
56
|
option :scope,
|
52
57
|
aliases: :s,
|
53
58
|
type: :string,
|
@@ -55,6 +60,7 @@ class Jerakia
|
|
55
60
|
default: 'metadata'
|
56
61
|
option :scope_options,
|
57
62
|
type: :hash,
|
63
|
+
default: {},
|
58
64
|
desc: 'Key/value pairs to be passed to the scope handler'
|
59
65
|
option :merge_type,
|
60
66
|
aliases: :m,
|
@@ -89,11 +95,22 @@ class Jerakia
|
|
89
95
|
:policy => options[:policy].to_sym,
|
90
96
|
:lookup_type => options[:type].to_sym,
|
91
97
|
:merge => options[:merge_type].to_sym,
|
92
|
-
:metadata => options[:metadata] || {},
|
93
98
|
:scope => options[:scope].to_sym,
|
94
|
-
:scope_options => options[:scope_options],
|
95
99
|
:use_schema => options[:schema]
|
96
100
|
}
|
101
|
+
|
102
|
+
if options[:metadata]
|
103
|
+
options[:metadata].each do |k,v|
|
104
|
+
lookup_opts["metadata_#{k}".to_sym] = v
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
if options[:scope]
|
109
|
+
options[:scope_options].each do |k,v|
|
110
|
+
lookup_opts["scope_#{k}".to_sym] = v
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
97
114
|
response = client.lookup(key, lookup_opts)
|
98
115
|
answer = response['payload']
|
99
116
|
case options[:output]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jerakia-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig Dunn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -65,3 +65,4 @@ signing_key:
|
|
65
65
|
specification_version: 4
|
66
66
|
summary: CLI and ruby client libraries for Jerakia Server
|
67
67
|
test_files: []
|
68
|
+
has_rdoc:
|