Class: QuickBaseContactsAppBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/QuickBaseContactsAppBuilder.rb

Overview

usage: ruby QuickBaseContactsAppBuilder.rb username password [useWorkPlace]. Creates a very simple Contacts database in QuickBase and a Rails app for it.

Instance Method Summary collapse

Constructor Details

#initialize(username, password, useWorkPlace = nil) ⇒ QuickBaseContactsAppBuilder

Returns a new instance of QuickBaseContactsAppBuilder.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/QuickBaseContactsAppBuilder.rb', line 20

def initialize(username,password,useWorkPlace=nil)
   begin
      if useWorkPlace
        @qbc = QuickBase::WorkPlaceClient.new(username,password)
      else  
        @qbc = QuickBase::Client.new(username,password)
      end
      
      raise @qbc.errtext if ! @qbc.requestSucceeded
    
     @useWorkPlace = useWorkPlace
     @username, @password = username,password
     
     @rails_appname = @username.downcase.gsub( /\W/, "_" )
     @rails_appname << "_contacts"
     @rootClassName = ""
     @rails_appname.split(/_/).each{|s| @rootClassName << s.capitalize }
     @modelClassName = @rootClassName.dup
     @modelClassName[-1] = ""
     @modelFileName = @rails_appname.dup
     @modelFileName[-1] = ""
     @modelFileName << ".rb"
     
     buildApp
   rescue StandardError => connectionError
      puts "\n\nError connectiong to #{ useWorkPlace ? 'workplace.intuit.com' : 'www.quickbase.com'}: #{connectionError}\n\n" 
   end      
end