aptible-comply 0.1.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 +7 -0
- data/.github/CODEOWNERS +1 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +2 -0
- data/Gemfile +4 -0
- data/LICENSE.md +22 -0
- data/Procfile +1 -0
- data/README.md +49 -0
- data/Rakefile +4 -0
- data/comply-ruby.gemspec +33 -0
- data/lib/aptible/comply.rb +18 -0
- data/lib/aptible/comply/.DS_Store +0 -0
- data/lib/aptible/comply/agent.rb +6 -0
- data/lib/aptible/comply/asset.rb +16 -0
- data/lib/aptible/comply/asset_review.rb +13 -0
- data/lib/aptible/comply/grant.rb +10 -0
- data/lib/aptible/comply/group.rb +11 -0
- data/lib/aptible/comply/integration.rb +10 -0
- data/lib/aptible/comply/membership.rb +8 -0
- data/lib/aptible/comply/person.rb +11 -0
- data/lib/aptible/comply/program.rb +24 -0
- data/lib/aptible/comply/resource.rb +25 -0
- data/lib/aptible/comply/vendor.rb +17 -0
- data/lib/aptible/comply/version.rb +5 -0
- data/spec/aptible/comply/agent_spec.rb +5 -0
- data/spec/aptible/comply/resource_spec.rb +6 -0
- data/spec/aptible/comply_spec.rb +19 -0
- data/spec/shared/with_env.rb +10 -0
- data/spec/spec_helper.rb +16 -0
- metadata +203 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 73797d7e74a221dbb6b6ea159a026bddb3faad4fd857a09dd6fe39a575029609
|
4
|
+
data.tar.gz: c40df7143b96673aee11ab478c4b209cecbc37310f567bc2f594e8858ee854e6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 518b73e24ca28ca6ed1ba5564484a691406e88714fa6e208d6aec140ce06334726442fae49365c5a28d4f4266abdd7861ed87293b1f8099086b77c3de3ff5d2b
|
7
|
+
data.tar.gz: bbb40ef281fbf9b3a09deb16b12731de09428d87fe514630f0ef653e01e5752d8d2b95619890d9174fbfd5c5a613668c78602182c19df127f514e4f2a518b63b
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @dawenster
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Aptible, Inc.
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Procfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
console: bundle exec pry -r aptible/comply -r aptible/auth
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Aptible::Comply
|
2
|
+
|
3
|
+
Ruby client for [comply.aptible.com](https://comply.aptible.com/). The Comply server is built on top of [HAL+JSON](http://tools.ietf.org/html/draft-kelly-json-hal-06), and so this client is just a thin layer on top of the [HyperResource](https://github.com/gamache/hyperresource) gem.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add the following lines to your application's Gemfile.
|
8
|
+
|
9
|
+
gem 'aptible-comply'
|
10
|
+
|
11
|
+
And then run `bundle install`.
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
First, get a token:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
token = Aptible::Auth::Token.create(email: 'user0@example.com', password: 'password')
|
19
|
+
```
|
20
|
+
|
21
|
+
From here, you can interact with the Comply server.
|
22
|
+
|
23
|
+
## Configuration
|
24
|
+
|
25
|
+
| Parameter | Description | Default |
|
26
|
+
| --------- | ----------- | --------------- |
|
27
|
+
| `root_url` | Root URL of the Comply server | `ENV['APTIBLE_COMPLY_ROOT_URL']` or [https://comply-api.aptible.com](https://comply-api.aptible.com) |
|
28
|
+
|
29
|
+
To point the client at a different server (e.g., during development), add the following to your application's initializers (or set the `APTIBLE_COMPLY_ROOT_URL` environment variable):
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
Aptible::Comply.configure do |config|
|
33
|
+
config.root_url = 'http://some.other.url'
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork the project.
|
40
|
+
1. Commit your changes, with specs.
|
41
|
+
1. Ensure that your code passes specs (`rake spec`) and meets Aptible's Ruby style guide (`rake rubocop`).
|
42
|
+
1. Create a new pull request on GitHub.
|
43
|
+
|
44
|
+
## Copyright and License
|
45
|
+
|
46
|
+
MIT License, see [LICENSE](LICENSE.md) for details.
|
47
|
+
|
48
|
+
Copyright (c) 2019 [Aptible](https://www.aptible.com) and contributors.
|
49
|
+
|
data/Rakefile
ADDED
data/comply-ruby.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
require 'English'
|
7
|
+
require 'aptible/comply/version'
|
8
|
+
|
9
|
+
Gem::Specification.new do |spec|
|
10
|
+
spec.name = 'aptible-comply'
|
11
|
+
spec.version = Aptible::Comply::VERSION
|
12
|
+
spec.authors = ['Frank Macreery']
|
13
|
+
spec.email = ['frank@macreery.com']
|
14
|
+
spec.description = 'Ruby client for compliance-os-dashboard.aptible.com'
|
15
|
+
spec.summary = 'Ruby client for compliance-os-dashboard.aptible.com'
|
16
|
+
spec.homepage = 'https://github.com/aptible/comply-ruby'
|
17
|
+
spec.license = 'MIT'
|
18
|
+
|
19
|
+
spec.files = `git ls-files`.split($RS)
|
20
|
+
spec.test_files = spec.files.grep(%r{^spec\/})
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_dependency 'aptible-auth', '>= 0.11.10'
|
24
|
+
spec.add_dependency 'aptible-resource', '>= 0.3.7'
|
25
|
+
spec.add_dependency 'gem_config'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'activesupport'
|
28
|
+
spec.add_development_dependency 'aptible-tasks', '>= 0.4.0'
|
29
|
+
spec.add_development_dependency 'pry'
|
30
|
+
spec.add_development_dependency 'rake'
|
31
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
32
|
+
spec.add_development_dependency 'rspec-its'
|
33
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'aptible/auth'
|
2
|
+
require 'gem_config'
|
3
|
+
|
4
|
+
module Aptible
|
5
|
+
module Comply
|
6
|
+
include GemConfig::Base
|
7
|
+
|
8
|
+
with_configuration do
|
9
|
+
has :root_url,
|
10
|
+
classes: [String],
|
11
|
+
default: ENV['APTIBLE_COMPLY_ROOT_URL'] ||
|
12
|
+
'https://comply-api-prototype.aptible.com'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'aptible/comply/resource'
|
18
|
+
require 'aptible/comply/agent'
|
Binary file
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Aptible
|
2
|
+
module Comply
|
3
|
+
class Asset < Resource
|
4
|
+
belongs_to :program
|
5
|
+
belongs_to :vendor
|
6
|
+
has_many :asset_reviews
|
7
|
+
has_many :grants
|
8
|
+
|
9
|
+
field :id
|
10
|
+
field :asset_type
|
11
|
+
field :name
|
12
|
+
field :owner
|
13
|
+
field :current_check_result
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Aptible
|
2
|
+
module Comply
|
3
|
+
class Program < Resource
|
4
|
+
has_many :assets
|
5
|
+
has_many :vendors
|
6
|
+
has_many :people
|
7
|
+
has_many :groups
|
8
|
+
has_many :integrations
|
9
|
+
|
10
|
+
field :id
|
11
|
+
|
12
|
+
def organization_url
|
13
|
+
links['organization'].href
|
14
|
+
end
|
15
|
+
|
16
|
+
def organization
|
17
|
+
return @organization if @organization
|
18
|
+
|
19
|
+
auth = Aptible::Auth::Organization.new(token: token, headers: headers)
|
20
|
+
@organization = auth.find_by_url(organization_url)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'aptible/resource'
|
2
|
+
|
3
|
+
module Aptible
|
4
|
+
module Comply
|
5
|
+
class Resource < Aptible::Resource::Base
|
6
|
+
def namespace
|
7
|
+
'Aptible::Comply'
|
8
|
+
end
|
9
|
+
|
10
|
+
def root_url
|
11
|
+
Aptible::Comply.configuration.root_url
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'aptible/comply/program'
|
18
|
+
require 'aptible/comply/asset'
|
19
|
+
require 'aptible/comply/vendor'
|
20
|
+
require 'aptible/comply/person'
|
21
|
+
require 'aptible/comply/group'
|
22
|
+
require 'aptible/comply/grant'
|
23
|
+
require 'aptible/comply/membership'
|
24
|
+
require 'aptible/comply/asset_review'
|
25
|
+
require 'aptible/comply/integration'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Aptible
|
2
|
+
module Comply
|
3
|
+
class Vendor < Resource
|
4
|
+
belongs_to :program
|
5
|
+
belongs_to :vendor
|
6
|
+
|
7
|
+
field :name
|
8
|
+
field :description
|
9
|
+
field :aptible_products
|
10
|
+
field :claimed
|
11
|
+
field :logo_url
|
12
|
+
field :website_url
|
13
|
+
field :banner_meta
|
14
|
+
field :badges
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Aptible::Comply do
|
4
|
+
subject { Aptible::Comply::Protocol.new }
|
5
|
+
|
6
|
+
it 'should have a configurable root_url' do
|
7
|
+
config = described_class.configuration
|
8
|
+
expect(config).to be_a GemConfig::Configuration
|
9
|
+
expect(config.root_url).to eq 'https://comply-api.aptible.com'
|
10
|
+
end
|
11
|
+
|
12
|
+
skip 'uses ENV["APTIBLE_COMPLY_ROOT_URL"] if defined' do
|
13
|
+
config = described_class.configuration
|
14
|
+
with_env 'APTIBLE_COMPLY_ROOT_URL', 'http://foobar.com' do
|
15
|
+
config.reset
|
16
|
+
expect(config.root_url).to eq 'http://foobar.com'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
require 'rspec/its'
|
5
|
+
|
6
|
+
# Load shared spec files
|
7
|
+
Dir["#{File.dirname(__FILE__)}/shared/**/*.rb"].each do |file|
|
8
|
+
require file
|
9
|
+
end
|
10
|
+
|
11
|
+
# Require library up front
|
12
|
+
require 'aptible/comply'
|
13
|
+
|
14
|
+
RSpec.configure do |config|
|
15
|
+
config.before { Aptible::Comply.configuration.reset }
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aptible-comply
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Frank Macreery
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-12-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aptible-auth
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.11.10
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.11.10
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: aptible-resource
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.3.7
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.3.7
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gem_config
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: aptible-tasks
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.4.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.4.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec-its
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Ruby client for compliance-os-dashboard.aptible.com
|
140
|
+
email:
|
141
|
+
- frank@macreery.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".github/CODEOWNERS"
|
147
|
+
- ".gitignore"
|
148
|
+
- ".rspec"
|
149
|
+
- ".travis.yml"
|
150
|
+
- Gemfile
|
151
|
+
- LICENSE.md
|
152
|
+
- Procfile
|
153
|
+
- README.md
|
154
|
+
- Rakefile
|
155
|
+
- comply-ruby.gemspec
|
156
|
+
- lib/aptible/comply.rb
|
157
|
+
- lib/aptible/comply/.DS_Store
|
158
|
+
- lib/aptible/comply/agent.rb
|
159
|
+
- lib/aptible/comply/asset.rb
|
160
|
+
- lib/aptible/comply/asset_review.rb
|
161
|
+
- lib/aptible/comply/grant.rb
|
162
|
+
- lib/aptible/comply/group.rb
|
163
|
+
- lib/aptible/comply/integration.rb
|
164
|
+
- lib/aptible/comply/membership.rb
|
165
|
+
- lib/aptible/comply/person.rb
|
166
|
+
- lib/aptible/comply/program.rb
|
167
|
+
- lib/aptible/comply/resource.rb
|
168
|
+
- lib/aptible/comply/vendor.rb
|
169
|
+
- lib/aptible/comply/version.rb
|
170
|
+
- spec/aptible/comply/agent_spec.rb
|
171
|
+
- spec/aptible/comply/resource_spec.rb
|
172
|
+
- spec/aptible/comply_spec.rb
|
173
|
+
- spec/shared/with_env.rb
|
174
|
+
- spec/spec_helper.rb
|
175
|
+
homepage: https://github.com/aptible/comply-ruby
|
176
|
+
licenses:
|
177
|
+
- MIT
|
178
|
+
metadata: {}
|
179
|
+
post_install_message:
|
180
|
+
rdoc_options: []
|
181
|
+
require_paths:
|
182
|
+
- lib
|
183
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
requirements: []
|
194
|
+
rubygems_version: 3.0.3
|
195
|
+
signing_key:
|
196
|
+
specification_version: 4
|
197
|
+
summary: Ruby client for compliance-os-dashboard.aptible.com
|
198
|
+
test_files:
|
199
|
+
- spec/aptible/comply/agent_spec.rb
|
200
|
+
- spec/aptible/comply/resource_spec.rb
|
201
|
+
- spec/aptible/comply_spec.rb
|
202
|
+
- spec/shared/with_env.rb
|
203
|
+
- spec/spec_helper.rb
|