comfan 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f3f83c491c67fef1382e1a2d4a389f0bd48a4f67
4
+ data.tar.gz: 728b9a7a8cec86b0c9a72be79bda9638a2b45b53
5
+ SHA512:
6
+ metadata.gz: 26db800d4e96ab2a6c052685d557adc733d402d9886de66e833f671c77fe8d727a2e9589f050d054c944a09a6b8cca50dafac46bd065ee60780f4ba5cd9070ab
7
+ data.tar.gz: 045f413429303abb7eaddac0474e1d24fd934e3d1f505849aeec392b166ae8527293531d35de953322e44bdc97c7ed3d967fa6ba503e3a0f802ec681e0a3b9a9
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ vendor/bundle
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --tty --color --format documentation
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0-p195
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ bundler_args: --without documentation production
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - jruby-19mode
7
+ - rbx-19mode
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: rbx-19mode
11
+ script:
12
+ - rake spec
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 (June 17th, 2013)
2
+
3
+ - initial release
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in comfan.gemspec
4
+ gemspec
5
+
6
+ group :test, :development do
7
+ gem 'coveralls', require: false
8
+ gem 'guard'
9
+ gem 'guard-rspec'
10
+
11
+ gem 'rb-inotify', require: false
12
+ gem 'rb-fsevent', require: false
13
+ gem 'rb-fchange', require: false
14
+ end
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard :rspec do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Leif Gensert
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.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
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.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Comfan
2
+
3
+ [![Build Status](https://travis-ci.org/propertybase/comfan.png?branch=master)](https://travis-ci.org/propertybase/comfan) [![Coverage Status](https://coveralls.io/repos/propertybase/comfan/badge.png?branch=master)](https://coveralls.io/r/propertybase/comfan) [![Code Climate](https://codeclimate.com/github/propertybase/comfan.png)](https://codeclimate.com/github/propertybase/comfan) [![Dependency Status](https://gemnasium.com/propertybase/comfan.png)](https://gemnasium.com/propertybase/comfan) [![Gem Version](https://badge.fury.io/rb/comfan.png)](http://badge.fury.io/rb/comfan)
4
+
5
+ Named after a [tool used in the Star Wars universe](http://starwars.wikia.com/wiki/Comfan), this tool provides simple helper methods for ruby to provide functionality used in Salesforce.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'comfan'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install comfan
20
+
21
+ ## Usage
22
+
23
+ ### api_id
24
+
25
+ This method returns a API ID for the input ID. If the input already is an API (length >= 18 character), the same ID is returned.
26
+
27
+ Otherwise the API ID is calculated
28
+
29
+ ### ui_id
30
+
31
+ This is method converts an API ID to an UI ID. If an UI ID is provided (length <= 15 characters), the same ID is returned.
32
+
33
+ Otherwise the UI ID is calculated
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/comfan.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'comfan/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'comfan'
8
+ spec.version = Comfan::VERSION
9
+ spec.authors = ['Leif Gensert']
10
+ spec.email = ['leif@propertybase.com']
11
+ spec.description = %q{This tool provides simple helper methods for ruby to provide functionality used in Salesforce}
12
+ spec.summary = %q{Ruby Helper Tools for Salesforce functionality}
13
+ spec.homepage = 'https://github.com/propertybase/comfan'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'rspec', '< 2.14'
24
+ end
data/lib/comfan.rb ADDED
@@ -0,0 +1,28 @@
1
+ require "comfan/version"
2
+
3
+ module Comfan
4
+ extend self
5
+
6
+ def api_id input_id
7
+ return input_id if input_id.length >= 18
8
+ suffix = ''
9
+
10
+ 3.times do |i|
11
+ flags = 0
12
+ 5.times do |j|
13
+ c = input_id[i * 5 + j]
14
+ if c.upcase == c && c >= 'A' && c <= 'Z'
15
+ flags = flags + ( 1 << j )
16
+ end
17
+ end
18
+ suffix += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345'[flags]
19
+ end
20
+ input_id + suffix
21
+ end
22
+
23
+ def ui_id input_id
24
+ return input_id if input_id.length <= 15
25
+
26
+ input_id[0..-4]
27
+ end
28
+ end
@@ -0,0 +1,3 @@
1
+ module Comfan
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,32 @@
1
+ #encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Comfan do
5
+ subject{Comfan}
6
+
7
+ describe '.api_id' do
8
+ it 'returns the same ID for API ID' do
9
+ input = '752S00000000KtkIAE'
10
+ expect(subject.api_id(input)).to eq(input)
11
+ end
12
+
13
+ it 'returns the correct API ID for UI ID' do
14
+ input = '752S00000000Ktk'
15
+ output = '752S00000000KtkIAE'
16
+ expect(subject.api_id(input)).to eq(output)
17
+ end
18
+ end
19
+
20
+ describe '.ui_id' do
21
+ it 'returns the same ID for UI ID' do
22
+ input = '752S00000000Ktk'
23
+ expect(subject.ui_id(input)).to eq(input)
24
+ end
25
+
26
+ it 'returns the correct UI ID for API ID' do
27
+ input = '752S00000000KtkIAE'
28
+ output = '752S00000000Ktk'
29
+ expect(subject.ui_id(input)).to eq(output)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,15 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
5
+ SimpleCov.start do
6
+ add_filter 'spec'
7
+ end
8
+
9
+ require 'comfan'
10
+
11
+ RSpec.configure do |config|
12
+ config.mock_with :rspec
13
+ config.order = 'random'
14
+ config.filter_run_excluding skip: true
15
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: comfan
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Leif Gensert
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - <
46
+ - !ruby/object:Gem::Version
47
+ version: '2.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - <
53
+ - !ruby/object:Gem::Version
54
+ version: '2.14'
55
+ description: This tool provides simple helper methods for ruby to provide functionality
56
+ used in Salesforce
57
+ email:
58
+ - leif@propertybase.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - .rspec
65
+ - .ruby-version
66
+ - .travis.yml
67
+ - CHANGELOG.md
68
+ - Gemfile
69
+ - Guardfile
70
+ - LICENSE
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - comfan.gemspec
75
+ - lib/comfan.rb
76
+ - lib/comfan/version.rb
77
+ - spec/lib/comfan_spec.rb
78
+ - spec/spec_helper.rb
79
+ homepage: https://github.com/propertybase/comfan
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.0.2
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Ruby Helper Tools for Salesforce functionality
103
+ test_files:
104
+ - spec/lib/comfan_spec.rb
105
+ - spec/spec_helper.rb