jerakia-client 0.1.0 → 0.2.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: 899404e16dd30ec067c873af83e69b51f7643f37
4
- data.tar.gz: fe2ac9e0f68a145578d9eaabfef449b50b16e2f9
3
+ metadata.gz: b71a936385fef4bf6308dde9bca65091f03ea86c
4
+ data.tar.gz: a4560a41ac5ba91e514b2d624b54bdf9861809a0
5
5
  SHA512:
6
- metadata.gz: a2f6761ce0df466ed40958289e0b44130e1cb44f497d2348d08bf64bef9a2a39a3e7ee8c651f58d1685d25ad9b026a1cad5152dfa53f0f214b3a3f99a6870795
7
- data.tar.gz: 7c5cd46e0ce57593c02c6fbae1cab23c0b61d49fc8493be78f90e1ac679693356e36c16d77e7e0d9a629124c60c7a57c74be677078155a83b5fde79b24562d9b
6
+ metadata.gz: 1adb502903d8e8384557ffe71f58e45e666461e49324ca8d53feb314c95789efaccf65bef008fcf4242673023fdc76ec6ded9390fbef0714875c10d251b38678
7
+ data.tar.gz: ac742e582b94a176584a5f45858353908c2cd00227e7ec315aea4692ed93d11df47dd22440358554ce7dc178c3cd7ef0404dfd1d32d297db72c7985685d28cef
@@ -61,7 +61,10 @@ class Jerakia
61
61
  end
62
62
 
63
63
  def put(url_path, params)
64
- headers = { 'X-Authentication' => token }
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]
@@ -1,6 +1,6 @@
1
1
  class Jerakia
2
2
  class Client
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
6
6
 
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.1.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-13 00:00:00.000000000 Z
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: