jump_cloud 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +78 -0
- data/.rspec +3 -0
- data/.travis.yml +14 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +18 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/app/models/jump_cloud/association.rb +4 -0
- data/app/models/jump_cloud/group.rb +5 -0
- data/app/models/jump_cloud/system.rb +8 -0
- data/app/models/jump_cloud/system/association.rb +8 -0
- data/app/models/jump_cloud/system/group.rb +11 -0
- data/app/models/jump_cloud/user.rb +7 -0
- data/app/models/jump_cloud/user/association.rb +8 -0
- data/app/models/jump_cloud/user/group.rb +11 -0
- data/app/models/jump_cloud/v1/model.rb +8 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/jump_cloud.gemspec +41 -0
- data/lib/jump_cloud.rb +47 -0
- data/lib/jump_cloud/api.rb +42 -0
- data/lib/jump_cloud/config.rb +0 -0
- data/lib/jump_cloud/middleware.rb +67 -0
- data/lib/jump_cloud/version.rb +3 -0
- data/spec/jump_cloud/models/system/group_spec.rb +35 -0
- data/spec/jump_cloud_spec.rb +5 -0
- data/spec/spec_helper.rb +21 -0
- metadata +165 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8b783994df364c108dd44045998ef53282caa818d82bedcb4468591e1720afc2
|
4
|
+
data.tar.gz: 27877e520b0fba233c73384f2082a95a32f536debf754743d5d74ea8419ba080
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2ec0e3749fce7d36b0e90ecd8441ebe1099125ec6e70fda3d52bb381d5c6a35ffc67227be2ec5d4bc0343448dad02013c473aa6c4921478e6bd0a903d33d08cb
|
7
|
+
data.tar.gz: da60e0f05251573afecad67034aeb509f5fdc17619f3c34802dc1a24dcc54fee873f84a93da14ea3ae3b72356eb4461ea0b063108010ac4eacb8ba01607a1521
|
data/.gitignore
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
6
|
+
|
7
|
+
# Database config and secrets
|
8
|
+
/config/database.yml
|
9
|
+
/config/secrets.yml
|
10
|
+
|
11
|
+
# Ignore bundler config
|
12
|
+
/.bundle
|
13
|
+
|
14
|
+
# Ignore client credentials
|
15
|
+
/config/client_api_credentials.yml
|
16
|
+
|
17
|
+
# Ignore the default SQLite database.
|
18
|
+
/db/*.sqlite3
|
19
|
+
|
20
|
+
# Ignore all logfiles and tempfiles.
|
21
|
+
/log/*.log
|
22
|
+
/tmp
|
23
|
+
/db/structure.sql
|
24
|
+
/doc/app/*
|
25
|
+
/vendor/cldr/*
|
26
|
+
/public/uploads/*
|
27
|
+
/public/photo/*
|
28
|
+
/public/test/*
|
29
|
+
/test/assets/*
|
30
|
+
/spec/assets/*
|
31
|
+
/public/assets/**
|
32
|
+
.powenv
|
33
|
+
.rvmrc
|
34
|
+
.env
|
35
|
+
.ruby-version
|
36
|
+
|
37
|
+
# Compiled source #
|
38
|
+
###################
|
39
|
+
/pkg/
|
40
|
+
*.com
|
41
|
+
*.class
|
42
|
+
*.dll
|
43
|
+
*.exe
|
44
|
+
*.o
|
45
|
+
*.so
|
46
|
+
|
47
|
+
# Packages #
|
48
|
+
############
|
49
|
+
# it's better to unpack these files and commit the raw source
|
50
|
+
# git has its own built in compression methods
|
51
|
+
*.7z
|
52
|
+
*.dmg
|
53
|
+
*.gz
|
54
|
+
*.iso
|
55
|
+
*.jar
|
56
|
+
*.rar
|
57
|
+
*.tar
|
58
|
+
*.zip
|
59
|
+
|
60
|
+
# Logs and databases #
|
61
|
+
######################
|
62
|
+
*.log
|
63
|
+
*.sql
|
64
|
+
*.sqlite
|
65
|
+
|
66
|
+
# OS generated files #
|
67
|
+
######################
|
68
|
+
.DS_Store
|
69
|
+
.DS_Store?
|
70
|
+
._*
|
71
|
+
.Spotlight-V100
|
72
|
+
.Trashes
|
73
|
+
Icon?
|
74
|
+
ehthumbs.db
|
75
|
+
Thumbs.db
|
76
|
+
/Gemfile.lock
|
77
|
+
/coverage
|
78
|
+
/.editorconfig
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at dale@getnotion.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :test do
|
6
|
+
|
7
|
+
# Generates coverage stats of specs
|
8
|
+
gem 'simplecov'
|
9
|
+
|
10
|
+
# Publishes coverage to codeclimate
|
11
|
+
gem 'codeclimate-test-reporter'
|
12
|
+
|
13
|
+
# Gives CircleCI more perspective on our tests
|
14
|
+
gem 'rspec_junit_formatter'
|
15
|
+
|
16
|
+
gem 'rspec'
|
17
|
+
|
18
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Dale Stevens
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# JumpCloud
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/jump_cloud`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'jump_cloud'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install jump_cloud
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jump_cloud. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the JumpCloud project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/jump_cloud/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'dotenv'
|
4
|
+
Dotenv.load
|
5
|
+
|
6
|
+
require "bundler/setup"
|
7
|
+
require "jump_cloud"
|
8
|
+
|
9
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
10
|
+
# with your gem easier. You can also use a different console, if you like.
|
11
|
+
|
12
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
13
|
+
require 'pry'
|
14
|
+
Pry.start
|
data/bin/setup
ADDED
data/jump_cloud.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jump_cloud/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jump_cloud"
|
8
|
+
spec.version = JumpCloud::VERSION
|
9
|
+
spec.authors = ["Dale Stevens"]
|
10
|
+
spec.email = ["dale@twilightcoders.net"]
|
11
|
+
|
12
|
+
spec.summary = %q{JumpCloud API}
|
13
|
+
spec.description = %q{JumpCloud API}
|
14
|
+
spec.homepage = "https://github.com/twilightcoders/jump_cloud"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
21
|
+
else
|
22
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0")
|
26
|
+
spec.bindir = 'bin'
|
27
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
28
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
29
|
+
spec.require_paths = ['lib', 'spec', 'app', 'app/models']
|
30
|
+
|
31
|
+
spec.required_ruby_version = '>= 2.2'
|
32
|
+
|
33
|
+
spec.add_runtime_dependency 'her', '~> 0.10.0'
|
34
|
+
|
35
|
+
spec.add_development_dependency 'pry-byebug', '~> 3'
|
36
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
37
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
38
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
39
|
+
spec.add_development_dependency 'dotenv', '~> 2.2'
|
40
|
+
|
41
|
+
end
|
data/lib/jump_cloud.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'jump_cloud/version'
|
2
|
+
|
3
|
+
# STL
|
4
|
+
require 'active_support'
|
5
|
+
require 'active_support/core_ext'
|
6
|
+
require 'active_support/dependencies'
|
7
|
+
require 'logger'
|
8
|
+
|
9
|
+
require 'her'
|
10
|
+
|
11
|
+
# App
|
12
|
+
require 'jump_cloud/middleware'
|
13
|
+
require 'jump_cloud/api'
|
14
|
+
|
15
|
+
|
16
|
+
module JumpCloud
|
17
|
+
extend ActiveSupport::Autoload
|
18
|
+
|
19
|
+
autoload :JumpCloud
|
20
|
+
|
21
|
+
class << self
|
22
|
+
attr_writer :logger
|
23
|
+
|
24
|
+
def logger
|
25
|
+
@logger ||= Logger.new($stdout).tap do |log|
|
26
|
+
log.progname = self.name
|
27
|
+
log.level = JumpCloud.config.log_level
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def safeload(paths)
|
34
|
+
paths.delete_if do |path|
|
35
|
+
begin
|
36
|
+
require(path)
|
37
|
+
true
|
38
|
+
rescue NameError => e
|
39
|
+
false
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
f = safeload Dir[__dir__ + '/../app/models/**/*.rb']
|
45
|
+
safeload f
|
46
|
+
|
47
|
+
JC = JumpCloud
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'pry'
|
2
|
+
module JumpCloud
|
3
|
+
module V1
|
4
|
+
API = Her::API.new
|
5
|
+
API.setup url: "https://console.jumpcloud.com/api" do |c|
|
6
|
+
|
7
|
+
# Auth
|
8
|
+
c.use JumpCloud::Middleware::Authentication
|
9
|
+
|
10
|
+
# Request
|
11
|
+
# c.use Faraday::Request::UrlEncoded
|
12
|
+
|
13
|
+
# Response
|
14
|
+
# c.use Her::Middleware::DefaultParseJSON
|
15
|
+
c.use JumpCloud::Middleware::ResponseParser
|
16
|
+
|
17
|
+
# Adapter
|
18
|
+
c.use Faraday::Adapter::NetHttp
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
module V2
|
23
|
+
API = Her::API.new
|
24
|
+
API.setup url: "https://console.jumpcloud.com/api/v2" do |c|
|
25
|
+
|
26
|
+
# Auth
|
27
|
+
c.use JumpCloud::Middleware::Authentication
|
28
|
+
|
29
|
+
# Request
|
30
|
+
# c.use Her::Middleware::AcceptJSON
|
31
|
+
# c.use Faraday::Request::UrlEncoded
|
32
|
+
c.use JumpCloud::Middleware::JSONRequest
|
33
|
+
|
34
|
+
# Response
|
35
|
+
c.use JumpCloud::Middleware::ResponseParser
|
36
|
+
# c.use Parser
|
37
|
+
|
38
|
+
# Adapter
|
39
|
+
c.use Faraday::Adapter::NetHttp
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
File without changes
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'pry'
|
2
|
+
module JumpCloud
|
3
|
+
module Middleware
|
4
|
+
|
5
|
+
class Authentication < Faraday::Middleware
|
6
|
+
def call(env)
|
7
|
+
env[:request_headers]["x-api-key"] = ENV['JUMPCLOUD_KEY']
|
8
|
+
# env[:request_headers]["x-api-key"] = RequestStore.store[:my_api_token]
|
9
|
+
@app.call(env)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class ResponseParser < Her::Middleware::DefaultParseJSON
|
14
|
+
def parse(body)
|
15
|
+
json = parse_json(body)
|
16
|
+
metadata = {
|
17
|
+
errors: (json.delete(:message) || "").scan(/Error: (.*)/).flatten,
|
18
|
+
data: clean_attributes(json.delete(:results) || json),
|
19
|
+
metadata: json.delete(:metadata) || {}
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def on_complete(env)
|
24
|
+
result = super
|
25
|
+
result
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def clean_attributes(data)
|
31
|
+
case data
|
32
|
+
when Hash
|
33
|
+
data.except(:attributes)
|
34
|
+
when Array
|
35
|
+
data.collect { |d| clean_attributes(d) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
# This middleware adds a "Content-Type: application/json" HTTP header
|
42
|
+
class JSONRequest < Faraday::Middleware
|
43
|
+
# @private
|
44
|
+
def add_header(headers)
|
45
|
+
headers.merge! "Content-Type" => "application/json"
|
46
|
+
end
|
47
|
+
|
48
|
+
# @private
|
49
|
+
def call(env)
|
50
|
+
puts "#{env.method}: #{env.url.to_s}"
|
51
|
+
add_header(env[:request_headers])
|
52
|
+
unless env.method == :get
|
53
|
+
env[:body] = encode env[:body] unless env[:body].respond_to?(:to_str)
|
54
|
+
end
|
55
|
+
puts "params: #{env.params}"
|
56
|
+
puts "body: #{env.body}"
|
57
|
+
@app.call(env)
|
58
|
+
end
|
59
|
+
|
60
|
+
def encode(data)
|
61
|
+
::JSON.dump data
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
RSpec.describe JC::System::Group do
|
2
|
+
|
3
|
+
it "Create a new System Group" do
|
4
|
+
g = JumpCloud::System::Group.create(name: 'foo-to-delete')
|
5
|
+
g = JumpCloud::System::Group.find(g.id)
|
6
|
+
expect(g.name).to eq('foo-to-delete')
|
7
|
+
g.destroy
|
8
|
+
end
|
9
|
+
|
10
|
+
it "Update a System Group" do
|
11
|
+
g = JumpCloud::System::Group.create(name: 'foo-to-update')
|
12
|
+
g.name = 'foo-to-delete'
|
13
|
+
g.save
|
14
|
+
g = JumpCloud::System::Group.find(g.id)
|
15
|
+
expect(g.name).to eq('foo-to-delete')
|
16
|
+
g.destroy
|
17
|
+
end
|
18
|
+
|
19
|
+
it "Delete a System Group" do
|
20
|
+
g = JumpCloud::System::Group.create(name: 'foo-to-delete')
|
21
|
+
g.destroy
|
22
|
+
end
|
23
|
+
|
24
|
+
it "List all System Groups" do
|
25
|
+
system_groups = JumpCloud::System::Group.all.fetch
|
26
|
+
expect(system_groups.count).to eq(4)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "View an individual System Group details" do
|
30
|
+
g = JumpCloud::System::Group.find('5a989c8145886d7d22e12a82')
|
31
|
+
expect(g.name).to eq('foo-1-keep')
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
|
3
|
+
require 'pry'
|
4
|
+
|
5
|
+
require 'dotenv'
|
6
|
+
Dotenv.load
|
7
|
+
|
8
|
+
require 'jump_cloud'
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
# Enable flags like --only-failures and --next-failure
|
12
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
13
|
+
|
14
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
15
|
+
config.disable_monkey_patching!
|
16
|
+
|
17
|
+
config.expect_with :rspec do |c|
|
18
|
+
c.syntax = :expect
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jump_cloud
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dale Stevens
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: her
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.10.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.10.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry-byebug
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '12.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '12.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: dotenv
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.2'
|
97
|
+
description: JumpCloud API
|
98
|
+
email:
|
99
|
+
- dale@twilightcoders.net
|
100
|
+
executables:
|
101
|
+
- console
|
102
|
+
- setup
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".gitignore"
|
107
|
+
- ".rspec"
|
108
|
+
- ".travis.yml"
|
109
|
+
- CODE_OF_CONDUCT.md
|
110
|
+
- Gemfile
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.md
|
113
|
+
- Rakefile
|
114
|
+
- app/models/jump_cloud/association.rb
|
115
|
+
- app/models/jump_cloud/group.rb
|
116
|
+
- app/models/jump_cloud/system.rb
|
117
|
+
- app/models/jump_cloud/system/association.rb
|
118
|
+
- app/models/jump_cloud/system/group.rb
|
119
|
+
- app/models/jump_cloud/user.rb
|
120
|
+
- app/models/jump_cloud/user/association.rb
|
121
|
+
- app/models/jump_cloud/user/group.rb
|
122
|
+
- app/models/jump_cloud/v1/model.rb
|
123
|
+
- bin/console
|
124
|
+
- bin/setup
|
125
|
+
- jump_cloud.gemspec
|
126
|
+
- lib/jump_cloud.rb
|
127
|
+
- lib/jump_cloud/api.rb
|
128
|
+
- lib/jump_cloud/config.rb
|
129
|
+
- lib/jump_cloud/middleware.rb
|
130
|
+
- lib/jump_cloud/version.rb
|
131
|
+
- spec/jump_cloud/models/system/group_spec.rb
|
132
|
+
- spec/jump_cloud_spec.rb
|
133
|
+
- spec/spec_helper.rb
|
134
|
+
homepage: https://github.com/twilightcoders/jump_cloud
|
135
|
+
licenses:
|
136
|
+
- MIT
|
137
|
+
metadata:
|
138
|
+
allowed_push_host: https://rubygems.org
|
139
|
+
post_install_message:
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
- spec
|
144
|
+
- app
|
145
|
+
- app/models
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '2.2'
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 2.7.6
|
159
|
+
signing_key:
|
160
|
+
specification_version: 4
|
161
|
+
summary: JumpCloud API
|
162
|
+
test_files:
|
163
|
+
- spec/jump_cloud/models/system/group_spec.rb
|
164
|
+
- spec/jump_cloud_spec.rb
|
165
|
+
- spec/spec_helper.rb
|