quickbase_client_groups 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,117 @@
1
+ #--#####################################################################
2
+ # Copyright (c) 2009-2012 Gareth Lewis and Intuit, Inc.
3
+ #
4
+ # All rights reserved. This program and the accompanying materials
5
+ # are made available under the terms of the Eclipse Public License v1.0
6
+ # which accompanies this distribution, and is available at
7
+ # http://www.opensource.org/licenses/eclipse-1.0.php
8
+ #
9
+ # Contributors:
10
+ # Gareth Lewis - Initial contribution.
11
+ # Intuit Partner Platform.
12
+ #++#####################################################################
13
+
14
+ module QuickBase
15
+
16
+ # Miscellaneous static helper methods
17
+ class Misc
18
+
19
+ def Misc.ruby19?
20
+ RUBY_VERSION >= "1.9"
21
+ end
22
+
23
+ def Misc.createBase32ConversionHash
24
+ base32Symbols = {}
25
+ decimal = 0
26
+ ("a".."z").each{|letter|
27
+ unless letter == "l" or letter == "o"
28
+ base32Symbols[decimal.to_s]=letter
29
+ decimal += 1
30
+ end
31
+ }
32
+ (2..9).each{|number|
33
+ base32Symbols[decimal.to_s]=number.to_s
34
+ decimal += 1
35
+ }
36
+ base32Symbols
37
+ end
38
+
39
+ def Misc.decimalToBase32(decimalNumber)
40
+ @base32Symbols ||= Misc.createBase32ConversionHash
41
+ base32Num = ""
42
+ decimalNumber = decimalNumber.to_i
43
+ if decimalNumber < 32
44
+ base32Num = @base32Symbols[decimalNumber.to_s]
45
+ else
46
+ power = 10
47
+ power -= 1 while (decimalNumber/(32**power)) < 1
48
+ while decimalNumber > 0
49
+ n = (decimalNumber/(32**power))
50
+ base32Num << @base32Symbols[n.to_s] if @base32Symbols[n.to_s]
51
+ decimalNumber = (decimalNumber-((32**power)*n))
52
+ power -= 1
53
+ end
54
+ end
55
+ base32Num
56
+ end
57
+
58
+ def Misc.isBase32Number?(string)
59
+ ret = true
60
+ if string
61
+ @base32Symbols ||= Misc.createBase32ConversionHash
62
+ base32SymbolsValues = @base32Symbols.values
63
+ stringCopy = string.to_s
64
+ stringCopy.split(//).each{|char|
65
+ if !base32SymbolsValues.include?(char)
66
+ ret = false
67
+ break
68
+ end
69
+ }
70
+ else
71
+ ret = false
72
+ end
73
+ ret
74
+ end
75
+
76
+ def Misc.isDbidString?(string)
77
+ Misc.isBase32Number?(string)
78
+ end
79
+
80
+ def Misc.time_in_milliseconds(time = nil)
81
+ ret = 0
82
+ time ||= Time.now
83
+ if time.is_a?(Time)
84
+ ret = (time.to_f * 1000).to_i
85
+ elsif time.is_a?(DateTime)
86
+ t = Time.mktime(time.year,time.month,time.day,time.hour,time.min,time.sec,0)
87
+ ret = (t.to_f * 1000).to_i
88
+ elsif time.is_a?(Date)
89
+ t = Time.mktime(time.year,time.month,time.day,0,0,0,0)
90
+ ret = (t.to_f * 1000).to_i
91
+ end
92
+ ret
93
+ end
94
+
95
+ def Misc.listUserToArray(listUser)
96
+ listUser.split(/;/)
97
+ end
98
+
99
+ def Misc.arrayToListUser(array)
100
+ array.join(";")
101
+ end
102
+
103
+ def Misc.save_file(filename, contents, mode="wb")
104
+ File.open(filename, mode){|f|
105
+ f.write(contents)
106
+ f.flush
107
+ }
108
+ rescue StandardError => error
109
+ new_filename = filename.gsub(/\W/,"_")
110
+ File.open(new_filename, mode){|f|
111
+ f.write(contents)
112
+ f.flush
113
+ }
114
+ end
115
+
116
+ end
117
+ end
@@ -0,0 +1,2 @@
1
+
2
+ require 'QuickBaseClient'
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quickbase_client_groups
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - garethlatwork
8
+ - Austin Zentz
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-12-29 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Forked from garethlatwork original
15
+ email: rubycoder@example.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/QuickBaseClient.rb
21
+ - lib/QuickBaseMisc.rb
22
+ - lib/quickbase_client.rb
23
+ homepage: https://github.com/aust1nz/quickbase_client
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.2.5
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Updated quickbase client
47
+ test_files: []