bpm_manager 0.0.2 → 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 +4 -4
- data/README.md +16 -2
- data/lib/bpm_manager/version.rb +1 -1
- data/lib/bpm_manager.rb +12 -4
- data/spec/server_spec.rb +21 -1
- 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: 7f01279b1a9e78551da9fde85aacfb9382826c75
|
4
|
+
data.tar.gz: 8b84ee1e88bfd84c68bf977aff0465226404a2bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29e9e4033d5f5097af44867171b68346f9a298c8a9a72cd1508c28e62e24a543946bb4de2b35493206c10f4cc019bc71b54f4f23118219c48827b78cc00142d4
|
7
|
+
data.tar.gz: c7bd870228c037bd4265035eba26625c5a2a7a9181f3624beb3973175bcc4dbe559485b20e162815059f07111683e31edaad45d1c00e848bc9da8c58a9d2b18a
|
data/README.md
CHANGED
@@ -25,7 +25,7 @@ Also do not forget to execute the initializer with:
|
|
25
25
|
|
26
26
|
## Usage
|
27
27
|
|
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
31
|
BpmManager.configure({
|
@@ -37,12 +37,26 @@ BpmManager.configure({
|
|
37
37
|
})
|
38
38
|
```
|
39
39
|
|
40
|
-
|
40
|
+
Then make an API call like this:
|
41
41
|
|
42
42
|
```ruby
|
43
43
|
result = BpmManager.deployments()
|
44
44
|
```
|
45
45
|
|
46
|
+
## Quick Example
|
47
|
+
|
48
|
+
Get all tasks for an user id
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
BpmManager.tasks('foo@bar.com')
|
52
|
+
```
|
53
|
+
|
54
|
+
Get all tasks for with options (RedHat example). It support all REST API options for /task/query call:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
BpmManager.tasks({:ownerId => 'foo@bar.com', :processInstanceId => 3})
|
58
|
+
```
|
59
|
+
|
46
60
|
## Contributing
|
47
61
|
|
48
62
|
1. Fork it ( https://github.com/BeatCoding/bpm_manager/fork )
|
data/lib/bpm_manager/version.rb
CHANGED
data/lib/bpm_manager.rb
CHANGED
@@ -24,8 +24,8 @@ module BpmManager
|
|
24
24
|
|
25
25
|
# Returns the URI for the server plus a suffix
|
26
26
|
def self.uri(suffix = '')
|
27
|
-
case @config[:bpm_vendor]
|
28
|
-
when '
|
27
|
+
case @config[:bpm_vendor].downcase
|
28
|
+
when 'redhat'
|
29
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
30
|
else
|
31
31
|
''
|
@@ -34,8 +34,16 @@ module BpmManager
|
|
34
34
|
|
35
35
|
# Gets all server deployments
|
36
36
|
def self.deployments()
|
37
|
-
raise LoadError 'BpmManager Gem Configuration file has errors' if @config.values.any?{|v| v.nil?}
|
38
|
-
|
39
37
|
return JSON.parse(RestClient.get(BpmManager.uri('/deployment'), :accept => :json))
|
40
38
|
end
|
39
|
+
|
40
|
+
# Gets all server deployments
|
41
|
+
def self.tasks(user_id = "")
|
42
|
+
return JSON.parse(RestClient.get(BpmManager.uri('/task/query' + (user_id.empty? ? '' : '?taskOwner='+user_id)), :accept => :json))
|
43
|
+
end
|
44
|
+
|
45
|
+
# Gets all server deployments
|
46
|
+
def self.tasks_with_opts(opts = {})
|
47
|
+
return JSON.parse(RestClient.get(BpmManager.uri('/task/query' + (opts.empty? ? '' : '?' + opts.map{|k,v| puts k.to_s + '=' + v.to_s}.join('&'))), :accept => :json))
|
48
|
+
end
|
41
49
|
end
|
data/spec/server_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "BpmManager" do
|
4
4
|
before :all do
|
5
|
-
BpmManager.configure({ :bpm_vendor => 'RedHat', :bpm_url => 'bpm.
|
5
|
+
BpmManager.configure({ :bpm_vendor => 'RedHat', :bpm_url => 'bpm.company.com', :bpm_username => 'scott', :bpm_password => 'tiger' })
|
6
6
|
end
|
7
7
|
|
8
8
|
describe "#uri" do
|
@@ -50,4 +50,24 @@ describe "BpmManager" do
|
|
50
50
|
expect(@deployments.length).to be > 0
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
describe "#tasks" do
|
55
|
+
before :each do
|
56
|
+
@tasks = BpmManager.tasks('ariel@beatcoding.com')
|
57
|
+
end
|
58
|
+
|
59
|
+
it "must return something" do
|
60
|
+
expect(@tasks.length).to be > 0
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "#tasks_with_opts" do
|
65
|
+
before :each do
|
66
|
+
@tasks = BpmManager.tasks_with_opts({:ownerId => 'ariel@beatcoding.com', :id => 6})
|
67
|
+
end
|
68
|
+
|
69
|
+
it "must return something" do
|
70
|
+
expect(@tasks.length).to be > 0
|
71
|
+
end
|
72
|
+
end
|
53
73
|
end
|