Skip to content

salmanasiddiqui/Quickbase-Gem

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#AIS QuickBase Ruby Gem

Gem Version

This gem is designed to be a concise, clear and maintainable collection of common Quickbase API calls used in ruby development. It implements a subset of the total Quickbase API.

##Example

# Create a new API connection
qb_api = AdvantageQuickbase::API.new( 'domain', 'username', 'password' )

# Load all of the Books in our table
query_options = { query: "{6.EX.'Book'}", clist: [7] }
books = qb_api.do_query( 'books_db_id', query_options )

puts books.inspect
# => [ {"7" => "Lord of the Flies"}, {"7" => "The Giver"} ]

##API Documentation ###New Connection

qb_api = Advantage::QuickbaseAPI.new( :app_domain, :username, :password )

###Find Find that singular Quickbase record and return as a json object

find(db_id, record_id, query_options) => [json] record

#Load the record that has a Record ID 8 from the books table
query_options = { clist: [3,7,8] }
book = qb_api.find( 'books_db_id', '8' , query_options )

puts book.inspect
# => [ {"3" => "8"}, {"7" => "The Giver"}, {"8" => "Lois Lowry"} ]

###Do Query Count do_query_count( db_id, query=nil ) => [int] Record Count

today = Date.today.strftime( '%Y-%m-%d' )
num_records = qb_api.do_query_count( 'abcd1234', "{1.EX.'#{today}'}" )

###Do Query do_query( db_id, query_options ) => [json] records

query_options expects a hash containing any of the following options:

  • query - typical Quickbase query string. ex: "{3.EX.'123'}"
  • qid - report or query id to load (should not be used with query or qname)
  • qname - report or query name to load (should not be used with query or qid)
  • clist - a list (Array or period-separated string) of fields to return
  • slist - a list (Array or period-separated string) of fields to sort by
  • options - string of additional options. ex: "num-200.skp-#{records_processed}"
records = qb_api.do_query( 'bdjwmnj33', query: "{3.EX.'123'}", clist: [3, 6, 10] )

###Add Record add_record( db_id, new_data ) => [int] New Record Id

new_data = { 6 => 'Book', 7 => 'My New Title', 8 => 'John Smith'}
new_record_id = qb_api.add_record( 'abcd1234', new_data )

###Edit Record edit_record( db_id, record_id, new_data ) => [bool] Success?

new_data = { 7 => 'My Second Title', 8 => 'John Smith'}
call_successful = qb_api.edit_record( 'abcd1234', 136, new_data )

###Delete Record delete_record( db_id, record_id ) => [bool] Success?

call_successful = qb_api.delete_record( 'abcd1234', 136 )

###Purge Records purge_records( db_id, options ) => [int] Records Deleted

options expects a hash containing any of the following options:

  • query - typical Quickbase query string. ex: "{3.EX.'123'}"
  • qid - report or query id to load (should not be used with query or qname)
  • qname - report or query name to load (should not be used with query or qid)
records_deleted = qb_api.purge_records( 'abcd1234', {qid: 6} )

###Get Schema Get the complete schema of the whole quickbase app

get_schema( db_id )

app_schema = qb_api.get_schema( 'abcd1234' )

###Import From CSV import_from_csv( db_id, data, column_field_ids ) => [json] New Record Ids

new_data = [
  ['Book', 'Lord of the Flies', 'William Golding'],
  ['Book', 'A Tale of Two Cities', 'Charles Dickens'],
  ['Book', 'Animal Farm', 'George Orwell']
]
record_ids = qb_api.import_from_csv( 'abcd1234', new_data, [6, 7, 8] )

###Create App Token Create an app token that gives you access to that Quickbase app

create_app_token(db_id, description, page_token)

  • db_id - database id
  • description - description of what the token is for
  • page_token - token hidden in the page DOM
app_token = qb_api.create_app_token( 'abcd1234', 'Access all the books in the database', 'TugHxxkil9t6Kdebac' )

About

Ruby Gem for rapid interfacing with Intuit Quickbase

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%