quickbase_client 1.0.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.
@@ -0,0 +1,96 @@
1
+ #--#####################################################################
2
+ # Copyright (c) 2009-2010 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
+ end
96
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quickbase_client
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ version: 1.0.0
10
+ platform: ruby
11
+ authors:
12
+ - Gareth Lewis
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-11-21 00:00:00 -08:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Wraps the QuickBase HTTP API and adds a lot of classes and methods to minimize the amount of code need to get useful things done. This is a minimal subset of the ipp_quickbase_devkit.
22
+ email:
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - LICENSE
29
+ - README.rdoc
30
+ files:
31
+ - LICENSE
32
+ - README.rdoc
33
+ - lib/QuickBaseClient.rb
34
+ - lib/QuickBaseMisc.rb
35
+ has_rdoc: true
36
+ homepage: https://code.intuit.com/sf/projects/ipp_dev_kits
37
+ licenses: []
38
+
39
+ post_install_message: |
40
+ **************************************************
41
+
42
+ Thank you for installing the quickbase_client gem.
43
+ Distributed under the Eclipse Public License Version 1.0.
44
+
45
+ **************************************************
46
+
47
+ rdoc_options:
48
+ - --line-numbers
49
+ - --inline-source
50
+ - --main
51
+ - README.rdoc
52
+ - --title
53
+ - "quickbase: Ruby client for database applications on www.quickbase.com"
54
+ - lib/QuickBaseClient.rb
55
+ - lib/QuickBaseMisc.rb
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 1
65
+ - 8
66
+ - 6
67
+ version: 1.8.6
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ requirements: []
77
+
78
+ rubyforge_project: orphans
79
+ rubygems_version: 1.3.7
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Ruby wrapper for the QuickBase HTTP API. This is a minimal subset of the ipp_quickbase_devkit.
83
+ test_files: []
84
+