bpm_manager 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e571c38f2ebf114691072cb0a872807d2c8c0e0b
4
- data.tar.gz: 11d15a7aeda80f3d9f4dec7a52c7d5d1b01f1e46
3
+ metadata.gz: 377c27c454bef760ce9803d5b9a35b2738932635
4
+ data.tar.gz: a727bf98b0e7a9689818bd980b60c782aa5d8ab3
5
5
  SHA512:
6
- metadata.gz: ba39dac976c7a0050096c70aef25a34fc9ee558796f8b382e371c664fc7bb5645e7eb616cafe13db56bf86774875b9e13fc8f6d1b13b4417afe2cb340b6e0ed3
7
- data.tar.gz: 27d35045b5349d5d0ebf920a037e61a2b0453adfc6af9ae59aacc3a07be8ce4684e97a940a8036c092e6afa6f4a4a1a92dacc3b02196528ee9ab746b3559bae2
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
- :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
- })
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.
@@ -1,3 +1,3 @@
1
1
  module BpmManager
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/bpm_manager.rb CHANGED
@@ -3,31 +3,34 @@ require "rest-client"
3
3
  require "json"
4
4
 
5
5
  module BpmManager
6
- @config ||= {
7
- :bpm_vendor => "",
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
- # Configure through hash
22
- def self.configure(opts = {})
23
- opts.each{ |k,v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym }
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 @config[:bpm_vendor].downcase
31
+ case configuration.bpm_vendor.downcase
29
32
  when 'redhat'
30
- URI.encode('http' + (@config[:bpm_use_ssl] ? 's' : '') + '://' + @config[:bpm_username] + ':' + @config[:bpm_password] + '@' + @config[:bpm_url] + '/business-central/rest' + (suffix.nil? ? '' : suffix))
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({ :bpm_vendor => 'RedHat', :bpm_url => 'bpm.company.com', :bpm_username => 'scott', :bpm_password => 'tiger' })
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 "#config" do
28
+ describe "#configuration" do
23
29
  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
30
+ @config = BpmManager.configuration
29
31
  end
30
32
 
31
- it 'should not be empty' do
32
- expect(@config.length).to be > 0
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 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
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bpm_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ariel Presa