nanook 2.2.0 → 3.0.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.
data/lib/nanook/error.rb DELETED
@@ -1,5 +0,0 @@
1
- class Nanook
2
- # Standard error for Nanook
3
- class Error < StandardError
4
- end
5
- end
data/lib/nanook/key.rb DELETED
@@ -1,46 +0,0 @@
1
- class Nanook
2
- class Key
3
-
4
- def initialize(rpc, key=nil)
5
- @rpc = rpc
6
- @key = key
7
- end
8
-
9
- def generate(seed: nil, index: nil)
10
- if seed.nil? && index.nil?
11
- rpc(:key_create)
12
- elsif !seed.nil? && !index.nil?
13
- rpc(:deterministic_key, seed: seed, index: index)
14
- else
15
- raise ArgumentError.new("This method must be called with either seed AND index params given or no params")
16
- end
17
- end
18
-
19
- def id
20
- @key
21
- end
22
-
23
- def info
24
- key_required!
25
- rpc(:key_expand)
26
- end
27
-
28
- def inspect
29
- "#{self.class.name}(id: \"#{id}\", object_id: \"#{"0x00%x" % (object_id << 1)}\")"
30
- end
31
-
32
- private
33
-
34
- def rpc(action, params={})
35
- p = @key.nil? ? {} : { key: @key }
36
- @rpc.call(action, p.merge(params))
37
- end
38
-
39
- def key_required!
40
- if @key.nil?
41
- raise ArgumentError.new("Key must be present")
42
- end
43
- end
44
-
45
- end
46
- end