Class: QuickBase::Objects::Builder

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

Overview

Build objects using XML from QuickBase

Instance Method Summary collapse

Constructor Details

#initialize(username = nil, password = nil, qbc = nil) ⇒ Builder

Returns a new instance of Builder.



479
480
481
482
# File 'lib/QuickBaseObjects.rb', line 479

def initialize(username=nil,password=nil,qbc=nil)
  @qbc = qbc || Client.new(username,password)
  @qbc.cacheSchemas=true
end

Instance Method Details

#application(application_name) ⇒ Object



483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/QuickBaseObjects.rb', line 483

def application(application_name)
  dbid = @qbc.findDBByName(application_name)
  if dbid
    @qbc._getAppDTMInfo
    @qbc._getDBInfo
    @qbc._getSchema
    a = Application.new
    a.build(@qbc,true)
  else
    raise "Could not find the application named '#{application_name}'."        
  end
end

#table(dbid) ⇒ Object



495
496
497
498
499
500
501
502
503
504
# File 'lib/QuickBaseObjects.rb', line 495

def table(dbid)
  begin
    @qbc.getDBInfo(dbid)
    @qbc.getSchema(dbid)
    t = Table.new
    t.build(@qbc)
  rescue
    raise "Could not find the table using '#{dbid}' as a dbid."        
  end
end