bpm_manager 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -7
- data/lib/bpm_manager/version.rb +1 -1
- data/lib/bpm_manager.rb +22 -19
- data/spec/server_spec.rb +17 -15
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 377c27c454bef760ce9803d5b9a35b2738932635
|
4
|
+
data.tar.gz: a727bf98b0e7a9689818bd980b60c782aa5d8ab3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e35639ad29e4761ca7c47b8813630c7bfb38e3004ec0108e0367be5d6a2f184176ef8b9749481a858b8a242f6ab51b850b3fcd9754a83cc29648f8f65a22a2f9
|
7
|
+
data.tar.gz: a7b5556a5c1e12fb9c19f437612623a4e9114eb7fbe231a5309151463a3fb61e4664f69876b63f21cc7108e98caa9c35e7d1f9a2e71ef6ff8617d2586ecba696
|
data/README.md
CHANGED
@@ -28,13 +28,13 @@ Also do not forget to execute the initializer with:
|
|
28
28
|
First configure properly the gem using the bpm_manager.rb file in 'config/initializers/bpm_manager.rb' or calling
|
29
29
|
|
30
30
|
```ruby
|
31
|
-
BpmManager.configure
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
31
|
+
BpmManager.configure do |config|
|
32
|
+
config.bpm_vendor => 'RedHat' # or 'Oracle'
|
33
|
+
config.bpm_url => 'bpm.company.com' # without http:// or https://
|
34
|
+
config.bpm_username => 'scott'
|
35
|
+
config.bpm_passowrd => 'tiger'
|
36
|
+
config.bpm_use_ssl => false # use true for https
|
37
|
+
end
|
38
38
|
```
|
39
39
|
|
40
40
|
Then make an API call like this:
|
@@ -64,3 +64,7 @@ BpmManager.tasks({:ownerId => 'foo@bar.com', :processInstanceId => 3})
|
|
64
64
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
65
65
|
4. Push to the branch (`git push origin my-new-feature`)
|
66
66
|
5. Create a new Pull Request
|
67
|
+
|
68
|
+
## License
|
69
|
+
|
70
|
+
RailsConfig is released under the MIT License.
|
data/lib/bpm_manager/version.rb
CHANGED
data/lib/bpm_manager.rb
CHANGED
@@ -3,31 +3,34 @@ require "rest-client"
|
|
3
3
|
require "json"
|
4
4
|
|
5
5
|
module BpmManager
|
6
|
-
|
7
|
-
:
|
8
|
-
:bpm_url => "",
|
9
|
-
:bpm_username => "",
|
10
|
-
:bpm_password => "",
|
11
|
-
:bpm_use_ssl => false
|
12
|
-
}
|
13
|
-
|
14
|
-
@valid_config_keys = @config
|
15
|
-
|
16
|
-
# Returns the configuration hash
|
17
|
-
def self.config
|
18
|
-
@config
|
6
|
+
class << self
|
7
|
+
attr_accessor :configuration
|
19
8
|
end
|
20
|
-
|
21
|
-
#
|
22
|
-
|
23
|
-
|
9
|
+
|
10
|
+
# Defines the Configuration for the gem
|
11
|
+
class Configuration
|
12
|
+
attr_accessor :bpm_vendor, :bpm_url, :bpm_username, :bpm_password, :bpm_use_ssl
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@bpm_vendor = ""
|
16
|
+
@bpm_url = ""
|
17
|
+
@bpm_username = ""
|
18
|
+
@bpm_password = ""
|
19
|
+
@bpm_use_ssl = false
|
20
|
+
end
|
24
21
|
end
|
25
22
|
|
23
|
+
# Generates a new configuration
|
24
|
+
def self.configure
|
25
|
+
self.configuration ||= Configuration.new
|
26
|
+
yield(configuration)
|
27
|
+
end
|
28
|
+
|
26
29
|
# Returns the URI for the server plus a suffix
|
27
30
|
def self.uri(suffix = '')
|
28
|
-
case
|
31
|
+
case configuration.bpm_vendor.downcase
|
29
32
|
when 'redhat'
|
30
|
-
URI.encode('http' + (
|
33
|
+
URI.encode('http' + (configuration.bpm_use_ssl ? 's' : '') + '://' + configuration.bpm_username + ':' + configuration.bpm_password + '@' + configuration.bpm_url + '/business-central/rest' + (suffix.nil? ? '' : suffix))
|
31
34
|
else
|
32
35
|
''
|
33
36
|
end
|
data/spec/server_spec.rb
CHANGED
@@ -2,7 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "BpmManager" do
|
4
4
|
before :all do
|
5
|
-
BpmManager.configure
|
5
|
+
BpmManager.configure do |config|
|
6
|
+
config.bpm_vendor = "RedHat"
|
7
|
+
config.bpm_url = "bpm.company.com"
|
8
|
+
config.bpm_username = "scott"
|
9
|
+
config.bpm_password = "tiger"
|
10
|
+
config.bpm_use_ssl = false
|
11
|
+
end
|
6
12
|
end
|
7
13
|
|
8
14
|
describe "#uri" do
|
@@ -19,25 +25,21 @@ describe "BpmManager" do
|
|
19
25
|
end
|
20
26
|
end
|
21
27
|
|
22
|
-
describe "#
|
28
|
+
describe "#configuration" do
|
23
29
|
before :each do
|
24
|
-
@config = BpmManager.
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should be a Hash" do
|
28
|
-
expect(@config).to be_an_instance_of Hash
|
30
|
+
@config = BpmManager.configuration
|
29
31
|
end
|
30
32
|
|
31
|
-
it
|
32
|
-
expect(@config
|
33
|
+
it "should be a class of type Configuration" do
|
34
|
+
expect(@config).to be_an_instance_of BpmManager::Configuration
|
33
35
|
end
|
34
36
|
|
35
|
-
it 'must have all the
|
36
|
-
expect(@config.
|
37
|
-
expect(@config.
|
38
|
-
expect(@config.
|
39
|
-
expect(@config.
|
40
|
-
expect(@config.
|
37
|
+
it 'must have all the accesors' do
|
38
|
+
expect(@config.methods.include? :bpm_vendor).to be true
|
39
|
+
expect(@config.methods.include? :bpm_url).to be true
|
40
|
+
expect(@config.methods.include? :bpm_username).to be true
|
41
|
+
expect(@config.methods.include? :bpm_password).to be true
|
42
|
+
expect(@config.methods.include? :bpm_use_ssl).to be true
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|