bpm_manager 0.0.1 → 0.0.2
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 +14 -5
- data/Rakefile +1 -1
- data/lib/bpm_manager/version.rb +1 -1
- data/lib/bpm_manager.rb +32 -38
- data/spec/server_spec.rb +42 -39
- 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: c7de81106384f1a90cef720c57234ec35da28121
|
4
|
+
data.tar.gz: 96a2e43f832576c16cdc3a4fc18511c7695dd953
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bfa354a58c4f7819bee7d2063d843ae59600e344ca9f9bf45dfd46fe320b050ebe9ea67283a61396615192b3549ea1f7de62385057a451558d9a17263828bd0
|
7
|
+
data.tar.gz: 02a1732d87845bf44e73fb6ed7d501753007df99de3cc49f49e9a37bd8b4b83849adf72e04e26298723b01eda1a86f1844809ad62685d87b45ae14cf759bb7f7
|
data/README.md
CHANGED
@@ -25,14 +25,23 @@ Also do not forget to execute the initializer with:
|
|
25
25
|
|
26
26
|
## Usage
|
27
27
|
|
28
|
-
1. First configure properly the gem using the bpm_manager.rb file in 'config/initializers/bpm_manager.rb'
|
29
|
-
2. Assign the Server with:
|
28
|
+
1. First configure properly the gem using the bpm_manager.rb file in 'config/initializers/bpm_manager.rb' or calling
|
30
29
|
|
31
|
-
|
30
|
+
```ruby
|
31
|
+
BpmManager.configure({
|
32
|
+
:bpm_vendor => 'RedHat' # or 'Oracle'
|
33
|
+
:bpm_url => 'bpm.company.com' # without http:// or https://
|
34
|
+
:bpm_username => 'scott'
|
35
|
+
:bpm_passowrd => 'tiger'
|
36
|
+
:bpm_use_ssl => false # use true for https
|
37
|
+
})
|
38
|
+
```
|
32
39
|
|
33
|
-
|
40
|
+
2. Then make an API call like this:
|
34
41
|
|
35
|
-
|
42
|
+
```ruby
|
43
|
+
result = BpmManager.deployments()
|
44
|
+
```
|
36
45
|
|
37
46
|
## Contributing
|
38
47
|
|
data/Rakefile
CHANGED
data/lib/bpm_manager/version.rb
CHANGED
data/lib/bpm_manager.rb
CHANGED
@@ -3,45 +3,39 @@ require "rest-client"
|
|
3
3
|
require "json"
|
4
4
|
|
5
5
|
module BpmManager
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# Returns the URI for the server plus a suffix
|
33
|
-
def uri(suffix)
|
34
|
-
case @config[:bpm_vendor]
|
35
|
-
when 'RedHat'
|
36
|
-
URI.encode('http' + (@config[:bpm_use_ssl] ? 's' : '') + '://' + @config[:bpm_username] + ':' + @config[:bpm_password] + '@' + @config[:bpm_url] + '/business-central/rest' + (suffix.nil? ? '' : suffix))
|
37
|
-
else
|
38
|
-
''
|
39
|
-
end
|
6
|
+
@config = {
|
7
|
+
:bpm_vendor => "",
|
8
|
+
:bpm_url => "",
|
9
|
+
:bpm_username => "",
|
10
|
+
:bpm_password => "",
|
11
|
+
:bpm_use_ssl => false }
|
12
|
+
|
13
|
+
@valid_config_keys = @config
|
14
|
+
|
15
|
+
# Configure through hash
|
16
|
+
def self.configure(opts = {})
|
17
|
+
opts.each{ |k,v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym }
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns the configuration hash
|
21
|
+
def self.config
|
22
|
+
@config
|
23
|
+
end
|
24
|
+
|
25
|
+
# Returns the URI for the server plus a suffix
|
26
|
+
def self.uri(suffix = '')
|
27
|
+
case @config[:bpm_vendor]
|
28
|
+
when 'RedHat'
|
29
|
+
URI.encode('http' + (@config[:bpm_use_ssl] ? 's' : '') + '://' + @config[:bpm_username] + ':' + @config[:bpm_password] + '@' + @config[:bpm_url] + '/business-central/rest' + (suffix.nil? ? '' : suffix))
|
30
|
+
else
|
31
|
+
''
|
40
32
|
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Gets all server deployments
|
36
|
+
def self.deployments()
|
37
|
+
raise LoadError 'BpmManager Gem Configuration file has errors' if @config.values.any?{|v| v.nil?}
|
41
38
|
|
42
|
-
|
43
|
-
def deployments()
|
44
|
-
return JSON.parse(RestClient.get(uri('/deployment'), :accept => :json))
|
45
|
-
end
|
39
|
+
return JSON.parse(RestClient.get(BpmManager.uri('/deployment'), :accept => :json))
|
46
40
|
end
|
47
41
|
end
|
data/spec/server_spec.rb
CHANGED
@@ -1,50 +1,53 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "
|
4
|
-
before :
|
5
|
-
|
6
|
-
@uri = @server.uri('/test')
|
3
|
+
describe "BpmManager" do
|
4
|
+
before :all do
|
5
|
+
BpmManager.configure({ :bpm_vendor => 'RedHat', :bpm_url => 'bpm.beatcoding.com', :bpm_username => 'Administrator', :bpm_password => 'bc-power' })
|
7
6
|
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
expect
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "#config" do
|
19
|
-
before :each do
|
20
|
-
@server = BpmManager::Server.new
|
21
|
-
@config = @server.config()
|
22
|
-
end
|
8
|
+
describe "#uri" do
|
9
|
+
before :each do
|
10
|
+
@uri = BpmManager.uri('/test')
|
11
|
+
end
|
12
|
+
|
13
|
+
it "expect to be a String" do
|
14
|
+
expect(@uri).to be_an_instance_of String
|
15
|
+
end
|
23
16
|
|
24
|
-
|
25
|
-
|
17
|
+
it "expect to not be nil" do
|
18
|
+
expect(@uri).not_to eq(nil)
|
19
|
+
end
|
26
20
|
end
|
27
21
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
22
|
+
describe "#config" do
|
23
|
+
before :each do
|
24
|
+
@config = BpmManager.config
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should be a Hash" do
|
28
|
+
expect(@config).to be_an_instance_of Hash
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should not be empty' do
|
32
|
+
expect(@config.length).to be > 0
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'must have all the keys' do
|
36
|
+
expect(@config.has_key? :bpm_vendor).to be true
|
37
|
+
expect(@config.has_key? :bpm_url).to be true
|
38
|
+
expect(@config.has_key? :bpm_username).to be true
|
39
|
+
expect(@config.has_key? :bpm_password).to be true
|
40
|
+
expect(@config.has_key? :bpm_use_ssl).to be true
|
41
|
+
end
|
45
42
|
end
|
46
43
|
|
47
|
-
|
48
|
-
|
44
|
+
describe "#deployments" do
|
45
|
+
before :each do
|
46
|
+
@deployments = BpmManager.deployments()
|
47
|
+
end
|
48
|
+
|
49
|
+
it "must return something" do
|
50
|
+
expect(@deployments.length).to be > 0
|
51
|
+
end
|
49
52
|
end
|
50
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bpm_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ariel Presa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|