aptible-gridiron 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/README.md +3 -8
- data/lib/aptible/gridiron.rb +0 -3
- data/lib/aptible/gridiron/criterion.rb +20 -0
- data/lib/aptible/gridiron/evidence.rb +1 -0
- data/lib/aptible/gridiron/resource.rb +13 -10
- data/lib/aptible/gridiron/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f127554a7074b9d3669b9579f7e76430cc28fc3f
|
4
|
+
data.tar.gz: 2c5581ada148a2f8d2c25c76fcbb3ae5f1eafcac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 809629814ec53416b4e33a3b8e62519751111c9027449e81ccd08d627e4d66ef379b542dbc3855d3d41d6ad53aada82db95d6cd81dc9261f9493ac11265ea277
|
7
|
+
data.tar.gz: 39a634672142fcd716411176b46a3d55e07cd39d361191550fb41187150bd80369f34276ed465a2c8b2b826d53bcb166bf4378505cc97edd3f776cae73be434b
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#  Aptible::Gridiron
|
2
2
|
|
3
|
-
[](https://rubygems.org/gems/gridiron)
|
3
|
+
[](https://rubygems.org/gems/aptible-gridiron)
|
4
4
|
[](https://travis-ci.org/aptible/gridiron-ruby)
|
5
5
|
[](https://gemnasium.com/aptible/gridiron-ruby)
|
6
6
|
|
@@ -38,15 +38,11 @@ criterion.name
|
|
38
38
|
# => "Policy Manual"
|
39
39
|
```
|
40
40
|
|
41
|
-
To work with organization-specific evidence (i.e., documents and events), you may
|
41
|
+
To work with organization-specific evidence (i.e., documents and events), you may pass `:organization` as a parameter in any initializer. For example:
|
42
42
|
|
43
43
|
```ruby
|
44
44
|
organization = Aptible::Auth::Organization.all(token: token).first
|
45
|
-
Aptible::Gridiron.
|
46
|
-
config.organization = organization
|
47
|
-
end
|
48
|
-
|
49
|
-
gridiron = Aptible::Gridiron::Agent.new(token: token)
|
45
|
+
gridiron = Aptible::Gridiron::Agent.new(token: token, organization: organization)
|
50
46
|
criterion = gridiron.protocols.first.procedures.first.criteria.first
|
51
47
|
criterion.documents.count
|
52
48
|
# => 1
|
@@ -64,7 +60,6 @@ document.expires_at
|
|
64
60
|
| Parameter | Description | Default |
|
65
61
|
| --------- | ----------- | --------------- |
|
66
62
|
| `root_url` | Root URL of the Gridiron server | `ENV['GRIDIRON_ROOT_URL']` or [https://gridiron.aptible.com](https://gridiron.aptible.com) |
|
67
|
-
| `organization` | `Aptible::Auth::Organization` instance to be used for all documents/events | `nil` |
|
68
63
|
|
69
64
|
To point the client at a different server (e.g., during development), add the following to your application's initializers (or set the `GRIDIRON_ROOT_URL` environment variable):
|
70
65
|
|
data/lib/aptible/gridiron.rb
CHANGED
@@ -11,6 +11,26 @@ module Aptible
|
|
11
11
|
field :evidence_type
|
12
12
|
field :scope
|
13
13
|
field :default_expiry
|
14
|
+
|
15
|
+
def documents
|
16
|
+
evidence_type == 'document' ? super : []
|
17
|
+
end
|
18
|
+
|
19
|
+
def events
|
20
|
+
evidence_type == 'event' ? super : []
|
21
|
+
end
|
22
|
+
|
23
|
+
def status
|
24
|
+
green? ? 'green' : 'red'
|
25
|
+
end
|
26
|
+
|
27
|
+
# TODO: Move to Gridiron, or fix logic
|
28
|
+
def green?
|
29
|
+
return true if evidence_type == 'event'
|
30
|
+
|
31
|
+
return false unless documents.first
|
32
|
+
documents.first.expires_at > Time.now
|
33
|
+
end
|
14
34
|
end
|
15
35
|
end
|
16
36
|
end
|
@@ -3,21 +3,24 @@ require 'aptible/resource'
|
|
3
3
|
module Aptible
|
4
4
|
module Gridiron
|
5
5
|
class Resource < Aptible::Resource::Base
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
params.merge!(organization: organization.href)
|
10
|
-
end
|
6
|
+
def outgoing_uri_filter(params)
|
7
|
+
params.merge!(organization: organization) if organization
|
8
|
+
end
|
11
9
|
|
12
|
-
|
10
|
+
def organization
|
11
|
+
# TODO: Is there another way to persist organization across children
|
12
|
+
headers['X-Aptible-Organization']
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
if (
|
17
|
-
|
15
|
+
def initialize(options = {})
|
16
|
+
if options.is_a?(Hash) && options[:organization]
|
17
|
+
options[:headers] ||= {}
|
18
|
+
options[:headers].merge!(
|
19
|
+
'X-Aptible-Organization' => options[:organization].href
|
20
|
+
)
|
18
21
|
end
|
19
22
|
|
20
|
-
|
23
|
+
super(options)
|
21
24
|
end
|
22
25
|
|
23
26
|
def namespace
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptible-gridiron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aptible-resource
|