Method: QuickBase::Client#initialize

Defined in:
lib/QuickBaseClient.rb

#initialize(username = nil, password = nil, appname = nil, useSSL = true, printRequestsAndResponses = false, stopOnError = false, showTrace = false, org = "www", apptoken = nil, debugHTTPConnection = false, domain = "quickbase", proxy_options = nil) ⇒ Client

Set printRequestsAndResponses to true to view the XML sent to QuickBase and return from QuickBase. This can be very useful during debugging.

Set stopOnError to true to discontinue sending requests to QuickBase after an error has occured with a request. Set showTrace to true to view the complete stack trace of your running program. This should only be necessary as a last resort when a low-level exception has occurred.

To create an instance of QuickBase::Client using a Hash of options, use QuickBase::Client.init(options) instead of QuickBase::Client.new()



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/QuickBaseClient.rb', line 82

def initialize( username = nil, 
                   password = nil, 
                   appname = nil, 
                   useSSL = true, 
                   printRequestsAndResponses = false, 
                   stopOnError = false, 
                   showTrace = false, 
                   org = "www", 
                   apptoken = nil,
                   debugHTTPConnection = false,
                   domain = "quickbase",
                   proxy_options = nil
                   )
  begin
     @org = org ? org : "www"
     @domain = domain ? domain : "quickbase"
     @apptoken = apptoken
     @printRequestsAndResponses = printRequestsAndResponses
     @stopOnError = stopOnError
     @escapeBR = @ignoreCR = @ignoreLF = @ignoreTAB = true
     toggleTraceInfo( showTrace ) if showTrace
     setHTTPConnectionAndqbhost( useSSL, org, domain, proxy_options )         
     debugHTTPConnection() if debugHTTPConnection
     @standardRequestHeaders = { "Content-Type" => "application/xml" }
     if username and password
        authenticate( username, password )
        if appname and @errcode == "0"
           findDBByname( appname )
           if @dbid and @errcode == "0"
             getDBInfo( @dbid )
             getSchema( @dbid )
           end
        end
     end
  rescue Net::HTTPBadRequest => @lastError
  rescue Net::HTTPBadResponse => @lastError
  rescue Net::HTTPHeaderSyntaxError => @lastError
  rescue StandardError => @lastError
  end
end