wallix_rest_client 0.4.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d3e4e95a562ab80ce426d989ced99aa0efadf095177b1946914cbbbe7ac0ed4b
4
+ data.tar.gz: '0690dfc248f66ba2d9b4fbe4614dd13014ce9bff986fec5858bc65b31e678945'
5
+ SHA512:
6
+ metadata.gz: ad7a02ad80141bee73a33240734a5d075cda37fac8744701674ab7b3168f1b2bd8b26c281221254795ee2e5b1e42b39139bd87696a0b3fd98e65192fc6adf98c
7
+ data.tar.gz: 92c021907083e8af6a92b86cf2492fb47baaf44260bfa9c989decfb9893d1845b3f0996d0ef361fc52ef297974a49b00102334c0c5a2348d65d6c2d49b391c7f
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .idea
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1 @@
1
+ inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,34 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2018-08-07 22:30:47 +0200 using RuboCop version 0.58.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ Metrics/AbcSize:
11
+ Max: 18
12
+
13
+ # Offense count: 1
14
+ # Configuration parameters: CountComments, ExcludedMethods.
15
+ # ExcludedMethods: refine
16
+ Metrics/BlockLength:
17
+ Max: 29
18
+
19
+ # Offense count: 1
20
+ # Configuration parameters: CountComments.
21
+ Metrics/MethodLength:
22
+ Max: 14
23
+
24
+ # Offense count: 1
25
+ # Cop supports --auto-correct.
26
+ Style/IfUnlessModifier:
27
+ Exclude:
28
+ - 'lib/deep_symbolize.rb'
29
+
30
+ # Offense count: 4
31
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
32
+ # URISchemes: http, https
33
+ Metrics/LineLength:
34
+ Max: 96
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.1
6
+ before_script:
7
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
8
+ - chmod +x ./cc-test-reporter
9
+ - ./cc-test-reporter before-build
10
+ scripts:
11
+ - bundle exec rspec spec
12
+ after_script:
13
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
@@ -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 maxime@cyberwatch.fr. 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,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in wallix_rest_client.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,51 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ wallix_rest_client (0.4.0)
5
+ json
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ansi (1.5.0)
11
+ diff-lcs (1.3)
12
+ docile (1.3.1)
13
+ hirb (0.7.3)
14
+ json (2.1.0)
15
+ rake (12.3.1)
16
+ rspec (3.7.0)
17
+ rspec-core (~> 3.7.0)
18
+ rspec-expectations (~> 3.7.0)
19
+ rspec-mocks (~> 3.7.0)
20
+ rspec-core (3.7.1)
21
+ rspec-support (~> 3.7.0)
22
+ rspec-expectations (3.7.0)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.7.0)
25
+ rspec-mocks (3.7.0)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.7.0)
28
+ rspec-support (3.7.1)
29
+ simplecov (0.16.1)
30
+ docile (~> 1.1)
31
+ json (>= 1.8, < 3)
32
+ simplecov-html (~> 0.10.0)
33
+ simplecov-console (0.4.2)
34
+ ansi
35
+ hirb
36
+ simplecov
37
+ simplecov-html (0.10.2)
38
+
39
+ PLATFORMS
40
+ ruby
41
+
42
+ DEPENDENCIES
43
+ bundler
44
+ rake
45
+ rspec
46
+ simplecov
47
+ simplecov-console
48
+ wallix_rest_client!
49
+
50
+ BUNDLED WITH
51
+ 1.16.1
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # WallixRestClient
2
+
3
+ This gem provides a wrapper for the Wallix Admin Bastion REST API.
4
+
5
+ [![Build Status](https://travis-ci.org/Cyberwatch/wallix_rest_client.svg?branch=master)](https://travis-ci.org/Cyberwatch/wallix_rest_client)
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/d277733be82a63c9731e/maintainability)](https://codeclimate.com/github/Cyberwatch/wallix_rest_client/maintainability)
7
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/d277733be82a63c9731e/test_coverage)](https://codeclimate.com/github/Cyberwatch/wallix_rest_client/test_coverage)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'wallix_rest_client'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install wallix_rest_client
24
+
25
+ ## Usage
26
+
27
+ Todo.
28
+
29
+ ## Development
30
+
31
+ 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.
32
+
33
+ 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).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/cyberwatch/wallix_rest_client. 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.
38
+
39
+ ## Code of Conduct
40
+
41
+ Everyone interacting in the WallixRestClient project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/cyberwatch/wallix_rest_client/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'wallix_rest_client'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,101 @@
1
+ require 'wallix_rest_client/version'
2
+ require 'net/http'
3
+ require 'net/https'
4
+ require 'uri'
5
+ require 'json'
6
+
7
+ # Gem to use the Wallix Admin Bastion REST API
8
+ module WallixRestClient
9
+ class << self
10
+ attr_accessor :configuration
11
+ end
12
+
13
+ def self.setup
14
+ @configuration ||= Configuration.new
15
+ yield(configuration)
16
+ end
17
+
18
+ # Handle the Wallix REST API Settings
19
+ class Configuration
20
+ attr_accessor :base_uri, :user, :secret, :options
21
+
22
+ def initialize
23
+ @base_uri = ''
24
+ @user = ''
25
+ @secret = ''
26
+ @options = {
27
+ auth: :basic,
28
+ verify_ssl: true
29
+ }
30
+ end
31
+ end
32
+
33
+ # Wallix API methods
34
+ def self.get_approvals_requests_target(target = nil, query_params = {})
35
+ get 'approvals/requests/target/', target, query_params
36
+ end
37
+
38
+ def self.get_targetpasswords_checkout(target = nil, query_params = {})
39
+ get 'targetpasswords/checkout/', target, query_params
40
+ end
41
+
42
+ # Common methods
43
+ class << self
44
+ # Build http object with ssl or not
45
+ def build_http(uri)
46
+ http = Net::HTTP.new(uri.host, uri.port)
47
+ http.use_ssl = (uri.scheme == 'https')
48
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE unless configuration.options[:verify_ssl]
49
+
50
+ http
51
+ end
52
+
53
+ # Build request object with appropriate headers
54
+ def build_request(type, uri)
55
+ request = type.new(uri.request_uri)
56
+
57
+ case configuration.options[:auth]
58
+ when :basic
59
+ request.basic_auth(configuration.user, configuration.secret)
60
+ when :apikey
61
+ request['X-Auth-User'] = configuration.user
62
+ request['X-Auth-Key'] = configuration.secret
63
+ end
64
+
65
+ request
66
+ end
67
+
68
+ # Build query parameters
69
+ def build_query_params(query_params)
70
+ if query_params.empty?
71
+ ''
72
+ else
73
+ '?' + URI.encode_www_form(query_params)
74
+ end
75
+ end
76
+
77
+ # Run the HTTP request
78
+ def run_request(path, resource, type, query_params = {}, post_params = {})
79
+ uri = URI.parse([configuration.base_uri, '/api/', path, resource.to_s,
80
+ build_query_params(query_params)].join(''))
81
+
82
+ http = build_http(uri)
83
+ request = build_request(type, uri)
84
+
85
+ # Add post data if applicable
86
+ request.set_form_data(post_params) unless post_params.empty?
87
+
88
+ http.request(request)
89
+ end
90
+
91
+ # Get requests handler
92
+ def get(path, resource, query_params = {})
93
+ run_request(path, resource, Net::HTTP::Get, query_params)
94
+ end
95
+
96
+ # Post requests handler
97
+ def post(path, resource, query_params = {}, post_params = {})
98
+ run_request(path, resource, Net::HTTP::Post, query_params, post_params)
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,3 @@
1
+ module WallixRestClient
2
+ VERSION = '0.4.0'.freeze
3
+ end
@@ -0,0 +1,30 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'wallix_rest_client/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'wallix_rest_client'
7
+ spec.version = WallixRestClient::VERSION
8
+ spec.licenses = ['MIT']
9
+ spec.authors = ['Maxime Alay-Eddine']
10
+ spec.email = ['maxime@cyberwatch.fr']
11
+
12
+ spec.summary = 'Provides a wrapper for the Wallix REST API.'
13
+ spec.description = 'Provides a wrapper for the Wallix Web Admin Bastion REST API.'
14
+ spec.homepage = 'https://github.com/cyberwatch/wallix_rest_client'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_dependency 'json'
24
+
25
+ spec.add_development_dependency 'bundler'
26
+ spec.add_development_dependency 'rake'
27
+ spec.add_development_dependency 'rspec'
28
+ spec.add_development_dependency 'simplecov'
29
+ spec.add_development_dependency 'simplecov-console'
30
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wallix_rest_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ platform: ruby
6
+ authors:
7
+ - Maxime Alay-Eddine
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-08-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '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'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
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: rspec
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: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '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'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov-console
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
+ description: Provides a wrapper for the Wallix Web Admin Bastion REST API.
98
+ email:
99
+ - maxime@cyberwatch.fr
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".rubocop.yml"
107
+ - ".rubocop_todo.yml"
108
+ - ".travis.yml"
109
+ - CODE_OF_CONDUCT.md
110
+ - Gemfile
111
+ - Gemfile.lock
112
+ - README.md
113
+ - Rakefile
114
+ - bin/console
115
+ - bin/setup
116
+ - lib/wallix_rest_client.rb
117
+ - lib/wallix_rest_client/version.rb
118
+ - wallix_rest_client.gemspec
119
+ homepage: https://github.com/cyberwatch/wallix_rest_client
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 2.7.6
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: Provides a wrapper for the Wallix REST API.
143
+ test_files: []