comfan 0.1.1 → 0.1.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/.ruby-version +1 -1
- data/Gemfile +8 -8
- data/Guardfile +2 -2
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/Rakefile +3 -3
- data/comfan.gemspec +13 -13
- data/lib/comfan.rb +10 -10
- data/lib/comfan/version.rb +1 -1
- data/spec/lib/comfan_spec.rb +23 -18
- data/spec/spec_helper.rb +6 -6
- metadata +15 -30
- data/LICENSE.txt +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eed71e84f8bf3d0ea494f1be8fc75ba80fb676d
|
4
|
+
data.tar.gz: 59b7e624082f9e3538d08066126148d0c1cb0816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 426d61e573ec30c2787be3ff75f99ae68bb109228bedb33c1c8d7b73706f877d0b508c6ce4b91d4986b5bb6546eb820920953b76f696d487d8f499e3da6cfb5f
|
7
|
+
data.tar.gz: 842871db8822a0a7cd879bb9a6ac074fbd6fe5ab863a660c0f5c710aa42bd59b8e0d0716eac3634af84147b400077d62d92ac3b3ab40ce4b783a99b1f765bc23
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.1.3
|
data/Gemfile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :test, :development do
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem
|
6
|
+
gem "coveralls", require: false
|
7
|
+
gem "guard"
|
8
|
+
gem "guard-rspec"
|
9
9
|
|
10
|
-
gem
|
11
|
-
gem
|
12
|
-
gem
|
13
|
-
end
|
10
|
+
gem "rb-inotify", require: false
|
11
|
+
gem "rb-fsevent", require: false
|
12
|
+
gem "rb-fchange", require: false
|
13
|
+
end
|
data/Guardfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -39,7 +39,7 @@ This is method converts an API ID to an UI ID. If an UI ID is provided (length <
|
|
39
39
|
Otherwise the UI ID is calculated
|
40
40
|
|
41
41
|
~~~ ruby
|
42
|
-
Comfan.
|
42
|
+
Comfan.ui_id '00D50000000IehZEAS' # 0D50000000IehZ
|
43
43
|
~~~
|
44
44
|
|
45
45
|
## Contributing
|
@@ -48,4 +48,4 @@ Comfan.api_id '00D50000000IehZEAS' # 0D50000000IehZ
|
|
48
48
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
49
49
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
50
50
|
4. Push to the branch (`git push origin my-new-feature`)
|
51
|
-
5. Create new Pull Request
|
51
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
data/comfan.gemspec
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "comfan/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = "comfan"
|
8
8
|
spec.version = Comfan::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.description =
|
12
|
-
|
13
|
-
spec.
|
14
|
-
spec.
|
9
|
+
spec.authors = ["Leif Gensert", "Thomas Rudolf"]
|
10
|
+
spec.email = ["leif@propertybase.com", "thomas@propertybase.com"]
|
11
|
+
spec.description = "This tool provides simple helper methods for ruby " \
|
12
|
+
"to provide functionality used in Salesforce"
|
13
|
+
spec.summary = "Ruby Helper Tools for Salesforce functionality"
|
14
|
+
spec.homepage = "https://github.com/propertybase/comfan"
|
15
|
+
spec.license = "MIT"
|
15
16
|
|
16
17
|
spec.files = `git ls-files`.split($/)
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ["lib"]
|
20
21
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency 'rspec', '< 2.14'
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec", "< 3.2"
|
24
24
|
end
|
data/lib/comfan.rb
CHANGED
@@ -3,26 +3,26 @@ require "comfan/version"
|
|
3
3
|
module Comfan
|
4
4
|
extend self
|
5
5
|
|
6
|
-
def api_id
|
7
|
-
return input_id if input_id.nil? || input_id.length
|
8
|
-
suffix =
|
9
|
-
|
6
|
+
def api_id(input_id)
|
7
|
+
return input_id if input_id.nil? || input_id.length != 15
|
8
|
+
suffix = ""
|
9
|
+
|
10
10
|
3.times do |i|
|
11
11
|
flags = 0
|
12
12
|
5.times do |j|
|
13
13
|
c = input_id[i * 5 + j]
|
14
|
-
if c.upcase == c && c >=
|
15
|
-
flags = flags + (
|
14
|
+
if c.upcase == c && c >= "A" && c <= "Z"
|
15
|
+
flags = flags + (1 << j)
|
16
16
|
end
|
17
17
|
end
|
18
|
-
suffix +=
|
18
|
+
suffix += "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345"[flags]
|
19
19
|
end
|
20
20
|
input_id + suffix
|
21
21
|
end
|
22
22
|
|
23
|
-
def ui_id
|
24
|
-
return input_id if input_id.nil? || input_id.length
|
23
|
+
def ui_id(input_id)
|
24
|
+
return input_id if input_id.nil? || input_id.length != 18
|
25
25
|
|
26
26
|
input_id[0..-4]
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|
data/lib/comfan/version.rb
CHANGED
data/spec/lib/comfan_spec.rb
CHANGED
@@ -1,40 +1,45 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
require
|
1
|
+
# encoding: utf-8
|
2
|
+
require "spec_helper"
|
3
3
|
|
4
4
|
describe Comfan do
|
5
|
-
subject{
|
5
|
+
subject { described_class }
|
6
6
|
|
7
|
-
describe
|
8
|
-
it
|
9
|
-
input =
|
7
|
+
describe ".api_id" do
|
8
|
+
it "returns the same ID for API ID" do
|
9
|
+
input = "752S00000000KtkIAE"
|
10
10
|
expect(subject.api_id(input)).to eq(input)
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
14
|
-
input =
|
15
|
-
output =
|
13
|
+
it "returns the correct API ID for UI ID" do
|
14
|
+
input = "752S00000000Ktk"
|
15
|
+
output = "752S00000000KtkIAE"
|
16
16
|
expect(subject.api_id(input)).to eq(output)
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
19
|
+
it "returns nil for nil input" do
|
20
20
|
expect(subject.api_id(nil)).to be_nil
|
21
21
|
end
|
22
|
+
|
23
|
+
it "returns same ID if too short" do
|
24
|
+
input = "752S00000000"
|
25
|
+
expect(subject.api_id(input)).to eq(input)
|
26
|
+
end
|
22
27
|
end
|
23
28
|
|
24
|
-
describe
|
25
|
-
it
|
26
|
-
input =
|
29
|
+
describe ".ui_id" do
|
30
|
+
it "returns the same ID for UI ID" do
|
31
|
+
input = "752S00000000Ktk"
|
27
32
|
expect(subject.ui_id(input)).to eq(input)
|
28
33
|
end
|
29
34
|
|
30
|
-
it
|
31
|
-
input =
|
32
|
-
output =
|
35
|
+
it "returns the correct UI ID for API ID" do
|
36
|
+
input = "752S00000000KtkIAE"
|
37
|
+
output = "752S00000000Ktk"
|
33
38
|
expect(subject.ui_id(input)).to eq(output)
|
34
39
|
end
|
35
40
|
|
36
|
-
it
|
41
|
+
it "returns nil for nil input" do
|
37
42
|
expect(subject.ui_id(nil)).to be_nil
|
38
43
|
end
|
39
44
|
end
|
40
|
-
end
|
45
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "simplecov"
|
2
|
+
require "coveralls"
|
3
3
|
|
4
4
|
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
5
5
|
SimpleCov.start do
|
6
|
-
add_filter
|
6
|
+
add_filter "spec"
|
7
7
|
end
|
8
8
|
|
9
|
-
require
|
9
|
+
require "comfan"
|
10
10
|
|
11
11
|
RSpec.configure do |config|
|
12
12
|
config.mock_with :rspec
|
13
|
-
config.order =
|
13
|
+
config.order = "random"
|
14
14
|
config.filter_run_excluding skip: true
|
15
|
-
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leif Gensert
|
@@ -9,50 +9,36 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-10-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: bundler
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ~>
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '1.3'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ~>
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '1.3'
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: rake
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
31
17
|
requirements:
|
32
|
-
- -
|
18
|
+
- - ">="
|
33
19
|
- !ruby/object:Gem::Version
|
34
20
|
version: '0'
|
35
21
|
type: :development
|
36
22
|
prerelease: false
|
37
23
|
version_requirements: !ruby/object:Gem::Requirement
|
38
24
|
requirements:
|
39
|
-
- -
|
25
|
+
- - ">="
|
40
26
|
- !ruby/object:Gem::Version
|
41
27
|
version: '0'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: rspec
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
45
31
|
requirements:
|
46
|
-
- - <
|
32
|
+
- - "<"
|
47
33
|
- !ruby/object:Gem::Version
|
48
|
-
version: '2
|
34
|
+
version: '3.2'
|
49
35
|
type: :development
|
50
36
|
prerelease: false
|
51
37
|
version_requirements: !ruby/object:Gem::Requirement
|
52
38
|
requirements:
|
53
|
-
- - <
|
39
|
+
- - "<"
|
54
40
|
- !ruby/object:Gem::Version
|
55
|
-
version: '2
|
41
|
+
version: '3.2'
|
56
42
|
description: This tool provides simple helper methods for ruby to provide functionality
|
57
43
|
used in Salesforce
|
58
44
|
email:
|
@@ -62,15 +48,14 @@ executables: []
|
|
62
48
|
extensions: []
|
63
49
|
extra_rdoc_files: []
|
64
50
|
files:
|
65
|
-
- .gitignore
|
66
|
-
- .rspec
|
67
|
-
- .ruby-version
|
68
|
-
- .travis.yml
|
51
|
+
- ".gitignore"
|
52
|
+
- ".rspec"
|
53
|
+
- ".ruby-version"
|
54
|
+
- ".travis.yml"
|
69
55
|
- CHANGELOG.md
|
70
56
|
- Gemfile
|
71
57
|
- Guardfile
|
72
58
|
- LICENSE
|
73
|
-
- LICENSE.txt
|
74
59
|
- README.md
|
75
60
|
- Rakefile
|
76
61
|
- comfan.gemspec
|
@@ -88,17 +73,17 @@ require_paths:
|
|
88
73
|
- lib
|
89
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
90
75
|
requirements:
|
91
|
-
- -
|
76
|
+
- - ">="
|
92
77
|
- !ruby/object:Gem::Version
|
93
78
|
version: '0'
|
94
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
80
|
requirements:
|
96
|
-
- -
|
81
|
+
- - ">="
|
97
82
|
- !ruby/object:Gem::Version
|
98
83
|
version: '0'
|
99
84
|
requirements: []
|
100
85
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
86
|
+
rubygems_version: 2.2.2
|
102
87
|
signing_key:
|
103
88
|
specification_version: 4
|
104
89
|
summary: Ruby Helper Tools for Salesforce functionality
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 Leif Gensert, Propertybase GmbH
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|