kcv 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/kcv.rb +6 -0
- data/lib/kcv/agent_resolver.rb +7 -2
- data/lib/kcv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1feba71dc13ee12069704a065973a680cb780736587350b3cf1febd00a5d5166
|
4
|
+
data.tar.gz: cb9441807426b4178629b15ccb7f1082a60663b1ec41c12ad45d420adea5bb6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ea335ccfc9d80d3fd263fe54e71c1416ed7406b9101a5c75e4e2a4937c2d66267afc367aa12a27d7f9dbb0afb30c12e88588914367d38e613121d008b9812f0
|
7
|
+
data.tar.gz: 770702c550919b8abff2b68812e2190a67bfbf6e1f47f4806af71b1c35a2d7ea53dd9fc4db6c89f6fd3643e55edd64b791bd8f390db2dc89305911ed695a8eaa
|
data/.gitignore
CHANGED
data/lib/kcv.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "keycard"
|
4
|
+
require "checkpoint"
|
5
|
+
require "vizier"
|
6
|
+
|
3
7
|
require "kcv/version"
|
4
8
|
|
5
9
|
# KCV is an integration package for Keycard, Checkpoint, and Vizier.
|
@@ -7,3 +11,5 @@ require "kcv/version"
|
|
7
11
|
# This is the top-level module for all of the classes defined in this gem.
|
8
12
|
module KCV
|
9
13
|
end
|
14
|
+
|
15
|
+
require 'kcv/agent_resolver'
|
data/lib/kcv/agent_resolver.rb
CHANGED
@@ -4,6 +4,11 @@ require 'checkpoint/agent'
|
|
4
4
|
require 'ostruct'
|
5
5
|
|
6
6
|
module KCV
|
7
|
+
# Base AgentResolver to integrate Keycard and Checkpoint.
|
8
|
+
#
|
9
|
+
# This resolver depends on the actor having the `#identity` method, from
|
10
|
+
# which all attributes are extracted and delivered as agents, as converted
|
11
|
+
# by the `agent_factory`.
|
7
12
|
class AgentResolver < Checkpoint::Agent::Resolver
|
8
13
|
def initialize(agent_factory: Checkpoint::Agent)
|
9
14
|
@agent_factory = agent_factory
|
@@ -14,13 +19,13 @@ module KCV
|
|
14
19
|
end
|
15
20
|
|
16
21
|
def agents_for(attribute, values)
|
17
|
-
[
|
22
|
+
[values].flatten.map do |value|
|
18
23
|
agent_factory.from(OpenStruct.new(agent_type: attribute, agent_id: value))
|
19
24
|
end
|
20
25
|
end
|
21
26
|
|
22
27
|
private
|
23
28
|
|
24
|
-
|
29
|
+
attr_reader :agent_factory
|
25
30
|
end
|
26
31
|
end
|
data/lib/kcv/version.rb
CHANGED