repo stringlengths 5 58 | path stringlengths 9 168 | func_name stringlengths 9 130 | original_string stringlengths 66 10.5k | language stringclasses 1
value | code stringlengths 66 10.5k | code_tokens list | docstring stringlengths 8 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 94 266 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
scrapper/perobs | lib/perobs/FlatFile.rb | PEROBS.FlatFile.delete_obj_by_id | def delete_obj_by_id(id)
if (pos = find_obj_addr_by_id(id))
delete_obj_by_address(pos, id)
return true
end
return false
end | ruby | def delete_obj_by_id(id)
if (pos = find_obj_addr_by_id(id))
delete_obj_by_address(pos, id)
return true
end
return false
end | [
"def",
"delete_obj_by_id",
"(",
"id",
")",
"if",
"(",
"pos",
"=",
"find_obj_addr_by_id",
"(",
"id",
")",
")",
"delete_obj_by_address",
"(",
"pos",
",",
"id",
")",
"return",
"true",
"end",
"return",
"false",
"end"
] | Delete the blob for the specified ID.
@param id [Integer] ID of the object to be deleted
@return [Boolean] True if object was deleted, false otherwise | [
"Delete",
"the",
"blob",
"for",
"the",
"specified",
"ID",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/FlatFile.rb#L117-L124 | train |
scrapper/perobs | lib/perobs/FlatFile.rb | PEROBS.FlatFile.delete_obj_by_address | def delete_obj_by_address(addr, id)
@index.remove(id) if @index.is_open?
header = FlatFileBlobHeader.read(@f, addr, id)
header.clear_flags
@space_list.add_space(addr, header.length) if @space_list.is_open?
end | ruby | def delete_obj_by_address(addr, id)
@index.remove(id) if @index.is_open?
header = FlatFileBlobHeader.read(@f, addr, id)
header.clear_flags
@space_list.add_space(addr, header.length) if @space_list.is_open?
end | [
"def",
"delete_obj_by_address",
"(",
"addr",
",",
"id",
")",
"@index",
".",
"remove",
"(",
"id",
")",
"if",
"@index",
".",
"is_open?",
"header",
"=",
"FlatFileBlobHeader",
".",
"read",
"(",
"@f",
",",
"addr",
",",
"id",
")",
"header",
".",
"clear_flags",... | Delete the blob that is stored at the specified address.
@param addr [Integer] Address of the blob to delete
@param id [Integer] ID of the blob to delete | [
"Delete",
"the",
"blob",
"that",
"is",
"stored",
"at",
"the",
"specified",
"address",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/FlatFile.rb#L129-L134 | train |
scrapper/perobs | lib/perobs/FlatFile.rb | PEROBS.FlatFile.delete_unmarked_objects | def delete_unmarked_objects
# We don't update the index and the space list during this operation as
# we defragmentize the blob file at the end. We'll end the operation
# with an empty space list.
clear_index_files
deleted_objects_count = 0
@progressmeter.start('Sweeping unmarked ob... | ruby | def delete_unmarked_objects
# We don't update the index and the space list during this operation as
# we defragmentize the blob file at the end. We'll end the operation
# with an empty space list.
clear_index_files
deleted_objects_count = 0
@progressmeter.start('Sweeping unmarked ob... | [
"def",
"delete_unmarked_objects",
"clear_index_files",
"deleted_objects_count",
"=",
"0",
"@progressmeter",
".",
"start",
"(",
"'Sweeping unmarked objects'",
",",
"@f",
".",
"size",
")",
"do",
"|",
"pm",
"|",
"each_blob_header",
"do",
"|",
"header",
"|",
"if",
"he... | Delete all unmarked objects. | [
"Delete",
"all",
"unmarked",
"objects",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/FlatFile.rb#L137-L160 | train |
scrapper/perobs | lib/perobs/FlatFile.rb | PEROBS.FlatFile.write_obj_by_id | def write_obj_by_id(id, raw_obj)
# Check if we have already an object with the given ID. We'll mark it as
# outdated and save the header for later deletion. In case this
# operation is aborted or interrupted we ensure that we either have the
# old or the new version available.
if (old_addr... | ruby | def write_obj_by_id(id, raw_obj)
# Check if we have already an object with the given ID. We'll mark it as
# outdated and save the header for later deletion. In case this
# operation is aborted or interrupted we ensure that we either have the
# old or the new version available.
if (old_addr... | [
"def",
"write_obj_by_id",
"(",
"id",
",",
"raw_obj",
")",
"if",
"(",
"old_addr",
"=",
"find_obj_addr_by_id",
"(",
"id",
")",
")",
"old_header",
"=",
"FlatFileBlobHeader",
".",
"read",
"(",
"@f",
",",
"old_addr",
")",
"old_header",
".",
"set_outdated_flag",
"... | Write the given object into the file. This method never uses in-place
updates for existing objects. A new copy is inserted first and only when
the insert was successful, the old copy is deleted and the index
updated.
@param id [Integer] ID of the object
@param raw_obj [String] Raw object as String
@return [Intege... | [
"Write",
"the",
"given",
"object",
"into",
"the",
"file",
".",
"This",
"method",
"never",
"uses",
"in",
"-",
"place",
"updates",
"for",
"existing",
"objects",
".",
"A",
"new",
"copy",
"is",
"inserted",
"first",
"and",
"only",
"when",
"the",
"insert",
"wa... | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/FlatFile.rb#L169-L252 | train |
scrapper/perobs | lib/perobs/FlatFile.rb | PEROBS.FlatFile.read_obj_by_address | def read_obj_by_address(addr, id)
header = FlatFileBlobHeader.read(@f, addr, id)
if header.id != id
PEROBS.log.fatal "Database index corrupted: Index for object " +
"#{id} points to object with ID #{header.id}"
end
buf = nil
begin
@f.seek(addr + FlatFileBlobHead... | ruby | def read_obj_by_address(addr, id)
header = FlatFileBlobHeader.read(@f, addr, id)
if header.id != id
PEROBS.log.fatal "Database index corrupted: Index for object " +
"#{id} points to object with ID #{header.id}"
end
buf = nil
begin
@f.seek(addr + FlatFileBlobHead... | [
"def",
"read_obj_by_address",
"(",
"addr",
",",
"id",
")",
"header",
"=",
"FlatFileBlobHeader",
".",
"read",
"(",
"@f",
",",
"addr",
",",
"id",
")",
"if",
"header",
".",
"id",
"!=",
"id",
"PEROBS",
".",
"log",
".",
"fatal",
"\"Database index corrupted: Ind... | Read the object at the specified address.
@param addr [Integer] Offset in the flat file
@param id [Integer] ID of the data blob
@return [String] Raw object data | [
"Read",
"the",
"object",
"at",
"the",
"specified",
"address",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/FlatFile.rb#L281-L312 | train |
scrapper/perobs | lib/perobs/FlatFile.rb | PEROBS.FlatFile.defragmentize | def defragmentize
distance = 0
new_file_size = 0
deleted_blobs = 0
corrupted_blobs = 0
valid_blobs = 0
# Iterate over all entries.
@progressmeter.start('Defragmentizing blobs file', @f.size) do |pm|
each_blob_header do |header|
# If we have stumbled over a co... | ruby | def defragmentize
distance = 0
new_file_size = 0
deleted_blobs = 0
corrupted_blobs = 0
valid_blobs = 0
# Iterate over all entries.
@progressmeter.start('Defragmentizing blobs file', @f.size) do |pm|
each_blob_header do |header|
# If we have stumbled over a co... | [
"def",
"defragmentize",
"distance",
"=",
"0",
"new_file_size",
"=",
"0",
"deleted_blobs",
"=",
"0",
"corrupted_blobs",
"=",
"0",
"valid_blobs",
"=",
"0",
"@progressmeter",
".",
"start",
"(",
"'Defragmentizing blobs file'",
",",
"@f",
".",
"size",
")",
"do",
"|... | Eliminate all the holes in the file. This is an in-place
implementation. No additional space will be needed on the file system. | [
"Eliminate",
"all",
"the",
"holes",
"in",
"the",
"file",
".",
"This",
"is",
"an",
"in",
"-",
"place",
"implementation",
".",
"No",
"additional",
"space",
"will",
"be",
"needed",
"on",
"the",
"file",
"system",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/FlatFile.rb#L337-L402 | train |
scrapper/perobs | lib/perobs/FlatFile.rb | PEROBS.FlatFile.refresh | def refresh
# This iteration might look scary as we iterate over the entries while
# while we are rearranging them. Re-inserted items may be inserted
# before or at the current entry and this is fine. They also may be
# inserted after the current entry and will be re-read again unless they
... | ruby | def refresh
# This iteration might look scary as we iterate over the entries while
# while we are rearranging them. Re-inserted items may be inserted
# before or at the current entry and this is fine. They also may be
# inserted after the current entry and will be re-read again unless they
... | [
"def",
"refresh",
"file_size",
"=",
"@f",
".",
"size",
"clear_index_files",
"@progressmeter",
".",
"start",
"(",
"'Converting objects to new storage format'",
",",
"@f",
".",
"size",
")",
"do",
"|",
"pm",
"|",
"each_blob_header",
"do",
"|",
"header",
"|",
"if",
... | This method iterates over all entries in the FlatFile and removes the
entry and inserts it again. This is useful to update all entries in
case the storage format has changed. | [
"This",
"method",
"iterates",
"over",
"all",
"entries",
"in",
"the",
"FlatFile",
"and",
"removes",
"the",
"entry",
"and",
"inserts",
"it",
"again",
".",
"This",
"is",
"useful",
"to",
"update",
"all",
"entries",
"in",
"case",
"the",
"storage",
"format",
"ha... | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/FlatFile.rb#L407-L442 | train |
scrapper/perobs | lib/perobs/FlatFile.rb | PEROBS.FlatFile.regenerate_index_and_spaces | def regenerate_index_and_spaces
PEROBS.log.warn "Re-generating FlatFileDB index and space files"
@index.open unless @index.is_open?
@index.clear
@space_list.open unless @space_list.is_open?
@space_list.clear
@progressmeter.start('Re-generating database index', @f.size) do |pm|
... | ruby | def regenerate_index_and_spaces
PEROBS.log.warn "Re-generating FlatFileDB index and space files"
@index.open unless @index.is_open?
@index.clear
@space_list.open unless @space_list.is_open?
@space_list.clear
@progressmeter.start('Re-generating database index', @f.size) do |pm|
... | [
"def",
"regenerate_index_and_spaces",
"PEROBS",
".",
"log",
".",
"warn",
"\"Re-generating FlatFileDB index and space files\"",
"@index",
".",
"open",
"unless",
"@index",
".",
"is_open?",
"@index",
".",
"clear",
"@space_list",
".",
"open",
"unless",
"@space_list",
".",
... | This method clears the index tree and the free space list and
regenerates them from the FlatFile. | [
"This",
"method",
"clears",
"the",
"index",
"tree",
"and",
"the",
"free",
"space",
"list",
"and",
"regenerates",
"them",
"from",
"the",
"FlatFile",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/FlatFile.rb#L580-L612 | train |
notonthehighstreet/chicago | lib/chicago/rake_tasks.rb | Chicago.RakeTasks.define | def define
namespace :db do
desc "Write Null dimension records"
task :create_null_records do
# TODO: replace this with proper logging.
warn "Loading NULL records."
@schema.dimensions.each do |dimension|
dimension.create_null_records(@staging_db)
... | ruby | def define
namespace :db do
desc "Write Null dimension records"
task :create_null_records do
# TODO: replace this with proper logging.
warn "Loading NULL records."
@schema.dimensions.each do |dimension|
dimension.create_null_records(@staging_db)
... | [
"def",
"define",
"namespace",
":db",
"do",
"desc",
"\"Write Null dimension records\"",
"task",
":create_null_records",
"do",
"warn",
"\"Loading NULL records.\"",
"@schema",
".",
"dimensions",
".",
"each",
"do",
"|",
"dimension",
"|",
"dimension",
".",
"create_null_recor... | Defines the rake tasks.
@api private | [
"Defines",
"the",
"rake",
"tasks",
"."
] | 428e94f8089d2f36fdcff2e27ea2af572b816def | https://github.com/notonthehighstreet/chicago/blob/428e94f8089d2f36fdcff2e27ea2af572b816def/lib/chicago/rake_tasks.rb#L35-L58 | train |
scrapper/perobs | lib/perobs/LockFile.rb | PEROBS.LockFile.lock | def lock
retries = @max_retries
while retries > 0
begin
@file = File.open(@file_name, File::RDWR | File::CREAT, 0644)
@file.sync = true
if @file.flock(File::LOCK_EX | File::LOCK_NB)
# We have taken the lock. Write the PID into the file and leave it
... | ruby | def lock
retries = @max_retries
while retries > 0
begin
@file = File.open(@file_name, File::RDWR | File::CREAT, 0644)
@file.sync = true
if @file.flock(File::LOCK_EX | File::LOCK_NB)
# We have taken the lock. Write the PID into the file and leave it
... | [
"def",
"lock",
"retries",
"=",
"@max_retries",
"while",
"retries",
">",
"0",
"begin",
"@file",
"=",
"File",
".",
"open",
"(",
"@file_name",
",",
"File",
"::",
"RDWR",
"|",
"File",
"::",
"CREAT",
",",
"0644",
")",
"@file",
".",
"sync",
"=",
"true",
"i... | Create a new lock for the given file.
@param file_name [String] file name of the lock file
@param options [Hash] See case statement
Attempt to take the lock.
@return [Boolean] true if lock was taken, false otherwise | [
"Create",
"a",
"new",
"lock",
"for",
"the",
"given",
"file",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/LockFile.rb#L68-L117 | train |
scrapper/perobs | lib/perobs/LockFile.rb | PEROBS.LockFile.unlock | def unlock
unless @file
PEROBS.log.error "There is no current lock to release"
return false
end
begin
@file.flock(File::LOCK_UN)
@file.fsync
@file.close
forced_unlock
PEROBS.log.debug "Lock file #{@file_name} for PID #{$$} has been " +
... | ruby | def unlock
unless @file
PEROBS.log.error "There is no current lock to release"
return false
end
begin
@file.flock(File::LOCK_UN)
@file.fsync
@file.close
forced_unlock
PEROBS.log.debug "Lock file #{@file_name} for PID #{$$} has been " +
... | [
"def",
"unlock",
"unless",
"@file",
"PEROBS",
".",
"log",
".",
"error",
"\"There is no current lock to release\"",
"return",
"false",
"end",
"begin",
"@file",
".",
"flock",
"(",
"File",
"::",
"LOCK_UN",
")",
"@file",
".",
"fsync",
"@file",
".",
"close",
"force... | Release the lock again. | [
"Release",
"the",
"lock",
"again",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/LockFile.rb#L126-L146 | train |
scrapper/perobs | lib/perobs/LockFile.rb | PEROBS.LockFile.forced_unlock | def forced_unlock
@file = nil
if File.exist?(@file_name)
begin
File.delete(@file_name)
PEROBS.log.debug "Lock file #{@file_name} has been deleted."
rescue IOError => e
PEROBS.log.error "Cannot delete lock file #{@file_name}: " +
e.message
end... | ruby | def forced_unlock
@file = nil
if File.exist?(@file_name)
begin
File.delete(@file_name)
PEROBS.log.debug "Lock file #{@file_name} has been deleted."
rescue IOError => e
PEROBS.log.error "Cannot delete lock file #{@file_name}: " +
e.message
end... | [
"def",
"forced_unlock",
"@file",
"=",
"nil",
"if",
"File",
".",
"exist?",
"(",
"@file_name",
")",
"begin",
"File",
".",
"delete",
"(",
"@file_name",
")",
"PEROBS",
".",
"log",
".",
"debug",
"\"Lock file #{@file_name} has been deleted.\"",
"rescue",
"IOError",
"=... | Erase the lock file. It's essentially a forced unlock method. | [
"Erase",
"the",
"lock",
"file",
".",
"It",
"s",
"essentially",
"a",
"forced",
"unlock",
"method",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/LockFile.rb#L149-L160 | train |
mreq/wmctile | lib/wmctile/router.rb | Wmctile.Router.window | def window(index = 0)
if @arguments[:use_active_window]
Window.new(@arguments, Wmctile.current_window_id)
else
Window.new(@arguments, @window_strings[index])
end
rescue Errors::WindowNotFound
if @arguments[:exec]
# Exec the command
puts "Executing command: #{@... | ruby | def window(index = 0)
if @arguments[:use_active_window]
Window.new(@arguments, Wmctile.current_window_id)
else
Window.new(@arguments, @window_strings[index])
end
rescue Errors::WindowNotFound
if @arguments[:exec]
# Exec the command
puts "Executing command: #{@... | [
"def",
"window",
"(",
"index",
"=",
"0",
")",
"if",
"@arguments",
"[",
":use_active_window",
"]",
"Window",
".",
"new",
"(",
"@arguments",
",",
"Wmctile",
".",
"current_window_id",
")",
"else",
"Window",
".",
"new",
"(",
"@arguments",
",",
"@window_strings",... | Starts wmctile, runs the required methods.
@param [Hash] command line options
@param [Array] window_strings ARGV array
Creates a new window based on @arguments and @window_strings.
If no window is found, checks for the -x/--exec argument. If present, executes it.
If there's no -x command and a window is not fou... | [
"Starts",
"wmctile",
"runs",
"the",
"required",
"methods",
"."
] | a41af5afa310b09c8ba1bd45a134b9b2a87d1a35 | https://github.com/mreq/wmctile/blob/a41af5afa310b09c8ba1bd45a134b9b2a87d1a35/lib/wmctile/router.rb#L55-L69 | train |
mreq/wmctile | lib/wmctile/router.rb | Wmctile.Router.switch_to_workspace | def switch_to_workspace(target_workspace)
if target_workspace == 'next'
target_workspace = Wmctile.current_workspace + 1
elsif target_workspace == 'previous'
target_workspace = Wmctile.current_workspace - 1
elsif target_workspace == 'history'
# must be -2 as -1 is the current w... | ruby | def switch_to_workspace(target_workspace)
if target_workspace == 'next'
target_workspace = Wmctile.current_workspace + 1
elsif target_workspace == 'previous'
target_workspace = Wmctile.current_workspace - 1
elsif target_workspace == 'history'
# must be -2 as -1 is the current w... | [
"def",
"switch_to_workspace",
"(",
"target_workspace",
")",
"if",
"target_workspace",
"==",
"'next'",
"target_workspace",
"=",
"Wmctile",
".",
"current_workspace",
"+",
"1",
"elsif",
"target_workspace",
"==",
"'previous'",
"target_workspace",
"=",
"Wmctile",
".",
"cur... | Switch to target_workspace.
@param [String] target_workspace Target workspace index or "next"/"previous".
@return [Integer] Target workspace number | [
"Switch",
"to",
"target_workspace",
"."
] | a41af5afa310b09c8ba1bd45a134b9b2a87d1a35 | https://github.com/mreq/wmctile/blob/a41af5afa310b09c8ba1bd45a134b9b2a87d1a35/lib/wmctile/router.rb#L78-L89 | train |
ghempton/state_manager | lib/state_manager/base.rb | StateManager.Base.transition_to | def transition_to(path, current_state=self.current_state)
path = path.to_s
state = current_state || self
exit_states = []
# Find the nearest parent state on the path of the current state which
# has a sub-state at the given path
new_states = state.find_states(path)
while(!new_... | ruby | def transition_to(path, current_state=self.current_state)
path = path.to_s
state = current_state || self
exit_states = []
# Find the nearest parent state on the path of the current state which
# has a sub-state at the given path
new_states = state.find_states(path)
while(!new_... | [
"def",
"transition_to",
"(",
"path",
",",
"current_state",
"=",
"self",
".",
"current_state",
")",
"path",
"=",
"path",
".",
"to_s",
"state",
"=",
"current_state",
"||",
"self",
"exit_states",
"=",
"[",
"]",
"new_states",
"=",
"state",
".",
"find_states",
... | Transitions to the state at the specified path. The path can be relative
to any state along the current state's path. | [
"Transitions",
"to",
"the",
"state",
"at",
"the",
"specified",
"path",
".",
"The",
"path",
"can",
"be",
"relative",
"to",
"any",
"state",
"along",
"the",
"current",
"state",
"s",
"path",
"."
] | 0e10fbb3c4b7718aa6602e240f4d8adf9cd72008 | https://github.com/ghempton/state_manager/blob/0e10fbb3c4b7718aa6602e240f4d8adf9cd72008/lib/state_manager/base.rb#L38-L74 | train |
ghempton/state_manager | lib/state_manager/base.rb | StateManager.Base.available_events | def available_events
state = current_state
ret = {}
while(state) do
ret = state.class.specification.events.merge(ret)
state = state.parent_state
end
ret
end | ruby | def available_events
state = current_state
ret = {}
while(state) do
ret = state.class.specification.events.merge(ret)
state = state.parent_state
end
ret
end | [
"def",
"available_events",
"state",
"=",
"current_state",
"ret",
"=",
"{",
"}",
"while",
"(",
"state",
")",
"do",
"ret",
"=",
"state",
".",
"class",
".",
"specification",
".",
"events",
".",
"merge",
"(",
"ret",
")",
"state",
"=",
"state",
".",
"parent... | All events the current state will respond to | [
"All",
"events",
"the",
"current",
"state",
"will",
"respond",
"to"
] | 0e10fbb3c4b7718aa6602e240f4d8adf9cd72008 | https://github.com/ghempton/state_manager/blob/0e10fbb3c4b7718aa6602e240f4d8adf9cd72008/lib/state_manager/base.rb#L165-L173 | train |
tagoh/ruby-bugzilla | lib/bugzilla/product.rb | Bugzilla.Product.enterable_products | def enterable_products
ids = get_enterable_products
Hash[*get(ids)['products'].map {|x| [x['name'], x]}.flatten]
end | ruby | def enterable_products
ids = get_enterable_products
Hash[*get(ids)['products'].map {|x| [x['name'], x]}.flatten]
end | [
"def",
"enterable_products",
"ids",
"=",
"get_enterable_products",
"Hash",
"[",
"*",
"get",
"(",
"ids",
")",
"[",
"'products'",
"]",
".",
"map",
"{",
"|",
"x",
"|",
"[",
"x",
"[",
"'name'",
"]",
",",
"x",
"]",
"}",
".",
"flatten",
"]",
"end"
] | def selectable_products
=begin rdoc
==== Bugzilla::Product#enterable_products
Returns Hash table for the products information that the user
can enter bugs against. the Hash key is the product name and
containing a Hash table which contains id, name, description,
is_active, default_milestone, has_uncomfirmed, classifi... | [
"def",
"selectable_products",
"=",
"begin",
"rdoc"
] | 5aabec1b045473bcd6e6ac7427b68adb3e3b4886 | https://github.com/tagoh/ruby-bugzilla/blob/5aabec1b045473bcd6e6ac7427b68adb3e3b4886/lib/bugzilla/product.rb#L69-L72 | train |
tagoh/ruby-bugzilla | lib/bugzilla/product.rb | Bugzilla.Product.accessible_products | def accessible_products
ids = get_accessible_products
Hash[*get(ids)['products'].map {|x| [x['name'], x]}.flatten]
end | ruby | def accessible_products
ids = get_accessible_products
Hash[*get(ids)['products'].map {|x| [x['name'], x]}.flatten]
end | [
"def",
"accessible_products",
"ids",
"=",
"get_accessible_products",
"Hash",
"[",
"*",
"get",
"(",
"ids",
")",
"[",
"'products'",
"]",
".",
"map",
"{",
"|",
"x",
"|",
"[",
"x",
"[",
"'name'",
"]",
",",
"x",
"]",
"}",
".",
"flatten",
"]",
"end"
] | def enterable_products
=begin rdoc
==== Bugzilla::Product#accessible_products
Returns Hash table for the products information that the user
can search or enter bugs against. the Hash key is the product
name and containing a Hash table which contains id, name, description,
is_active, default_milestone, has_uncomfirmed... | [
"def",
"enterable_products",
"=",
"begin",
"rdoc"
] | 5aabec1b045473bcd6e6ac7427b68adb3e3b4886 | https://github.com/tagoh/ruby-bugzilla/blob/5aabec1b045473bcd6e6ac7427b68adb3e3b4886/lib/bugzilla/product.rb#L88-L91 | train |
scrapper/perobs | lib/perobs/FlatFileDB.rb | PEROBS.FlatFileDB.put_hash | def put_hash(name, hash)
file_name = File.join(@db_dir, name + '.json')
begin
RobustFile.write(file_name, hash.to_json)
rescue IOError => e
PEROBS.log.fatal "Cannot write hash file '#{file_name}': #{e.message}"
end
end | ruby | def put_hash(name, hash)
file_name = File.join(@db_dir, name + '.json')
begin
RobustFile.write(file_name, hash.to_json)
rescue IOError => e
PEROBS.log.fatal "Cannot write hash file '#{file_name}': #{e.message}"
end
end | [
"def",
"put_hash",
"(",
"name",
",",
"hash",
")",
"file_name",
"=",
"File",
".",
"join",
"(",
"@db_dir",
",",
"name",
"+",
"'.json'",
")",
"begin",
"RobustFile",
".",
"write",
"(",
"file_name",
",",
"hash",
".",
"to_json",
")",
"rescue",
"IOError",
"=>... | Store a simple Hash as a JSON encoded file into the DB directory.
@param name [String] Name of the hash. Will be used as file name.
@param hash [Hash] A Hash that maps String objects to strings or
numbers. | [
"Store",
"a",
"simple",
"Hash",
"as",
"a",
"JSON",
"encoded",
"file",
"into",
"the",
"DB",
"directory",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/FlatFileDB.rb#L109-L116 | train |
danielpclark/PolyBelongsTo | lib/poly_belongs_to/core.rb | PolyBelongsTo.Core.pbt_parent | def pbt_parent
val = pbt
if val && !pbt_id.nil?
if poly?
"#{pbt_type}".constantize.where(id: pbt_id).first
else
"#{val}".camelize.constantize.where(id: pbt_id).first
end
end
end | ruby | def pbt_parent
val = pbt
if val && !pbt_id.nil?
if poly?
"#{pbt_type}".constantize.where(id: pbt_id).first
else
"#{val}".camelize.constantize.where(id: pbt_id).first
end
end
end | [
"def",
"pbt_parent",
"val",
"=",
"pbt",
"if",
"val",
"&&",
"!",
"pbt_id",
".",
"nil?",
"if",
"poly?",
"\"#{pbt_type}\"",
".",
"constantize",
".",
"where",
"(",
"id",
":",
"pbt_id",
")",
".",
"first",
"else",
"\"#{val}\"",
".",
"camelize",
".",
"constanti... | Get the parent relation. Polymorphic relations are prioritized first.
@return [Object, nil] ActiveRecord object instasnce | [
"Get",
"the",
"parent",
"relation",
".",
"Polymorphic",
"relations",
"are",
"prioritized",
"first",
"."
] | 38d51d37f9148613519d6b6d56bdf4d0884f0e86 | https://github.com/danielpclark/PolyBelongsTo/blob/38d51d37f9148613519d6b6d56bdf4d0884f0e86/lib/poly_belongs_to/core.rb#L162-L171 | train |
danielpclark/PolyBelongsTo | lib/poly_belongs_to/core.rb | PolyBelongsTo.Core.pbt_top_parent | def pbt_top_parent
record = self
return nil unless record.pbt_parent
no_repeat = PolyBelongsTo::SingletonSet.new
while !no_repeat.include?(record.pbt_parent) && !record.pbt_parent.nil?
no_repeat.add?(record)
record = record.pbt_parent
end
record
end | ruby | def pbt_top_parent
record = self
return nil unless record.pbt_parent
no_repeat = PolyBelongsTo::SingletonSet.new
while !no_repeat.include?(record.pbt_parent) && !record.pbt_parent.nil?
no_repeat.add?(record)
record = record.pbt_parent
end
record
end | [
"def",
"pbt_top_parent",
"record",
"=",
"self",
"return",
"nil",
"unless",
"record",
".",
"pbt_parent",
"no_repeat",
"=",
"PolyBelongsTo",
"::",
"SingletonSet",
".",
"new",
"while",
"!",
"no_repeat",
".",
"include?",
"(",
"record",
".",
"pbt_parent",
")",
"&&"... | Climb up each parent object in the hierarchy until the top is reached.
This has a no-repeat safety built in. Polymorphic parents have priority.
@return [Object, nil] top parent ActiveRecord object instace | [
"Climb",
"up",
"each",
"parent",
"object",
"in",
"the",
"hierarchy",
"until",
"the",
"top",
"is",
"reached",
".",
"This",
"has",
"a",
"no",
"-",
"repeat",
"safety",
"built",
"in",
".",
"Polymorphic",
"parents",
"have",
"priority",
"."
] | 38d51d37f9148613519d6b6d56bdf4d0884f0e86 | https://github.com/danielpclark/PolyBelongsTo/blob/38d51d37f9148613519d6b6d56bdf4d0884f0e86/lib/poly_belongs_to/core.rb#L176-L185 | train |
danielpclark/PolyBelongsTo | lib/poly_belongs_to/core.rb | PolyBelongsTo.Core.pbt_parents | def pbt_parents
if poly?
Array[pbt_parent].compact
else
self.class.pbts.map do |i|
try{ "#{i}".camelize.constantize.where(id: send("#{i}_id")).first }
end.compact
end
end | ruby | def pbt_parents
if poly?
Array[pbt_parent].compact
else
self.class.pbts.map do |i|
try{ "#{i}".camelize.constantize.where(id: send("#{i}_id")).first }
end.compact
end
end | [
"def",
"pbt_parents",
"if",
"poly?",
"Array",
"[",
"pbt_parent",
"]",
".",
"compact",
"else",
"self",
".",
"class",
".",
"pbts",
".",
"map",
"do",
"|",
"i",
"|",
"try",
"{",
"\"#{i}\"",
".",
"camelize",
".",
"constantize",
".",
"where",
"(",
"id",
":... | All belongs_to parents as class objects. One if polymorphic.
@return [Array<Object>] ActiveRecord classes of parent objects. | [
"All",
"belongs_to",
"parents",
"as",
"class",
"objects",
".",
"One",
"if",
"polymorphic",
"."
] | 38d51d37f9148613519d6b6d56bdf4d0884f0e86 | https://github.com/danielpclark/PolyBelongsTo/blob/38d51d37f9148613519d6b6d56bdf4d0884f0e86/lib/poly_belongs_to/core.rb#L189-L197 | train |
PublicHealthEngland/ndr_support | lib/ndr_support/password.rb | NdrSupport.Password.valid? | def valid?(string, word_list: [])
string = prepare_string(string.to_s.dup)
slug = slugify(strip_common_words(string, word_list))
meets_requirements?(slug)
end | ruby | def valid?(string, word_list: [])
string = prepare_string(string.to_s.dup)
slug = slugify(strip_common_words(string, word_list))
meets_requirements?(slug)
end | [
"def",
"valid?",
"(",
"string",
",",
"word_list",
":",
"[",
"]",
")",
"string",
"=",
"prepare_string",
"(",
"string",
".",
"to_s",
".",
"dup",
")",
"slug",
"=",
"slugify",
"(",
"strip_common_words",
"(",
"string",
",",
"word_list",
")",
")",
"meets_requi... | Is the given `string` deemed a good password?
An additional `word_list` can be provided; its entries add only
minimally when considering the strength of `string`.
NdrSupport::Password.valid?('google password') #=> false
NdrSupport::Password.valid?(SecureRandom.hex(12)) #=> true | [
"Is",
"the",
"given",
"string",
"deemed",
"a",
"good",
"password?",
"An",
"additional",
"word_list",
"can",
"be",
"provided",
";",
"its",
"entries",
"add",
"only",
"minimally",
"when",
"considering",
"the",
"strength",
"of",
"string",
"."
] | 6daf98ca972e79de1c8457eb720f058b03ead21c | https://github.com/PublicHealthEngland/ndr_support/blob/6daf98ca972e79de1c8457eb720f058b03ead21c/lib/ndr_support/password.rb#L18-L23 | train |
xinminlabs/synvert-core | lib/synvert/core/rewriter.rb | Synvert::Core.Rewriter.add_file | def add_file(filename, content)
return if @sandbox
filepath = File.join(Configuration.instance.get(:path), filename)
if File.exist?(filepath)
puts "File #{filepath} already exists."
return
end
FileUtils.mkdir_p File.dirname(filepath)
File.open filepath, 'w' do |file... | ruby | def add_file(filename, content)
return if @sandbox
filepath = File.join(Configuration.instance.get(:path), filename)
if File.exist?(filepath)
puts "File #{filepath} already exists."
return
end
FileUtils.mkdir_p File.dirname(filepath)
File.open filepath, 'w' do |file... | [
"def",
"add_file",
"(",
"filename",
",",
"content",
")",
"return",
"if",
"@sandbox",
"filepath",
"=",
"File",
".",
"join",
"(",
"Configuration",
".",
"instance",
".",
"get",
"(",
":path",
")",
",",
"filename",
")",
"if",
"File",
".",
"exist?",
"(",
"fi... | Parses add_file dsl, it adds a new file.
@param filename [String] file name of newly created file.
@param content [String] file body of newly created file. | [
"Parses",
"add_file",
"dsl",
"it",
"adds",
"a",
"new",
"file",
"."
] | a490bfd30eaec81002d10f8fb61b49138708e46c | https://github.com/xinminlabs/synvert-core/blob/a490bfd30eaec81002d10f8fb61b49138708e46c/lib/synvert/core/rewriter.rb#L227-L240 | train |
xinminlabs/synvert-core | lib/synvert/core/rewriter.rb | Synvert::Core.Rewriter.remove_file | def remove_file(filename)
return if @sandbox
file_path = File.join(Configuration.instance.get(:path), filename)
File.delete(file_path) if File.exist?(file_path)
end | ruby | def remove_file(filename)
return if @sandbox
file_path = File.join(Configuration.instance.get(:path), filename)
File.delete(file_path) if File.exist?(file_path)
end | [
"def",
"remove_file",
"(",
"filename",
")",
"return",
"if",
"@sandbox",
"file_path",
"=",
"File",
".",
"join",
"(",
"Configuration",
".",
"instance",
".",
"get",
"(",
":path",
")",
",",
"filename",
")",
"File",
".",
"delete",
"(",
"file_path",
")",
"if",... | Parses remove_file dsl, it removes a file.
@param filename [String] file name. | [
"Parses",
"remove_file",
"dsl",
"it",
"removes",
"a",
"file",
"."
] | a490bfd30eaec81002d10f8fb61b49138708e46c | https://github.com/xinminlabs/synvert-core/blob/a490bfd30eaec81002d10f8fb61b49138708e46c/lib/synvert/core/rewriter.rb#L245-L250 | train |
Absolight/epp-client | lib/epp-client/connection.rb | EPPClient.Connection.open_connection | def open_connection
@tcpserver = TCPSocket.new(server, port)
@socket = OpenSSL::SSL::SSLSocket.new(@tcpserver, @context)
# Synchronously close the connection & socket
@socket.sync_close
# Connect
@socket.connect
# Get the initial greeting frame
greeting_process(one_fra... | ruby | def open_connection
@tcpserver = TCPSocket.new(server, port)
@socket = OpenSSL::SSL::SSLSocket.new(@tcpserver, @context)
# Synchronously close the connection & socket
@socket.sync_close
# Connect
@socket.connect
# Get the initial greeting frame
greeting_process(one_fra... | [
"def",
"open_connection",
"@tcpserver",
"=",
"TCPSocket",
".",
"new",
"(",
"server",
",",
"port",
")",
"@socket",
"=",
"OpenSSL",
"::",
"SSL",
"::",
"SSLSocket",
".",
"new",
"(",
"@tcpserver",
",",
"@context",
")",
"@socket",
".",
"sync_close",
"@socket",
... | Establishes the connection to the server, if successful, will return the
greeting frame. | [
"Establishes",
"the",
"connection",
"to",
"the",
"server",
"if",
"successful",
"will",
"return",
"the",
"greeting",
"frame",
"."
] | c0025daee5e7087f60b654595a8e7d92e966c54e | https://github.com/Absolight/epp-client/blob/c0025daee5e7087f60b654595a8e7d92e966c54e/lib/epp-client/connection.rb#L8-L20 | train |
Absolight/epp-client | lib/epp-client/connection.rb | EPPClient.Connection.close_connection | def close_connection
if defined?(@socket) && @socket.is_a?(OpenSSL::SSL::SSLSocket)
@socket.close
@socket = nil
end
if defined?(@tcpserver) && @tcpserver.is_a?(TCPSocket)
@tcpserver.close
@tcpserver = nil
end
return true if @tcpserver.nil? && @socket.nil?
... | ruby | def close_connection
if defined?(@socket) && @socket.is_a?(OpenSSL::SSL::SSLSocket)
@socket.close
@socket = nil
end
if defined?(@tcpserver) && @tcpserver.is_a?(TCPSocket)
@tcpserver.close
@tcpserver = nil
end
return true if @tcpserver.nil? && @socket.nil?
... | [
"def",
"close_connection",
"if",
"defined?",
"(",
"@socket",
")",
"&&",
"@socket",
".",
"is_a?",
"(",
"OpenSSL",
"::",
"SSL",
"::",
"SSLSocket",
")",
"@socket",
".",
"close",
"@socket",
"=",
"nil",
"end",
"if",
"defined?",
"(",
"@tcpserver",
")",
"&&",
"... | Gracefully close the connection | [
"Gracefully",
"close",
"the",
"connection"
] | c0025daee5e7087f60b654595a8e7d92e966c54e | https://github.com/Absolight/epp-client/blob/c0025daee5e7087f60b654595a8e7d92e966c54e/lib/epp-client/connection.rb#L34-L46 | train |
Absolight/epp-client | lib/epp-client/connection.rb | EPPClient.Connection.one_frame | def one_frame
size = @socket.read(4)
raise SocketError, @socket.eof? ? 'Connection closed by remote server' : 'Error reading frame from remote server' if size.nil?
size = size.unpack('N')[0]
@recv_frame = @socket.read(size - 4)
recv_frame_to_xml
end | ruby | def one_frame
size = @socket.read(4)
raise SocketError, @socket.eof? ? 'Connection closed by remote server' : 'Error reading frame from remote server' if size.nil?
size = size.unpack('N')[0]
@recv_frame = @socket.read(size - 4)
recv_frame_to_xml
end | [
"def",
"one_frame",
"size",
"=",
"@socket",
".",
"read",
"(",
"4",
")",
"raise",
"SocketError",
",",
"@socket",
".",
"eof?",
"?",
"'Connection closed by remote server'",
":",
"'Error reading frame from remote server'",
"if",
"size",
".",
"nil?",
"size",
"=",
"size... | gets a frame from the socket and returns the parsed response. | [
"gets",
"a",
"frame",
"from",
"the",
"socket",
"and",
"returns",
"the",
"parsed",
"response",
"."
] | c0025daee5e7087f60b654595a8e7d92e966c54e | https://github.com/Absolight/epp-client/blob/c0025daee5e7087f60b654595a8e7d92e966c54e/lib/epp-client/connection.rb#L62-L68 | train |
iconara/snogmetrics | lib/snogmetrics/kissmetrics_api.rb | Snogmetrics.KissmetricsApi.identify | def identify(identity)
unless @session[:km_identity] == identity
queue.delete_if { |e| e.first == 'identify' }
queue << ['identify', identity]
@session[:km_identity] = identity
end
end | ruby | def identify(identity)
unless @session[:km_identity] == identity
queue.delete_if { |e| e.first == 'identify' }
queue << ['identify', identity]
@session[:km_identity] = identity
end
end | [
"def",
"identify",
"(",
"identity",
")",
"unless",
"@session",
"[",
":km_identity",
"]",
"==",
"identity",
"queue",
".",
"delete_if",
"{",
"|",
"e",
"|",
"e",
".",
"first",
"==",
"'identify'",
"}",
"queue",
"<<",
"[",
"'identify'",
",",
"identity",
"]",
... | The equivalent of the `KM.identify` method of the JavaScript API. | [
"The",
"equivalent",
"of",
"the",
"KM",
".",
"identify",
"method",
"of",
"the",
"JavaScript",
"API",
"."
] | 1742fb77dee1378934fbad8b78790f59bff20c35 | https://github.com/iconara/snogmetrics/blob/1742fb77dee1378934fbad8b78790f59bff20c35/lib/snogmetrics/kissmetrics_api.rb#L22-L28 | train |
bratta/googlevoiceapi | lib/googlevoiceapi.rb | GoogleVoice.Api.sms | def sms(remote_number, text_message)
login unless logged_in?
remote_number = validate_number(remote_number)
text_message = @coder.encode(text_message)
@agent.post('https://www.google.com/voice/sms/send/', :id => '', :phoneNumber => remote_number, :text => text_message, "_rnr_se" => @rnr_se)
... | ruby | def sms(remote_number, text_message)
login unless logged_in?
remote_number = validate_number(remote_number)
text_message = @coder.encode(text_message)
@agent.post('https://www.google.com/voice/sms/send/', :id => '', :phoneNumber => remote_number, :text => text_message, "_rnr_se" => @rnr_se)
... | [
"def",
"sms",
"(",
"remote_number",
",",
"text_message",
")",
"login",
"unless",
"logged_in?",
"remote_number",
"=",
"validate_number",
"(",
"remote_number",
")",
"text_message",
"=",
"@coder",
".",
"encode",
"(",
"text_message",
")",
"@agent",
".",
"post",
"(",... | Send a text message to remote_number | [
"Send",
"a",
"text",
"message",
"to",
"remote_number"
] | 5d6163209bda665ba0cd7bbe723e59f6f7085705 | https://github.com/bratta/googlevoiceapi/blob/5d6163209bda665ba0cd7bbe723e59f6f7085705/lib/googlevoiceapi.rb#L56-L61 | train |
bratta/googlevoiceapi | lib/googlevoiceapi.rb | GoogleVoice.Api.call | def call(remote_number, forwarding_number)
login unless logged_in?
remote_number = validate_number(remote_number)
forwarding_number = validate_number(forwarding_number)
@agent.post('https://www.google.com/voice/call/connect/', :outgoingNumber => remote_number, :forwardingNumber => forwarding_num... | ruby | def call(remote_number, forwarding_number)
login unless logged_in?
remote_number = validate_number(remote_number)
forwarding_number = validate_number(forwarding_number)
@agent.post('https://www.google.com/voice/call/connect/', :outgoingNumber => remote_number, :forwardingNumber => forwarding_num... | [
"def",
"call",
"(",
"remote_number",
",",
"forwarding_number",
")",
"login",
"unless",
"logged_in?",
"remote_number",
"=",
"validate_number",
"(",
"remote_number",
")",
"forwarding_number",
"=",
"validate_number",
"(",
"forwarding_number",
")",
"@agent",
".",
"post",
... | Place a call to remote_number, and ring back forwarding_number which
should be set up on the currently logged in Google Voice account | [
"Place",
"a",
"call",
"to",
"remote_number",
"and",
"ring",
"back",
"forwarding_number",
"which",
"should",
"be",
"set",
"up",
"on",
"the",
"currently",
"logged",
"in",
"Google",
"Voice",
"account"
] | 5d6163209bda665ba0cd7bbe723e59f6f7085705 | https://github.com/bratta/googlevoiceapi/blob/5d6163209bda665ba0cd7bbe723e59f6f7085705/lib/googlevoiceapi.rb#L65-L70 | train |
bratta/googlevoiceapi | lib/googlevoiceapi.rb | GoogleVoice.Api.init_xml_methods | def init_xml_methods()
(class << self; self; end).class_eval do
%w{ unread inbox starred all spam trash voicemail sms trash recorded placed received missed }.each do |method|
define_method "#{method}_xml".to_sym do
get_xml_document("https://www.google.com/voice/inbox/recent/#{method}... | ruby | def init_xml_methods()
(class << self; self; end).class_eval do
%w{ unread inbox starred all spam trash voicemail sms trash recorded placed received missed }.each do |method|
define_method "#{method}_xml".to_sym do
get_xml_document("https://www.google.com/voice/inbox/recent/#{method}... | [
"def",
"init_xml_methods",
"(",
")",
"(",
"class",
"<<",
"self",
";",
"self",
";",
"end",
")",
".",
"class_eval",
"do",
"%w{",
"unread",
"inbox",
"starred",
"all",
"spam",
"trash",
"voicemail",
"sms",
"trash",
"recorded",
"placed",
"received",
"missed",
"}... | Google provides XML data for various call histories all with the same
URL pattern in a getful manner. So here we're just dynamically creating
methods to fetch that data in a DRY-manner. Yes, define_method is slow,
but we're already making web calls which drags performance down anyway
so it shouldn't matter in the l... | [
"Google",
"provides",
"XML",
"data",
"for",
"various",
"call",
"histories",
"all",
"with",
"the",
"same",
"URL",
"pattern",
"in",
"a",
"getful",
"manner",
".",
"So",
"here",
"we",
"re",
"just",
"dynamically",
"creating",
"methods",
"to",
"fetch",
"that",
"... | 5d6163209bda665ba0cd7bbe723e59f6f7085705 | https://github.com/bratta/googlevoiceapi/blob/5d6163209bda665ba0cd7bbe723e59f6f7085705/lib/googlevoiceapi.rb#L104-L112 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.setHTTPConnection | def setHTTPConnection( useSSL, org = "www", domain = "quickbase", proxy_options = nil )
@useSSL = useSSL
@org = org
@domain = domain
if USING_HTTPCLIENT
if proxy_options
@httpConnection = HTTPClient.new( "#{proxy_options["proxy_server"]}:#{proxy_options["proxy_port"] || ... | ruby | def setHTTPConnection( useSSL, org = "www", domain = "quickbase", proxy_options = nil )
@useSSL = useSSL
@org = org
@domain = domain
if USING_HTTPCLIENT
if proxy_options
@httpConnection = HTTPClient.new( "#{proxy_options["proxy_server"]}:#{proxy_options["proxy_port"] || ... | [
"def",
"setHTTPConnection",
"(",
"useSSL",
",",
"org",
"=",
"\"www\"",
",",
"domain",
"=",
"\"quickbase\"",
",",
"proxy_options",
"=",
"nil",
")",
"@useSSL",
"=",
"useSSL",
"@org",
"=",
"org",
"@domain",
"=",
"domain",
"if",
"USING_HTTPCLIENT",
"if",
"proxy_... | Initializes the connection to QuickBase. | [
"Initializes",
"the",
"connection",
"to",
"QuickBase",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L153-L174 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.setHTTPConnectionAndqbhost | def setHTTPConnectionAndqbhost( useSSL, org = "www", domain = "quickbase", proxy_options = nil )
setHTTPConnection( useSSL, org, domain, proxy_options )
setqbhost( useSSL, org, domain )
end | ruby | def setHTTPConnectionAndqbhost( useSSL, org = "www", domain = "quickbase", proxy_options = nil )
setHTTPConnection( useSSL, org, domain, proxy_options )
setqbhost( useSSL, org, domain )
end | [
"def",
"setHTTPConnectionAndqbhost",
"(",
"useSSL",
",",
"org",
"=",
"\"www\"",
",",
"domain",
"=",
"\"quickbase\"",
",",
"proxy_options",
"=",
"nil",
")",
"setHTTPConnection",
"(",
"useSSL",
",",
"org",
",",
"domain",
",",
"proxy_options",
")",
"setqbhost",
"... | Initializes the connection to QuickBase and sets the QuickBase URL and port to use for requests. | [
"Initializes",
"the",
"connection",
"to",
"QuickBase",
"and",
"sets",
"the",
"QuickBase",
"URL",
"and",
"port",
"to",
"use",
"for",
"requests",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L191-L194 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.sendRequest | def sendRequest( api_Request, xmlRequestData = nil )
fire( "onSendRequest" )
resetErrorInfo
# set up the request
getDBforRequestURL( api_Request )
getAuthenticationXMLforRequest( api_Request )
isHTMLRequest = isHTMLRequest?( api_Request )
api_Request = "API_" + api... | ruby | def sendRequest( api_Request, xmlRequestData = nil )
fire( "onSendRequest" )
resetErrorInfo
# set up the request
getDBforRequestURL( api_Request )
getAuthenticationXMLforRequest( api_Request )
isHTMLRequest = isHTMLRequest?( api_Request )
api_Request = "API_" + api... | [
"def",
"sendRequest",
"(",
"api_Request",
",",
"xmlRequestData",
"=",
"nil",
")",
"fire",
"(",
"\"onSendRequest\"",
")",
"resetErrorInfo",
"getDBforRequestURL",
"(",
"api_Request",
")",
"getAuthenticationXMLforRequest",
"(",
"api_Request",
")",
"isHTMLRequest",
"=",
"... | Sends requests to QuickBase and processes the reponses. | [
"Sends",
"requests",
"to",
"QuickBase",
"and",
"processes",
"the",
"reponses",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L203-L276 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.prependAPI? | def prependAPI?( request )
ret = true
ret = false if request.to_s.include?("API_") or request.to_s.include?("QBIS_")
ret
end | ruby | def prependAPI?( request )
ret = true
ret = false if request.to_s.include?("API_") or request.to_s.include?("QBIS_")
ret
end | [
"def",
"prependAPI?",
"(",
"request",
")",
"ret",
"=",
"true",
"ret",
"=",
"false",
"if",
"request",
".",
"to_s",
".",
"include?",
"(",
"\"API_\"",
")",
"or",
"request",
".",
"to_s",
".",
"include?",
"(",
"\"QBIS_\"",
")",
"ret",
"end"
] | Returns whether to prepend 'API_' to request string | [
"Returns",
"whether",
"to",
"prepend",
"API_",
"to",
"request",
"string"
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L319-L323 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.toggleTraceInfo | def toggleTraceInfo( showTrace )
if showTrace
# this will print a very large amount of stuff
set_trace_func proc { |event, file, line, id, binding, classname| printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname }
if block_given?
yield
set_tra... | ruby | def toggleTraceInfo( showTrace )
if showTrace
# this will print a very large amount of stuff
set_trace_func proc { |event, file, line, id, binding, classname| printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname }
if block_given?
yield
set_tra... | [
"def",
"toggleTraceInfo",
"(",
"showTrace",
")",
"if",
"showTrace",
"set_trace_func",
"proc",
"{",
"|",
"event",
",",
"file",
",",
"line",
",",
"id",
",",
"binding",
",",
"classname",
"|",
"printf",
"\"%8s %s:%-2d %10s %8s\\n\"",
",",
"event",
",",
"file",
"... | Turns program stack tracing on or off.
If followed by a block, the tracing will be toggled on or off at the end of the block. | [
"Turns",
"program",
"stack",
"tracing",
"on",
"or",
"off",
".",
"If",
"followed",
"by",
"a",
"block",
"the",
"tracing",
"will",
"be",
"toggled",
"on",
"or",
"off",
"at",
"the",
"end",
"of",
"the",
"block",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L327-L343 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getErrorInfoFromResponse | def getErrorInfoFromResponse
if @responseXMLdoc
errcode = getResponseValue( :errcode )
@errcode = errcode ? errcode : ""
errtext = getResponseValue( :errtext )
@errtext = errtext ? errtext : ""
errdetail = getResponseValue( :errdetail )
@errdetail = err... | ruby | def getErrorInfoFromResponse
if @responseXMLdoc
errcode = getResponseValue( :errcode )
@errcode = errcode ? errcode : ""
errtext = getResponseValue( :errtext )
@errtext = errtext ? errtext : ""
errdetail = getResponseValue( :errdetail )
@errdetail = err... | [
"def",
"getErrorInfoFromResponse",
"if",
"@responseXMLdoc",
"errcode",
"=",
"getResponseValue",
"(",
":errcode",
")",
"@errcode",
"=",
"errcode",
"?",
"errcode",
":",
"\"\"",
"errtext",
"=",
"getResponseValue",
"(",
":errtext",
")",
"@errtext",
"=",
"errtext",
"?"... | Extracts error info from XML responses returned by QuickBase. | [
"Extracts",
"error",
"info",
"from",
"XML",
"responses",
"returned",
"by",
"QuickBase",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L386-L399 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.parseResponseXML | def parseResponseXML( xml )
if xml
xml.gsub!( "\r", "" ) if @ignoreCR and @ignoreCR == true
xml.gsub!( "\n", "" ) if @ignoreLF and @ignoreLF == true
xml.gsub!( "\t", "" ) if @ignoreTAB and @ignoreTAB == true
xml.gsub!( "<BR/>", "<BR/>" ) if @escapeBR
@qdbap... | ruby | def parseResponseXML( xml )
if xml
xml.gsub!( "\r", "" ) if @ignoreCR and @ignoreCR == true
xml.gsub!( "\n", "" ) if @ignoreLF and @ignoreLF == true
xml.gsub!( "\t", "" ) if @ignoreTAB and @ignoreTAB == true
xml.gsub!( "<BR/>", "<BR/>" ) if @escapeBR
@qdbap... | [
"def",
"parseResponseXML",
"(",
"xml",
")",
"if",
"xml",
"xml",
".",
"gsub!",
"(",
"\"\\r\"",
",",
"\"\"",
")",
"if",
"@ignoreCR",
"and",
"@ignoreCR",
"==",
"true",
"xml",
".",
"gsub!",
"(",
"\"\\n\"",
",",
"\"\"",
")",
"if",
"@ignoreLF",
"and",
"@igno... | Called by processResponse to put the XML from QuickBase
into a DOM tree using the REXML module that comes with Ruby. | [
"Called",
"by",
"processResponse",
"to",
"put",
"the",
"XML",
"from",
"QuickBase",
"into",
"a",
"DOM",
"tree",
"using",
"the",
"REXML",
"module",
"that",
"comes",
"with",
"Ruby",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L403-L411 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getResponseValue | def getResponseValue( field )
@fieldValue = nil
if field and @responseXMLdoc
@fieldValue = @responseXMLdoc.root.elements[ field.to_s ]
@fieldValue = fieldValue.text if fieldValue and fieldValue.has_text?
end
@fieldValue
end | ruby | def getResponseValue( field )
@fieldValue = nil
if field and @responseXMLdoc
@fieldValue = @responseXMLdoc.root.elements[ field.to_s ]
@fieldValue = fieldValue.text if fieldValue and fieldValue.has_text?
end
@fieldValue
end | [
"def",
"getResponseValue",
"(",
"field",
")",
"@fieldValue",
"=",
"nil",
"if",
"field",
"and",
"@responseXMLdoc",
"@fieldValue",
"=",
"@responseXMLdoc",
".",
"root",
".",
"elements",
"[",
"field",
".",
"to_s",
"]",
"@fieldValue",
"=",
"fieldValue",
".",
"text"... | Gets the value for a specific field at the top level
of the XML returned from QuickBase. | [
"Gets",
"the",
"value",
"for",
"a",
"specific",
"field",
"at",
"the",
"top",
"level",
"of",
"the",
"XML",
"returned",
"from",
"QuickBase",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L415-L422 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getResponsePathValues | def getResponsePathValues( path )
@fieldValue = ""
e = getResponseElements( path )
e.each{ |e| @fieldValue << e.text if e and e.is_a?( REXML::Element ) and e.has_text? }
@fieldValue
end | ruby | def getResponsePathValues( path )
@fieldValue = ""
e = getResponseElements( path )
e.each{ |e| @fieldValue << e.text if e and e.is_a?( REXML::Element ) and e.has_text? }
@fieldValue
end | [
"def",
"getResponsePathValues",
"(",
"path",
")",
"@fieldValue",
"=",
"\"\"",
"e",
"=",
"getResponseElements",
"(",
"path",
")",
"e",
".",
"each",
"{",
"|",
"e",
"|",
"@fieldValue",
"<<",
"e",
".",
"text",
"if",
"e",
"and",
"e",
".",
"is_a?",
"(",
"R... | Gets an array of values at an Xpath in the XML from QuickBase. | [
"Gets",
"an",
"array",
"of",
"values",
"at",
"an",
"Xpath",
"in",
"the",
"XML",
"from",
"QuickBase",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L435-L440 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getResponsePathValueByDBName | def getResponsePathValueByDBName ( path, dbName)
@fieldValue = ""
if path and @responseXMLdoc
e = @responseXMLdoc.root.elements[ path.to_s ]
end
e.each { |e|
if e and e.is_a?( REXML::Element ) and e.dbinfo.dbname == dbName
return e.dbinfo.dbid
end
... | ruby | def getResponsePathValueByDBName ( path, dbName)
@fieldValue = ""
if path and @responseXMLdoc
e = @responseXMLdoc.root.elements[ path.to_s ]
end
e.each { |e|
if e and e.is_a?( REXML::Element ) and e.dbinfo.dbname == dbName
return e.dbinfo.dbid
end
... | [
"def",
"getResponsePathValueByDBName",
"(",
"path",
",",
"dbName",
")",
"@fieldValue",
"=",
"\"\"",
"if",
"path",
"and",
"@responseXMLdoc",
"e",
"=",
"@responseXMLdoc",
".",
"root",
".",
"elements",
"[",
"path",
".",
"to_s",
"]",
"end",
"e",
".",
"each",
"... | Gets a dbid at an Xpath in the XML from specified dbName of Quickbase | [
"Gets",
"a",
"dbid",
"at",
"an",
"Xpath",
"in",
"the",
"XML",
"from",
"specified",
"dbName",
"of",
"Quickbase"
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L443-L454 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getAttributeString | def getAttributeString( element )
attributes = ""
if element.is_a?( REXML::Element ) and element.has_attributes?
attributes = "("
element.attributes.each { |name,value|
attributes << "#{name}=#{value} "
}
attributes << ")"
end
attributes
... | ruby | def getAttributeString( element )
attributes = ""
if element.is_a?( REXML::Element ) and element.has_attributes?
attributes = "("
element.attributes.each { |name,value|
attributes << "#{name}=#{value} "
}
attributes << ")"
end
attributes
... | [
"def",
"getAttributeString",
"(",
"element",
")",
"attributes",
"=",
"\"\"",
"if",
"element",
".",
"is_a?",
"(",
"REXML",
"::",
"Element",
")",
"and",
"element",
".",
"has_attributes?",
"attributes",
"=",
"\"(\"",
"element",
".",
"attributes",
".",
"each",
"... | Returns a string representation of the attributes of an XML element. | [
"Returns",
"a",
"string",
"representation",
"of",
"the",
"attributes",
"of",
"an",
"XML",
"element",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L472-L482 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.lookupFieldName | def lookupFieldName( element )
name = ""
if element and element.is_a?( REXML::Element )
name = element.name
if element.name == "f" and @fields
fid = element.attributes[ "id" ]
field = lookupField( fid ) if fid
label = field.elements[ "label" ] if ... | ruby | def lookupFieldName( element )
name = ""
if element and element.is_a?( REXML::Element )
name = element.name
if element.name == "f" and @fields
fid = element.attributes[ "id" ]
field = lookupField( fid ) if fid
label = field.elements[ "label" ] if ... | [
"def",
"lookupFieldName",
"(",
"element",
")",
"name",
"=",
"\"\"",
"if",
"element",
"and",
"element",
".",
"is_a?",
"(",
"REXML",
"::",
"Element",
")",
"name",
"=",
"element",
".",
"name",
"if",
"element",
".",
"name",
"==",
"\"f\"",
"and",
"@fields",
... | Returns the name of field given an "fid" XML element. | [
"Returns",
"the",
"name",
"of",
"field",
"given",
"an",
"fid",
"XML",
"element",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L498-L510 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.lookupFieldType | def lookupFieldType( element )
type = ""
if element and element.is_a?( REXML::Element )
if element.name == "f" and @fields
fid = element.attributes[ "id" ]
field = lookupField( fid ) if fid
type = field.attributes[ "field_type" ] if field
end
... | ruby | def lookupFieldType( element )
type = ""
if element and element.is_a?( REXML::Element )
if element.name == "f" and @fields
fid = element.attributes[ "id" ]
field = lookupField( fid ) if fid
type = field.attributes[ "field_type" ] if field
end
... | [
"def",
"lookupFieldType",
"(",
"element",
")",
"type",
"=",
"\"\"",
"if",
"element",
"and",
"element",
".",
"is_a?",
"(",
"REXML",
"::",
"Element",
")",
"if",
"element",
".",
"name",
"==",
"\"f\"",
"and",
"@fields",
"fid",
"=",
"element",
".",
"attribute... | Returns a QuickBase field type, given an XML "fid" element. | [
"Returns",
"a",
"QuickBase",
"field",
"type",
"given",
"an",
"XML",
"fid",
"element",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L513-L523 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.lookupFieldPropertyByName | def lookupFieldPropertyByName( fieldName, property )
theproperty = nil
if isValidFieldProperty?(property)
fid = lookupFieldIDByName( fieldName )
field = lookupField( fid ) if fid
theproperty = field.elements[ property ] if field
theproperty = theproperty.text if the... | ruby | def lookupFieldPropertyByName( fieldName, property )
theproperty = nil
if isValidFieldProperty?(property)
fid = lookupFieldIDByName( fieldName )
field = lookupField( fid ) if fid
theproperty = field.elements[ property ] if field
theproperty = theproperty.text if the... | [
"def",
"lookupFieldPropertyByName",
"(",
"fieldName",
",",
"property",
")",
"theproperty",
"=",
"nil",
"if",
"isValidFieldProperty?",
"(",
"property",
")",
"fid",
"=",
"lookupFieldIDByName",
"(",
"fieldName",
")",
"field",
"=",
"lookupField",
"(",
"fid",
")",
"i... | Returns the value of a field property, or nil. | [
"Returns",
"the",
"value",
"of",
"a",
"field",
"property",
"or",
"nil",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L531-L540 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.isRecordidField? | def isRecordidField?( fid )
fields = lookupFieldsByType( "recordid" )
(fields and fields.last and fields.last.attributes[ "id" ] == fid)
end | ruby | def isRecordidField?( fid )
fields = lookupFieldsByType( "recordid" )
(fields and fields.last and fields.last.attributes[ "id" ] == fid)
end | [
"def",
"isRecordidField?",
"(",
"fid",
")",
"fields",
"=",
"lookupFieldsByType",
"(",
"\"recordid\"",
")",
"(",
"fields",
"and",
"fields",
".",
"last",
"and",
"fields",
".",
"last",
".",
"attributes",
"[",
"\"id\"",
"]",
"==",
"fid",
")",
"end"
] | Returns whether a field ID is the ID for the key field in a QuickBase table. | [
"Returns",
"whether",
"a",
"field",
"ID",
"is",
"the",
"ID",
"for",
"the",
"key",
"field",
"in",
"a",
"QuickBase",
"table",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L555-L558 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.formatFieldValue | def formatFieldValue( value, type, options = nil )
if value and type
case type
when "date"
value = formatDate( value )
when "date / time","timestamp"
value = formatDate( value, "%m-%d-%Y %I:%M %p" )
when "timeofday"
... | ruby | def formatFieldValue( value, type, options = nil )
if value and type
case type
when "date"
value = formatDate( value )
when "date / time","timestamp"
value = formatDate( value, "%m-%d-%Y %I:%M %p" )
when "timeofday"
... | [
"def",
"formatFieldValue",
"(",
"value",
",",
"type",
",",
"options",
"=",
"nil",
")",
"if",
"value",
"and",
"type",
"case",
"type",
"when",
"\"date\"",
"value",
"=",
"formatDate",
"(",
"value",
")",
"when",
"\"date / time\"",
",",
"\"timestamp\"",
"value",
... | Returns a human-readable string representation of a QuickBase field value.
Also required for subsequent requests to QuickBase. | [
"Returns",
"a",
"human",
"-",
"readable",
"string",
"representation",
"of",
"a",
"QuickBase",
"field",
"value",
".",
"Also",
"required",
"for",
"subsequent",
"requests",
"to",
"QuickBase",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L567-L585 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.findElementByAttributeValue | def findElementByAttributeValue( elements, attribute_name, attribute_value )
element = nil
if elements
if elements.is_a?( REXML::Element )
elements.each_element_with_attribute( attribute_name, attribute_value ) { |e| element = e }
elsif elements.is_a?( Array )
... | ruby | def findElementByAttributeValue( elements, attribute_name, attribute_value )
element = nil
if elements
if elements.is_a?( REXML::Element )
elements.each_element_with_attribute( attribute_name, attribute_value ) { |e| element = e }
elsif elements.is_a?( Array )
... | [
"def",
"findElementByAttributeValue",
"(",
"elements",
",",
"attribute_name",
",",
"attribute_value",
")",
"element",
"=",
"nil",
"if",
"elements",
"if",
"elements",
".",
"is_a?",
"(",
"REXML",
"::",
"Element",
")",
"elements",
".",
"each_element_with_attribute",
... | Returns the first XML sub-element with the specified attribute value. | [
"Returns",
"the",
"first",
"XML",
"sub",
"-",
"element",
"with",
"the",
"specified",
"attribute",
"value",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L716-L730 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.findElementsByAttributeName | def findElementsByAttributeName( elements, attribute_name )
elementArray = []
if elements
elements.each_element_with_attribute( attribute_name ) { |e| elementArray << e }
end
elementArray
end | ruby | def findElementsByAttributeName( elements, attribute_name )
elementArray = []
if elements
elements.each_element_with_attribute( attribute_name ) { |e| elementArray << e }
end
elementArray
end | [
"def",
"findElementsByAttributeName",
"(",
"elements",
",",
"attribute_name",
")",
"elementArray",
"=",
"[",
"]",
"if",
"elements",
"elements",
".",
"each_element_with_attribute",
"(",
"attribute_name",
")",
"{",
"|",
"e",
"|",
"elementArray",
"<<",
"e",
"}",
"e... | Returns an array of XML sub-elements with the specified attribute name. | [
"Returns",
"an",
"array",
"of",
"XML",
"sub",
"-",
"elements",
"with",
"the",
"specified",
"attribute",
"name",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L750-L756 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.lookupFieldData | def lookupFieldData( fid )
@field_data = nil
if @field_data_list
@field_data_list.each{ |field|
if field and field.is_a?( REXML::Element ) and field.has_elements?
fieldid = field.elements[ "fid" ]
if fieldid and fieldid.has_text? and fieldid.text == f... | ruby | def lookupFieldData( fid )
@field_data = nil
if @field_data_list
@field_data_list.each{ |field|
if field and field.is_a?( REXML::Element ) and field.has_elements?
fieldid = field.elements[ "fid" ]
if fieldid and fieldid.has_text? and fieldid.text == f... | [
"def",
"lookupFieldData",
"(",
"fid",
")",
"@field_data",
"=",
"nil",
"if",
"@field_data_list",
"@field_data_list",
".",
"each",
"{",
"|",
"field",
"|",
"if",
"field",
"and",
"field",
".",
"is_a?",
"(",
"REXML",
"::",
"Element",
")",
"and",
"field",
".",
... | Returns the XML element for a field returned by a getRecordInfo call. | [
"Returns",
"the",
"XML",
"element",
"for",
"a",
"field",
"returned",
"by",
"a",
"getRecordInfo",
"call",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L765-L778 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getFieldDataValue | def getFieldDataValue(fid)
value = nil
if @field_data_list
field_data = lookupFieldData(fid)
if field_data
valueElement = field_data.elements[ "value" ]
value = valueElement.text if valueElement.has_text?
end
end
value
end | ruby | def getFieldDataValue(fid)
value = nil
if @field_data_list
field_data = lookupFieldData(fid)
if field_data
valueElement = field_data.elements[ "value" ]
value = valueElement.text if valueElement.has_text?
end
end
value
end | [
"def",
"getFieldDataValue",
"(",
"fid",
")",
"value",
"=",
"nil",
"if",
"@field_data_list",
"field_data",
"=",
"lookupFieldData",
"(",
"fid",
")",
"if",
"field_data",
"valueElement",
"=",
"field_data",
".",
"elements",
"[",
"\"value\"",
"]",
"value",
"=",
"val... | Returns the value for a field returned by a getRecordInfo call. | [
"Returns",
"the",
"value",
"for",
"a",
"field",
"returned",
"by",
"a",
"getRecordInfo",
"call",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L781-L791 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getFieldDataPrintableValue | def getFieldDataPrintableValue(fid)
printable = nil
if @field_data_list
field_data = lookupFieldData(fid)
if field_data
printableElement = field_data.elements[ "printable" ]
printable = printableElement.text if printableElement and printableElement.has_text?
... | ruby | def getFieldDataPrintableValue(fid)
printable = nil
if @field_data_list
field_data = lookupFieldData(fid)
if field_data
printableElement = field_data.elements[ "printable" ]
printable = printableElement.text if printableElement and printableElement.has_text?
... | [
"def",
"getFieldDataPrintableValue",
"(",
"fid",
")",
"printable",
"=",
"nil",
"if",
"@field_data_list",
"field_data",
"=",
"lookupFieldData",
"(",
"fid",
")",
"if",
"field_data",
"printableElement",
"=",
"field_data",
".",
"elements",
"[",
"\"printable\"",
"]",
"... | Returns the printable value for a field returned by a getRecordInfo call. | [
"Returns",
"the",
"printable",
"value",
"for",
"a",
"field",
"returned",
"by",
"a",
"getRecordInfo",
"call",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L794-L804 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getFieldIDs | def getFieldIDs(dbid = nil, exclude_built_in_fields = false )
fieldIDs = []
dbid ||= @dbid
getSchema(dbid)
if @fields
@fields.each_element_with_attribute( "id" ){|f|
next if exclude_built_in_fields and isBuiltInField?(f.attributes["id"])
fieldIDs << f.attributes[ "id" ]... | ruby | def getFieldIDs(dbid = nil, exclude_built_in_fields = false )
fieldIDs = []
dbid ||= @dbid
getSchema(dbid)
if @fields
@fields.each_element_with_attribute( "id" ){|f|
next if exclude_built_in_fields and isBuiltInField?(f.attributes["id"])
fieldIDs << f.attributes[ "id" ]... | [
"def",
"getFieldIDs",
"(",
"dbid",
"=",
"nil",
",",
"exclude_built_in_fields",
"=",
"false",
")",
"fieldIDs",
"=",
"[",
"]",
"dbid",
"||=",
"@dbid",
"getSchema",
"(",
"dbid",
")",
"if",
"@fields",
"@fields",
".",
"each_element_with_attribute",
"(",
"\"id\"",
... | Get an array of field IDs for a table. | [
"Get",
"an",
"array",
"of",
"field",
"IDs",
"for",
"a",
"table",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L823-L834 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getFieldNames | def getFieldNames( dbid = nil, lowerOrUppercase = "", exclude_built_in_fields = false )
fieldNames = []
dbid ||= @dbid
getSchema(dbid)
if @fields
@fields.each_element_with_attribute( "id" ){ |f|
next if exclude_built_in_fields and isBuiltInField?(f.attributes["id"])
... | ruby | def getFieldNames( dbid = nil, lowerOrUppercase = "", exclude_built_in_fields = false )
fieldNames = []
dbid ||= @dbid
getSchema(dbid)
if @fields
@fields.each_element_with_attribute( "id" ){ |f|
next if exclude_built_in_fields and isBuiltInField?(f.attributes["id"])
... | [
"def",
"getFieldNames",
"(",
"dbid",
"=",
"nil",
",",
"lowerOrUppercase",
"=",
"\"\"",
",",
"exclude_built_in_fields",
"=",
"false",
")",
"fieldNames",
"=",
"[",
"]",
"dbid",
"||=",
"@dbid",
"getSchema",
"(",
"dbid",
")",
"if",
"@fields",
"@fields",
".",
"... | Get an array of field names for a table. | [
"Get",
"an",
"array",
"of",
"field",
"names",
"for",
"a",
"table",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L837-L856 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getApplicationVariables | def getApplicationVariables(dbid=nil)
variablesHash = {}
dbid ||= @dbid
qbc.getSchema(dbid)
if @variables
@variables.each_element_with_attribute( "name" ){ |var|
if var.name == "var" and var.has_text?
variablesHash[var.attributes["name"]] = var.text
... | ruby | def getApplicationVariables(dbid=nil)
variablesHash = {}
dbid ||= @dbid
qbc.getSchema(dbid)
if @variables
@variables.each_element_with_attribute( "name" ){ |var|
if var.name == "var" and var.has_text?
variablesHash[var.attributes["name"]] = var.text
... | [
"def",
"getApplicationVariables",
"(",
"dbid",
"=",
"nil",
")",
"variablesHash",
"=",
"{",
"}",
"dbid",
"||=",
"@dbid",
"qbc",
".",
"getSchema",
"(",
"dbid",
")",
"if",
"@variables",
"@variables",
".",
"each_element_with_attribute",
"(",
"\"name\"",
")",
"{",
... | Get a Hash of application variables. | [
"Get",
"a",
"Hash",
"of",
"application",
"variables",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L859-L871 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.lookupChdbid | def lookupChdbid( tableName, dbid=nil )
getSchema(dbid) if dbid
unmodifiedTableName = tableName.dup
@chdbid = findElementByAttributeValue( @chdbids, "name", formatChdbidName( tableName ) )
if @chdbid
@dbid = @chdbid.text
return @dbid
end
if @chdbids
... | ruby | def lookupChdbid( tableName, dbid=nil )
getSchema(dbid) if dbid
unmodifiedTableName = tableName.dup
@chdbid = findElementByAttributeValue( @chdbids, "name", formatChdbidName( tableName ) )
if @chdbid
@dbid = @chdbid.text
return @dbid
end
if @chdbids
... | [
"def",
"lookupChdbid",
"(",
"tableName",
",",
"dbid",
"=",
"nil",
")",
"getSchema",
"(",
"dbid",
")",
"if",
"dbid",
"unmodifiedTableName",
"=",
"tableName",
".",
"dup",
"@chdbid",
"=",
"findElementByAttributeValue",
"(",
"@chdbids",
",",
"\"name\"",
",",
"form... | Makes the table with the specified name the 'active' table, and returns the id from the table. | [
"Makes",
"the",
"table",
"with",
"the",
"specified",
"name",
"the",
"active",
"table",
"and",
"returns",
"the",
"id",
"from",
"the",
"table",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L914-L938 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getTableName | def getTableName(dbid)
tableName = nil
dbid ||= @dbid
if getSchema(dbid)
tableName = getResponseElement( "table/name" ).text
end
tableName
end | ruby | def getTableName(dbid)
tableName = nil
dbid ||= @dbid
if getSchema(dbid)
tableName = getResponseElement( "table/name" ).text
end
tableName
end | [
"def",
"getTableName",
"(",
"dbid",
")",
"tableName",
"=",
"nil",
"dbid",
"||=",
"@dbid",
"if",
"getSchema",
"(",
"dbid",
")",
"tableName",
"=",
"getResponseElement",
"(",
"\"table/name\"",
")",
".",
"text",
"end",
"tableName",
"end"
] | Get the name of a table given its id. | [
"Get",
"the",
"name",
"of",
"a",
"table",
"given",
"its",
"id",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L941-L948 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getTableNames | def getTableNames(dbid, lowercaseOrUpperCase = "")
tableNames = []
dbid ||= @dbid
getSchema(dbid)
if @chdbids
chdbidArray = findElementsByAttributeName( @chdbids, "name" )
chdbidArray.each{ |chdbid|
if chdbid.has_text?
dbid = chdbid.text... | ruby | def getTableNames(dbid, lowercaseOrUpperCase = "")
tableNames = []
dbid ||= @dbid
getSchema(dbid)
if @chdbids
chdbidArray = findElementsByAttributeName( @chdbids, "name" )
chdbidArray.each{ |chdbid|
if chdbid.has_text?
dbid = chdbid.text... | [
"def",
"getTableNames",
"(",
"dbid",
",",
"lowercaseOrUpperCase",
"=",
"\"\"",
")",
"tableNames",
"=",
"[",
"]",
"dbid",
"||=",
"@dbid",
"getSchema",
"(",
"dbid",
")",
"if",
"@chdbids",
"chdbidArray",
"=",
"findElementsByAttributeName",
"(",
"@chdbids",
",",
"... | Get a list of the names of the child tables of an application. | [
"Get",
"a",
"list",
"of",
"the",
"names",
"of",
"the",
"child",
"tables",
"of",
"an",
"application",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L951-L975 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getTableIDs | def getTableIDs(dbid)
tableIDs = []
dbid ||= @dbid
getSchema(dbid)
if @chdbids
chdbidArray = findElementsByAttributeName( @chdbids, "name" )
chdbidArray.each{ |chdbid|
if chdbid.has_text?
tableIDs << chdbid.text
end
... | ruby | def getTableIDs(dbid)
tableIDs = []
dbid ||= @dbid
getSchema(dbid)
if @chdbids
chdbidArray = findElementsByAttributeName( @chdbids, "name" )
chdbidArray.each{ |chdbid|
if chdbid.has_text?
tableIDs << chdbid.text
end
... | [
"def",
"getTableIDs",
"(",
"dbid",
")",
"tableIDs",
"=",
"[",
"]",
"dbid",
"||=",
"@dbid",
"getSchema",
"(",
"dbid",
")",
"if",
"@chdbids",
"chdbidArray",
"=",
"findElementsByAttributeName",
"(",
"@chdbids",
",",
"\"name\"",
")",
"chdbidArray",
".",
"each",
... | Get a list of the dbids of the child tables of an application. | [
"Get",
"a",
"list",
"of",
"the",
"dbids",
"of",
"the",
"child",
"tables",
"of",
"an",
"application",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L978-L991 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getNumTables | def getNumTables(dbid)
numTables = 0
dbid ||= @dbid
if getSchema(dbid)
if @chdbids
chdbidArray = findElementsByAttributeName( @chdbids, "name" )
numTables = chdbidArray.length
end
end
numTables
end | ruby | def getNumTables(dbid)
numTables = 0
dbid ||= @dbid
if getSchema(dbid)
if @chdbids
chdbidArray = findElementsByAttributeName( @chdbids, "name" )
numTables = chdbidArray.length
end
end
numTables
end | [
"def",
"getNumTables",
"(",
"dbid",
")",
"numTables",
"=",
"0",
"dbid",
"||=",
"@dbid",
"if",
"getSchema",
"(",
"dbid",
")",
"if",
"@chdbids",
"chdbidArray",
"=",
"findElementsByAttributeName",
"(",
"@chdbids",
",",
"\"name\"",
")",
"numTables",
"=",
"chdbidAr... | Get the number of child tables of an application | [
"Get",
"the",
"number",
"of",
"child",
"tables",
"of",
"an",
"application"
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L994-L1004 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getRealmForDbid | def getRealmForDbid(dbid)
@realm = nil
if USING_HTTPCLIENT
begin
httpclient = HTTPClient.new
resp = httpclient.get("https://www.quickbase.com/db/#{dbid}")
location = resp.header['Location'][0]
location.sub!("https://","")
parts = l... | ruby | def getRealmForDbid(dbid)
@realm = nil
if USING_HTTPCLIENT
begin
httpclient = HTTPClient.new
resp = httpclient.get("https://www.quickbase.com/db/#{dbid}")
location = resp.header['Location'][0]
location.sub!("https://","")
parts = l... | [
"def",
"getRealmForDbid",
"(",
"dbid",
")",
"@realm",
"=",
"nil",
"if",
"USING_HTTPCLIENT",
"begin",
"httpclient",
"=",
"HTTPClient",
".",
"new",
"resp",
"=",
"httpclient",
".",
"get",
"(",
"\"https://www.quickbase.com/db/#{dbid}\"",
")",
"location",
"=",
"resp",
... | Given a DBID, get the QuickBase realm it is in. | [
"Given",
"a",
"DBID",
"get",
"the",
"QuickBase",
"realm",
"it",
"is",
"in",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1024-L1041 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.isValidFieldType? | def isValidFieldType?( type )
@validFieldTypes ||= %w{ checkbox dblink date duration email file fkey float formula currency
lookup multiuserid phone percent rating recordid text timeofday timestamp url userid icalendarbutton }
@validFieldTypes.include?( type )
end | ruby | def isValidFieldType?( type )
@validFieldTypes ||= %w{ checkbox dblink date duration email file fkey float formula currency
lookup multiuserid phone percent rating recordid text timeofday timestamp url userid icalendarbutton }
@validFieldTypes.include?( type )
end | [
"def",
"isValidFieldType?",
"(",
"type",
")",
"@validFieldTypes",
"||=",
"%w{",
"checkbox",
"dblink",
"date",
"duration",
"email",
"file",
"fkey",
"float",
"formula",
"currency",
"lookup",
"multiuserid",
"phone",
"percent",
"rating",
"recordid",
"text",
"timeofday",... | Returns whether a given string represents a valid QuickBase field type. | [
"Returns",
"whether",
"a",
"given",
"string",
"represents",
"a",
"valid",
"QuickBase",
"field",
"type",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1054-L1058 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.isValidFieldProperty? | def isValidFieldProperty?( property )
if @validFieldProperties.nil?
@validFieldProperties = %w{ allow_new_choices allowHTML appears_by_default append_only
blank_is_zero bold carrychoices comma_start cover_text currency_format currency_symbol
decimal_places default_kind def... | ruby | def isValidFieldProperty?( property )
if @validFieldProperties.nil?
@validFieldProperties = %w{ allow_new_choices allowHTML appears_by_default append_only
blank_is_zero bold carrychoices comma_start cover_text currency_format currency_symbol
decimal_places default_kind def... | [
"def",
"isValidFieldProperty?",
"(",
"property",
")",
"if",
"@validFieldProperties",
".",
"nil?",
"@validFieldProperties",
"=",
"%w{",
"allow_new_choices",
"allowHTML",
"appears_by_default",
"append_only",
"blank_is_zero",
"bold",
"carrychoices",
"comma_start",
"cover_text",
... | Returns whether a given string represents a valid QuickBase field property. | [
"Returns",
"whether",
"a",
"given",
"string",
"represents",
"a",
"valid",
"QuickBase",
"field",
"property",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1067-L1079 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.verifyFieldList | def verifyFieldList( fnames, fids = nil, dbid = @dbid )
getSchema( dbid )
@fids = @fnames = nil
if fids
if fids.is_a?( Array ) and fids.length > 0
fids.each { |id|
fid = lookupField( id )
if fid
fname = lookupFieldNameFromID( i... | ruby | def verifyFieldList( fnames, fids = nil, dbid = @dbid )
getSchema( dbid )
@fids = @fnames = nil
if fids
if fids.is_a?( Array ) and fids.length > 0
fids.each { |id|
fid = lookupField( id )
if fid
fname = lookupFieldNameFromID( i... | [
"def",
"verifyFieldList",
"(",
"fnames",
",",
"fids",
"=",
"nil",
",",
"dbid",
"=",
"@dbid",
")",
"getSchema",
"(",
"dbid",
")",
"@fids",
"=",
"@fnames",
"=",
"nil",
"if",
"fids",
"if",
"fids",
".",
"is_a?",
"(",
"Array",
")",
"and",
"fids",
".",
"... | Given an array of field names or field IDs and a table ID, builds an array of valid field IDs and field names.
Throws an exception when an invalid name or ID is encountered. | [
"Given",
"an",
"array",
"of",
"field",
"names",
"or",
"field",
"IDs",
"and",
"a",
"table",
"ID",
"builds",
"an",
"array",
"of",
"valid",
"field",
"IDs",
"and",
"field",
"names",
".",
"Throws",
"an",
"exception",
"when",
"an",
"invalid",
"name",
"or",
"... | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1200-L1239 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getQueryRequestXML | def getQueryRequestXML( query = nil, qid = nil, qname = nil )
@query = @qid = @qname = nil
if query
@query = query == "" ? "{'0'.CT.''}" : query
xmlRequestData = toXML( :query, @query )
elsif qid
@qid = qid
xmlRequestData = toXML( :qid, @qid )
elsif qname
... | ruby | def getQueryRequestXML( query = nil, qid = nil, qname = nil )
@query = @qid = @qname = nil
if query
@query = query == "" ? "{'0'.CT.''}" : query
xmlRequestData = toXML( :query, @query )
elsif qid
@qid = qid
xmlRequestData = toXML( :qid, @qid )
elsif qname
... | [
"def",
"getQueryRequestXML",
"(",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
")",
"@query",
"=",
"@qid",
"=",
"@qname",
"=",
"nil",
"if",
"query",
"@query",
"=",
"query",
"==",
"\"\"",
"?",
"\"{'0'.CT.''}\"",
":",
"query",
... | Builds the request XML for retrieving the results of a query. | [
"Builds",
"the",
"request",
"XML",
"for",
"retrieving",
"the",
"results",
"of",
"a",
"query",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1242-L1258 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getColumnListForQuery | def getColumnListForQuery( id, name )
clistForQuery = nil
if id
query = lookupQuery( id )
elsif name
query = lookupQueryByName( name )
end
if query and query.elements["qyclst"]
clistForQuery = query.elements["qyclst"].text.dup
end
clistForQu... | ruby | def getColumnListForQuery( id, name )
clistForQuery = nil
if id
query = lookupQuery( id )
elsif name
query = lookupQueryByName( name )
end
if query and query.elements["qyclst"]
clistForQuery = query.elements["qyclst"].text.dup
end
clistForQu... | [
"def",
"getColumnListForQuery",
"(",
"id",
",",
"name",
")",
"clistForQuery",
"=",
"nil",
"if",
"id",
"query",
"=",
"lookupQuery",
"(",
"id",
")",
"elsif",
"name",
"query",
"=",
"lookupQueryByName",
"(",
"name",
")",
"end",
"if",
"query",
"and",
"query",
... | Returns the clist associated with a query. | [
"Returns",
"the",
"clist",
"associated",
"with",
"a",
"query",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1261-L1272 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getSortListForQuery | def getSortListForQuery( id, name )
slistForQuery = nil
if id
query = lookupQuery( id )
elsif name
query = lookupQueryByName( name )
end
if query and query.elements["qyslst"]
slistForQuery = query.elements["qyslst"].text.dup
end
slistForQuer... | ruby | def getSortListForQuery( id, name )
slistForQuery = nil
if id
query = lookupQuery( id )
elsif name
query = lookupQueryByName( name )
end
if query and query.elements["qyslst"]
slistForQuery = query.elements["qyslst"].text.dup
end
slistForQuer... | [
"def",
"getSortListForQuery",
"(",
"id",
",",
"name",
")",
"slistForQuery",
"=",
"nil",
"if",
"id",
"query",
"=",
"lookupQuery",
"(",
"id",
")",
"elsif",
"name",
"query",
"=",
"lookupQueryByName",
"(",
"name",
")",
"end",
"if",
"query",
"and",
"query",
"... | Returns the slist associated with a query. | [
"Returns",
"the",
"slist",
"associated",
"with",
"a",
"query",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1277-L1288 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getCriteriaForQuery | def getCriteriaForQuery( id, name )
criteriaForQuery = nil
if id
query = lookupQuery( id )
elsif name
query = lookupQueryByName( name )
end
if query and query.elements["qycrit"]
criteriaForQuery = query.elements["qycrit"].text.dup
end
criter... | ruby | def getCriteriaForQuery( id, name )
criteriaForQuery = nil
if id
query = lookupQuery( id )
elsif name
query = lookupQueryByName( name )
end
if query and query.elements["qycrit"]
criteriaForQuery = query.elements["qycrit"].text.dup
end
criter... | [
"def",
"getCriteriaForQuery",
"(",
"id",
",",
"name",
")",
"criteriaForQuery",
"=",
"nil",
"if",
"id",
"query",
"=",
"lookupQuery",
"(",
"id",
")",
"elsif",
"name",
"query",
"=",
"lookupQueryByName",
"(",
"name",
")",
"end",
"if",
"query",
"and",
"query",
... | Returns the criteria associated with a query. | [
"Returns",
"the",
"criteria",
"associated",
"with",
"a",
"query",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1293-L1304 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.verifyQueryOperator | def verifyQueryOperator( operator, fieldType )
queryOperator = ""
if @queryOperators.nil?
@queryOperators = {}
@queryOperatorFieldType = {}
@queryOperators[ "CT" ] = [ "contains", "[]" ]
@queryOperators[ "XCT" ] = [ "does not contain", "![]" ]
@que... | ruby | def verifyQueryOperator( operator, fieldType )
queryOperator = ""
if @queryOperators.nil?
@queryOperators = {}
@queryOperatorFieldType = {}
@queryOperators[ "CT" ] = [ "contains", "[]" ]
@queryOperators[ "XCT" ] = [ "does not contain", "![]" ]
@que... | [
"def",
"verifyQueryOperator",
"(",
"operator",
",",
"fieldType",
")",
"queryOperator",
"=",
"\"\"",
"if",
"@queryOperators",
".",
"nil?",
"@queryOperators",
"=",
"{",
"}",
"@queryOperatorFieldType",
"=",
"{",
"}",
"@queryOperators",
"[",
"\"CT\"",
"]",
"=",
"[",... | Returns a valid query operator. | [
"Returns",
"a",
"valid",
"query",
"operator",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1309-L1367 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.lookupBaseFieldTypeByName | def lookupBaseFieldTypeByName( fieldName )
type = ""
fid = lookupFieldIDByName( fieldName )
field = lookupField( fid ) if fid
type = field.attributes[ "base_type" ] if field
type
end | ruby | def lookupBaseFieldTypeByName( fieldName )
type = ""
fid = lookupFieldIDByName( fieldName )
field = lookupField( fid ) if fid
type = field.attributes[ "base_type" ] if field
type
end | [
"def",
"lookupBaseFieldTypeByName",
"(",
"fieldName",
")",
"type",
"=",
"\"\"",
"fid",
"=",
"lookupFieldIDByName",
"(",
"fieldName",
")",
"field",
"=",
"lookupField",
"(",
"fid",
")",
"if",
"fid",
"type",
"=",
"field",
".",
"attributes",
"[",
"\"base_type\"",
... | Get a field's base type using its name. | [
"Get",
"a",
"field",
"s",
"base",
"type",
"using",
"its",
"name",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1370-L1376 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.lookupFieldTypeByName | def lookupFieldTypeByName( fieldName )
type = ""
fid = lookupFieldIDByName( fieldName )
field = lookupField( fid ) if fid
type = field.attributes[ "field_type" ] if field
type
end | ruby | def lookupFieldTypeByName( fieldName )
type = ""
fid = lookupFieldIDByName( fieldName )
field = lookupField( fid ) if fid
type = field.attributes[ "field_type" ] if field
type
end | [
"def",
"lookupFieldTypeByName",
"(",
"fieldName",
")",
"type",
"=",
"\"\"",
"fid",
"=",
"lookupFieldIDByName",
"(",
"fieldName",
")",
"field",
"=",
"lookupField",
"(",
"fid",
")",
"if",
"fid",
"type",
"=",
"field",
".",
"attributes",
"[",
"\"field_type\"",
"... | Get a field's type using its name. | [
"Get",
"a",
"field",
"s",
"type",
"using",
"its",
"name",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1379-L1385 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.formatDate | def formatDate( milliseconds, fmtString = nil, addDay = false )
fmt = ""
fmtString = "%m-%d-%Y" if fmtString.nil?
if milliseconds
milliseconds_s = milliseconds.to_s
if milliseconds_s.length == 13
t = Time.at( milliseconds_s[0,10].to_i, milliseconds_s[10,3].to_i )
... | ruby | def formatDate( milliseconds, fmtString = nil, addDay = false )
fmt = ""
fmtString = "%m-%d-%Y" if fmtString.nil?
if milliseconds
milliseconds_s = milliseconds.to_s
if milliseconds_s.length == 13
t = Time.at( milliseconds_s[0,10].to_i, milliseconds_s[10,3].to_i )
... | [
"def",
"formatDate",
"(",
"milliseconds",
",",
"fmtString",
"=",
"nil",
",",
"addDay",
"=",
"false",
")",
"fmt",
"=",
"\"\"",
"fmtString",
"=",
"\"%m-%d-%Y\"",
"if",
"fmtString",
".",
"nil?",
"if",
"milliseconds",
"milliseconds_s",
"=",
"milliseconds",
".",
... | Returns the human-readable string represntation of a date, given the
milliseconds version of the date. Also needed for requests to QuickBase. | [
"Returns",
"the",
"human",
"-",
"readable",
"string",
"represntation",
"of",
"a",
"date",
"given",
"the",
"milliseconds",
"version",
"of",
"the",
"date",
".",
"Also",
"needed",
"for",
"requests",
"to",
"QuickBase",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1394-L1410 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.formatDuration | def formatDuration( value, option = "hours" )
option = "hours" if option.nil?
if value.nil?
value = ""
else
seconds = (value.to_i/1000)
minutes = (seconds/60)
hours = (minutes/60)
days = (hours/24)
if option == "days"
value... | ruby | def formatDuration( value, option = "hours" )
option = "hours" if option.nil?
if value.nil?
value = ""
else
seconds = (value.to_i/1000)
minutes = (seconds/60)
hours = (minutes/60)
days = (hours/24)
if option == "days"
value... | [
"def",
"formatDuration",
"(",
"value",
",",
"option",
"=",
"\"hours\"",
")",
"option",
"=",
"\"hours\"",
"if",
"option",
".",
"nil?",
"if",
"value",
".",
"nil?",
"value",
"=",
"\"\"",
"else",
"seconds",
"=",
"(",
"value",
".",
"to_i",
"/",
"1000",
")",... | Converts milliseconds to hours and returns the value as a string. | [
"Converts",
"milliseconds",
"to",
"hours",
"and",
"returns",
"the",
"value",
"as",
"a",
"string",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1413-L1431 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.formatTimeOfDay | def formatTimeOfDay(milliseconds, format = "%I:%M %p" )
format ||= "%I:%M %p"
timeOfDay = ""
timeOfDay = Time.at(milliseconds.to_i/1000).utc.strftime(format) if milliseconds
end | ruby | def formatTimeOfDay(milliseconds, format = "%I:%M %p" )
format ||= "%I:%M %p"
timeOfDay = ""
timeOfDay = Time.at(milliseconds.to_i/1000).utc.strftime(format) if milliseconds
end | [
"def",
"formatTimeOfDay",
"(",
"milliseconds",
",",
"format",
"=",
"\"%I:%M %p\"",
")",
"format",
"||=",
"\"%I:%M %p\"",
"timeOfDay",
"=",
"\"\"",
"timeOfDay",
"=",
"Time",
".",
"at",
"(",
"milliseconds",
".",
"to_i",
"/",
"1000",
")",
".",
"utc",
".",
"st... | Returns a string format for a time of day value. | [
"Returns",
"a",
"string",
"format",
"for",
"a",
"time",
"of",
"day",
"value",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1434-L1438 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.formatCurrency | def formatCurrency( value, options = nil )
value ||= "0.00"
if !value.include?( '.' )
value << ".00"
end
currencySymbol = currencyFormat = nil
if options
currencySymbol = options["currencySymbol"]
currencyFormat = options["currencyFormat"]
... | ruby | def formatCurrency( value, options = nil )
value ||= "0.00"
if !value.include?( '.' )
value << ".00"
end
currencySymbol = currencyFormat = nil
if options
currencySymbol = options["currencySymbol"]
currencyFormat = options["currencyFormat"]
... | [
"def",
"formatCurrency",
"(",
"value",
",",
"options",
"=",
"nil",
")",
"value",
"||=",
"\"0.00\"",
"if",
"!",
"value",
".",
"include?",
"(",
"'.'",
")",
"value",
"<<",
"\".00\"",
"end",
"currencySymbol",
"=",
"currencyFormat",
"=",
"nil",
"if",
"options",... | Returns a string formatted for a currency value. | [
"Returns",
"a",
"string",
"formatted",
"for",
"a",
"currency",
"value",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1441-L1474 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.formatPercent | def formatPercent( value, options = nil )
if value
percent = (value.to_f * 100)
value = percent.to_s
if value.include?(".")
int,fraction = value.split('.')
if fraction.to_i == 0
value = int
else
value = "#{int}.#... | ruby | def formatPercent( value, options = nil )
if value
percent = (value.to_f * 100)
value = percent.to_s
if value.include?(".")
int,fraction = value.split('.')
if fraction.to_i == 0
value = int
else
value = "#{int}.#... | [
"def",
"formatPercent",
"(",
"value",
",",
"options",
"=",
"nil",
")",
"if",
"value",
"percent",
"=",
"(",
"value",
".",
"to_f",
"*",
"100",
")",
"value",
"=",
"percent",
".",
"to_s",
"if",
"value",
".",
"include?",
"(",
"\".\"",
")",
"int",
",",
"... | Returns a string formatted for a percent value, given the data from QuickBase | [
"Returns",
"a",
"string",
"formatted",
"for",
"a",
"percent",
"value",
"given",
"the",
"data",
"from",
"QuickBase"
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1477-L1493 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.dateToMS | def dateToMS( dateString )
milliseconds = 0
if dateString and dateString.match( /[0-9][0-9]\-[0-9][0-9]\-[0-9][0-9][0-9][0-9]/)
d = Date.new( dateString[7,4], dateString[4,2], dateString[0,2] )
milliseconds = d.jd
end
milliseconds
end | ruby | def dateToMS( dateString )
milliseconds = 0
if dateString and dateString.match( /[0-9][0-9]\-[0-9][0-9]\-[0-9][0-9][0-9][0-9]/)
d = Date.new( dateString[7,4], dateString[4,2], dateString[0,2] )
milliseconds = d.jd
end
milliseconds
end | [
"def",
"dateToMS",
"(",
"dateString",
")",
"milliseconds",
"=",
"0",
"if",
"dateString",
"and",
"dateString",
".",
"match",
"(",
"/",
"\\-",
"\\-",
"/",
")",
"d",
"=",
"Date",
".",
"new",
"(",
"dateString",
"[",
"7",
",",
"4",
"]",
",",
"dateString",... | Returns the milliseconds representation of a date specified in mm-dd-yyyy format. | [
"Returns",
"the",
"milliseconds",
"representation",
"of",
"a",
"date",
"specified",
"in",
"mm",
"-",
"dd",
"-",
"yyyy",
"format",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1496-L1503 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.escapeXML | def escapeXML( char )
if @xmlEscapes.nil?
@xmlEscapes = {}
(0..255).each{ |i| @xmlEscapes[ i.chr ] = sprintf( "&#%03d;", i ) }
end
return @xmlEscapes[ char ] if @xmlEscapes[ char ]
char
end | ruby | def escapeXML( char )
if @xmlEscapes.nil?
@xmlEscapes = {}
(0..255).each{ |i| @xmlEscapes[ i.chr ] = sprintf( "&#%03d;", i ) }
end
return @xmlEscapes[ char ] if @xmlEscapes[ char ]
char
end | [
"def",
"escapeXML",
"(",
"char",
")",
"if",
"@xmlEscapes",
".",
"nil?",
"@xmlEscapes",
"=",
"{",
"}",
"(",
"0",
"..",
"255",
")",
".",
"each",
"{",
"|",
"i",
"|",
"@xmlEscapes",
"[",
"i",
".",
"chr",
"]",
"=",
"sprintf",
"(",
"\"&#%03d;\"",
",",
... | Returns the URL-encoded version of a non-printing character. | [
"Returns",
"the",
"URL",
"-",
"encoded",
"version",
"of",
"a",
"non",
"-",
"printing",
"character",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1512-L1519 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.encodingStrings | def encodingStrings( reverse = false )
@encodingStrings = [ {"&" => "&" }, {"<" => "<"} , {">" => ">"}, {"'" => "'"}, {"\"" => """ } ] if @encodingStrings.nil?
if block_given?
if reverse
@encodingStrings.reverse_each{ |s| s.each{|k,v| yield v,k } }
e... | ruby | def encodingStrings( reverse = false )
@encodingStrings = [ {"&" => "&" }, {"<" => "<"} , {">" => ">"}, {"'" => "'"}, {"\"" => """ } ] if @encodingStrings.nil?
if block_given?
if reverse
@encodingStrings.reverse_each{ |s| s.each{|k,v| yield v,k } }
e... | [
"def",
"encodingStrings",
"(",
"reverse",
"=",
"false",
")",
"@encodingStrings",
"=",
"[",
"{",
"\"&\"",
"=>",
"\"&\"",
"}",
",",
"{",
"\"<\"",
"=>",
"\"<\"",
"}",
",",
"{",
"\">\"",
"=>",
"\">\"",
"}",
",",
"{",
"\"'\"",
"=>",
"\"'\"",
... | Returns the list of string substitutions to make to encode or decode field values used in XML. | [
"Returns",
"the",
"list",
"of",
"string",
"substitutions",
"to",
"make",
"to",
"encode",
"or",
"decode",
"field",
"values",
"used",
"in",
"XML",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1522-L1533 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.encodeXML | def encodeXML( text, doNPChars = false )
encodingStrings { |key,value| text.gsub!( key, value ) if text }
text.gsub!( /([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'()# ])/ ) { |c| escapeXML( $1 ) } if text and doNPChars
text
end | ruby | def encodeXML( text, doNPChars = false )
encodingStrings { |key,value| text.gsub!( key, value ) if text }
text.gsub!( /([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'()# ])/ ) { |c| escapeXML( $1 ) } if text and doNPChars
text
end | [
"def",
"encodeXML",
"(",
"text",
",",
"doNPChars",
"=",
"false",
")",
"encodingStrings",
"{",
"|",
"key",
",",
"value",
"|",
"text",
".",
"gsub!",
"(",
"key",
",",
"value",
")",
"if",
"text",
"}",
"text",
".",
"gsub!",
"(",
"/",
"\\/",
"\\$",
"\\-"... | Modify the given string for use as a XML field value. | [
"Modify",
"the",
"given",
"string",
"for",
"use",
"as",
"a",
"XML",
"field",
"value",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1536-L1540 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.decodeXML | def decodeXML( text )
encodingStrings( true ) { |key,value| text.gsub!( value, key ) if text }
text.gsub!( /&#([0-9]{2,3});/ ) { |c| $1.chr } if text
text
end | ruby | def decodeXML( text )
encodingStrings( true ) { |key,value| text.gsub!( value, key ) if text }
text.gsub!( /&#([0-9]{2,3});/ ) { |c| $1.chr } if text
text
end | [
"def",
"decodeXML",
"(",
"text",
")",
"encodingStrings",
"(",
"true",
")",
"{",
"|",
"key",
",",
"value",
"|",
"text",
".",
"gsub!",
"(",
"value",
",",
"key",
")",
"if",
"text",
"}",
"text",
".",
"gsub!",
"(",
"/",
"/",
")",
"{",
"|",
"c",
"|",... | Modify the given XML field value for use as a string. | [
"Modify",
"the",
"given",
"XML",
"field",
"value",
"for",
"use",
"as",
"a",
"string",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1543-L1547 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.fire | def fire( event )
if @eventSubscribers and @eventSubscribers.include?( event )
handlers = @eventSubscribers[ event ]
if handlers
handlers.each{ |handler| handler.handle( event ) }
end
end
end | ruby | def fire( event )
if @eventSubscribers and @eventSubscribers.include?( event )
handlers = @eventSubscribers[ event ]
if handlers
handlers.each{ |handler| handler.handle( event ) }
end
end
end | [
"def",
"fire",
"(",
"event",
")",
"if",
"@eventSubscribers",
"and",
"@eventSubscribers",
".",
"include?",
"(",
"event",
")",
"handlers",
"=",
"@eventSubscribers",
"[",
"event",
"]",
"if",
"handlers",
"handlers",
".",
"each",
"{",
"|",
"handler",
"|",
"handle... | Called by client methods to notify event subscribers | [
"Called",
"by",
"client",
"methods",
"to",
"notify",
"event",
"subscribers"
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1594-L1601 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client._addRecord | def _addRecord( fvlist = nil, disprec = nil, fform = nil, ignoreError = nil, update_id = nil )
addRecord( @dbid, fvlist, disprec, fform, ignoreError, update_id )
end | ruby | def _addRecord( fvlist = nil, disprec = nil, fform = nil, ignoreError = nil, update_id = nil )
addRecord( @dbid, fvlist, disprec, fform, ignoreError, update_id )
end | [
"def",
"_addRecord",
"(",
"fvlist",
"=",
"nil",
",",
"disprec",
"=",
"nil",
",",
"fform",
"=",
"nil",
",",
"ignoreError",
"=",
"nil",
",",
"update_id",
"=",
"nil",
")",
"addRecord",
"(",
"@dbid",
",",
"fvlist",
",",
"disprec",
",",
"fform",
",",
"ign... | API_AddRecord, using the active table id. | [
"API_AddRecord",
"using",
"the",
"active",
"table",
"id",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1710-L1712 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client._doQueryHash | def _doQueryHash( doQueryOptions )
doQueryOptions ||= {}
raise "options must be a Hash" unless doQueryOptions.is_a?(Hash)
doQueryOptions["dbid"] ||= @dbid
doQueryOptions["fmt"] ||= "structured"
doQuery( doQueryOptions["dbid"],
doQueryOptions["query"],
... | ruby | def _doQueryHash( doQueryOptions )
doQueryOptions ||= {}
raise "options must be a Hash" unless doQueryOptions.is_a?(Hash)
doQueryOptions["dbid"] ||= @dbid
doQueryOptions["fmt"] ||= "structured"
doQuery( doQueryOptions["dbid"],
doQueryOptions["query"],
... | [
"def",
"_doQueryHash",
"(",
"doQueryOptions",
")",
"doQueryOptions",
"||=",
"{",
"}",
"raise",
"\"options must be a Hash\"",
"unless",
"doQueryOptions",
".",
"is_a?",
"(",
"Hash",
")",
"doQueryOptions",
"[",
"\"dbid\"",
"]",
"||=",
"@dbid",
"doQueryOptions",
"[",
... | version of doQuery that takes a Hash of parameters | [
"version",
"of",
"doQuery",
"that",
"takes",
"a",
"Hash",
"of",
"parameters"
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L2129-L2142 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.downLoadFile | def downLoadFile( dbid, rid, fid, vid = "0" )
@dbid, @rid, @fid, @vid = dbid, rid, fid, vid
@downLoadFileURL = "http://#{@org}.#{@domain}.com/up/#{dbid}/a/r#{rid}/e#{fid}/v#{vid}"
if @useSSL
@downLoadFileURL.gsub!( "http:", "https:" )
end
@requestHeaders = { "C... | ruby | def downLoadFile( dbid, rid, fid, vid = "0" )
@dbid, @rid, @fid, @vid = dbid, rid, fid, vid
@downLoadFileURL = "http://#{@org}.#{@domain}.com/up/#{dbid}/a/r#{rid}/e#{fid}/v#{vid}"
if @useSSL
@downLoadFileURL.gsub!( "http:", "https:" )
end
@requestHeaders = { "C... | [
"def",
"downLoadFile",
"(",
"dbid",
",",
"rid",
",",
"fid",
",",
"vid",
"=",
"\"0\"",
")",
"@dbid",
",",
"@rid",
",",
"@fid",
",",
"@vid",
"=",
"dbid",
",",
"rid",
",",
"fid",
",",
"vid",
"@downLoadFileURL",
"=",
"\"http://#{@org}.#{@domain}.com/up/#{dbid}... | Download a file's contents from a file attachment field in QuickBase.
You must write the contents to disk before a local file exists. | [
"Download",
"a",
"file",
"s",
"contents",
"from",
"a",
"file",
"attachment",
"field",
"in",
"QuickBase",
".",
"You",
"must",
"write",
"the",
"contents",
"to",
"disk",
"before",
"a",
"local",
"file",
"exists",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L2163-L2206 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.downloadAndSaveFile | def downloadAndSaveFile( dbid, rid, fid, filename = nil, vid = "0" )
response, fileContents = downLoadFile( dbid, rid, fid, vid )
if fileContents and fileContents.length > 0
if filename and filename.length > 0
Misc.save_file( filename, fileContents )
else
rec... | ruby | def downloadAndSaveFile( dbid, rid, fid, filename = nil, vid = "0" )
response, fileContents = downLoadFile( dbid, rid, fid, vid )
if fileContents and fileContents.length > 0
if filename and filename.length > 0
Misc.save_file( filename, fileContents )
else
rec... | [
"def",
"downloadAndSaveFile",
"(",
"dbid",
",",
"rid",
",",
"fid",
",",
"filename",
"=",
"nil",
",",
"vid",
"=",
"\"0\"",
")",
"response",
",",
"fileContents",
"=",
"downLoadFile",
"(",
"dbid",
",",
"rid",
",",
"fid",
",",
"vid",
")",
"if",
"fileConten... | Download and save a file from a file attachment field in QuickBase.
Use the filename parameter to override the file name from QuickBase. | [
"Download",
"and",
"save",
"a",
"file",
"from",
"a",
"file",
"attachment",
"field",
"in",
"QuickBase",
".",
"Use",
"the",
"filename",
"parameter",
"to",
"override",
"the",
"file",
"name",
"from",
"QuickBase",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L2218-L2232 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.fieldAddChoices | def fieldAddChoices( dbid, fid, choice )
@dbid, @fid, @choice = dbid, fid, choice
xmlRequestData = toXML( :fid, @fid )
if @choice.is_a?( Array )
@choice.each { |c| xmlRequestData << toXML( :choice, c ) }
elsif @choice.is_a?( String )
xmlRequestData << toXML( :choice... | ruby | def fieldAddChoices( dbid, fid, choice )
@dbid, @fid, @choice = dbid, fid, choice
xmlRequestData = toXML( :fid, @fid )
if @choice.is_a?( Array )
@choice.each { |c| xmlRequestData << toXML( :choice, c ) }
elsif @choice.is_a?( String )
xmlRequestData << toXML( :choice... | [
"def",
"fieldAddChoices",
"(",
"dbid",
",",
"fid",
",",
"choice",
")",
"@dbid",
",",
"@fid",
",",
"@choice",
"=",
"dbid",
",",
"fid",
",",
"choice",
"xmlRequestData",
"=",
"toXML",
"(",
":fid",
",",
"@fid",
")",
"if",
"@choice",
".",
"is_a?",
"(",
"A... | API_FieldAddChoices
The choice parameter can be one choice string or an array of choice strings. | [
"API_FieldAddChoices",
"The",
"choice",
"parameter",
"can",
"be",
"one",
"choice",
"string",
"or",
"an",
"array",
"of",
"choice",
"strings",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L2263-L2283 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.iterateDBPages | def iterateDBPages(dbid)
listDBPages(dbid){|page|
if page.is_a?( REXML::Element) and page.name == "page"
@pageid = page.attributes["id"]
@pagetype = page.attributes["type"]
@pagename = page.text if page.has_text?
@page = { "name... | ruby | def iterateDBPages(dbid)
listDBPages(dbid){|page|
if page.is_a?( REXML::Element) and page.name == "page"
@pageid = page.attributes["id"]
@pagetype = page.attributes["type"]
@pagename = page.text if page.has_text?
@page = { "name... | [
"def",
"iterateDBPages",
"(",
"dbid",
")",
"listDBPages",
"(",
"dbid",
")",
"{",
"|",
"page",
"|",
"if",
"page",
".",
"is_a?",
"(",
"REXML",
"::",
"Element",
")",
"and",
"page",
".",
"name",
"==",
"\"page\"",
"@pageid",
"=",
"page",
".",
"attributes",
... | Loop through the list of Pages for an application | [
"Loop",
"through",
"the",
"list",
"of",
"Pages",
"for",
"an",
"application"
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3128-L3138 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getAllValuesForFields | def getAllValuesForFields( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
if dbid
getSchema(dbid)
values = {}
fieldIDs = {}
if fieldNames and fieldNames.is_a?( String )
va... | ruby | def getAllValuesForFields( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
if dbid
getSchema(dbid)
values = {}
fieldIDs = {}
if fieldNames and fieldNames.is_a?( String )
va... | [
"def",
"getAllValuesForFields",
"(",
"dbid",
",",
"fieldNames",
"=",
"nil",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
",",
"optio... | Get all the values for one or more fields from a specified table.
e.g. getAllValuesForFields( "dhnju5y7", [ "Name", "Phone" ] )
The results are returned in Hash, e.g. { "Name" => values[ "Name" ], "Phone" => values[ "Phone" ] }
The parameters after 'fieldNames' are passed directly to the doQuery() API_ call.
In... | [
"Get",
"all",
"the",
"values",
"for",
"one",
"or",
"more",
"fields",
"from",
"a",
"specified",
"table",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3339-L3413 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getAllValuesForFieldsAsArray | def getAllValuesForFieldsAsArray( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
ret = []
valuesForFields = getAllValuesForFields(dbid, fieldNames, query, qid, qname, clist, slist,fmt,options)
if valuesForFields
f... | ruby | def getAllValuesForFieldsAsArray( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
ret = []
valuesForFields = getAllValuesForFields(dbid, fieldNames, query, qid, qname, clist, slist,fmt,options)
if valuesForFields
f... | [
"def",
"getAllValuesForFieldsAsArray",
"(",
"dbid",
",",
"fieldNames",
"=",
"nil",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
",",
... | Get all the values for one or more fields from a specified table.
This also formats the field values instead of returning the raw value. | [
"Get",
"all",
"the",
"values",
"for",
"one",
"or",
"more",
"fields",
"from",
"a",
"specified",
"table",
".",
"This",
"also",
"formats",
"the",
"field",
"values",
"instead",
"of",
"returning",
"the",
"raw",
"value",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3419-L3437 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getAllValuesForFieldsAsJSON | def getAllValuesForFieldsAsJSON( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
ret = getAllValuesForFieldsAsArray(dbid,fieldNames,query,qid,qname,clist,slist,fmt,options)
ret = JSON.generate(ret) if ret
end | ruby | def getAllValuesForFieldsAsJSON( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
ret = getAllValuesForFieldsAsArray(dbid,fieldNames,query,qid,qname,clist,slist,fmt,options)
ret = JSON.generate(ret) if ret
end | [
"def",
"getAllValuesForFieldsAsJSON",
"(",
"dbid",
",",
"fieldNames",
"=",
"nil",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
",",
... | Get all the values for one or more fields from a specified table, in JSON format.
This formats the field values instead of returning raw values. | [
"Get",
"all",
"the",
"values",
"for",
"one",
"or",
"more",
"fields",
"from",
"a",
"specified",
"table",
"in",
"JSON",
"format",
".",
"This",
"formats",
"the",
"field",
"values",
"instead",
"of",
"returning",
"raw",
"values",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3443-L3446 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getAllValuesForFieldsAsPrettyJSON | def getAllValuesForFieldsAsPrettyJSON( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
ret = getAllValuesForFieldsAsArray(dbid,fieldNames,query,qid,qname,clist,slist,fmt,options)
ret = JSON.pretty_generate(ret) if ret
end | ruby | def getAllValuesForFieldsAsPrettyJSON( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
ret = getAllValuesForFieldsAsArray(dbid,fieldNames,query,qid,qname,clist,slist,fmt,options)
ret = JSON.pretty_generate(ret) if ret
end | [
"def",
"getAllValuesForFieldsAsPrettyJSON",
"(",
"dbid",
",",
"fieldNames",
"=",
"nil",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
"... | Get all the values for one or more fields from a specified table, in human-readable JSON format.
This formats the field values instead of returning raw values. | [
"Get",
"all",
"the",
"values",
"for",
"one",
"or",
"more",
"fields",
"from",
"a",
"specified",
"table",
"in",
"human",
"-",
"readable",
"JSON",
"format",
".",
"This",
"formats",
"the",
"field",
"values",
"instead",
"of",
"returning",
"raw",
"values",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3452-L3455 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getSummaryRecords | def getSummaryRecords( dbid, fieldNames,query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
summaryRecords = []
iterateSummaryRecords(dbid, fieldNames,query, qid, qname, clist, slist, fmt = "structured", options){|summaryRecord|
summaryRecords << su... | ruby | def getSummaryRecords( dbid, fieldNames,query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
summaryRecords = []
iterateSummaryRecords(dbid, fieldNames,query, qid, qname, clist, slist, fmt = "structured", options){|summaryRecord|
summaryRecords << su... | [
"def",
"getSummaryRecords",
"(",
"dbid",
",",
"fieldNames",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
",",
"options",
"=",
"nil",... | Collect summary records into an array. | [
"Collect",
"summary",
"records",
"into",
"an",
"array",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3836-L3842 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.iterateRecordInfos | def iterateRecordInfos(dbid, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
getSchema(dbid)
recordIDFieldName = lookupFieldNameFromID("3")
fieldNames = getFieldNames
fieldIDs = {}
fieldNames.each{|name|fieldIDs[name] = lookupFieldIDBy... | ruby | def iterateRecordInfos(dbid, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
getSchema(dbid)
recordIDFieldName = lookupFieldNameFromID("3")
fieldNames = getFieldNames
fieldIDs = {}
fieldNames.each{|name|fieldIDs[name] = lookupFieldIDBy... | [
"def",
"iterateRecordInfos",
"(",
"dbid",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
",",
"options",
"=",
"nil",
")",
"getSchema",... | Loop through a list of records returned from a query.
Each record will contain all the fields with values formatted for readability by QuickBase via API_GetRecordInfo. | [
"Loop",
"through",
"a",
"list",
"of",
"records",
"returned",
"from",
"a",
"query",
".",
"Each",
"record",
"will",
"contain",
"all",
"the",
"fields",
"with",
"values",
"formatted",
"for",
"readability",
"by",
"QuickBase",
"via",
"API_GetRecordInfo",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3846-L3861 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.applyPercentToRecords | def applyPercentToRecords( dbid, numericField, percentField,
query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
fieldNames = Array[numericField]
total = sum( dbid, fieldNames, query, qid, qname, clist, slist, fm... | ruby | def applyPercentToRecords( dbid, numericField, percentField,
query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
fieldNames = Array[numericField]
total = sum( dbid, fieldNames, query, qid, qname, clist, slist, fm... | [
"def",
"applyPercentToRecords",
"(",
"dbid",
",",
"numericField",
",",
"percentField",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
",... | Query records, sum the values in a numeric field, calculate each record's percentage
of the sum and put the percent in a percent field each record. | [
"Query",
"records",
"sum",
"the",
"values",
"in",
"a",
"numeric",
"field",
"calculate",
"each",
"record",
"s",
"percentage",
"of",
"the",
"sum",
"and",
"put",
"the",
"percent",
"in",
"a",
"percent",
"field",
"each",
"record",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4105-L4116 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.applyDeviationToRecords | def applyDeviationToRecords( dbid, numericField, deviationField,
query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
fieldNames = Array[numericField]
avg = average( dbid, fieldNames, query, qid, qname, clist, ... | ruby | def applyDeviationToRecords( dbid, numericField, deviationField,
query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
fieldNames = Array[numericField]
avg = average( dbid, fieldNames, query, qid, qname, clist, ... | [
"def",
"applyDeviationToRecords",
"(",
"dbid",
",",
"numericField",
",",
"deviationField",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
... | Query records, get the average of the values in a numeric field, calculate each record's deviation
from the average and put the deviation in a percent field each record. | [
"Query",
"records",
"get",
"the",
"average",
"of",
"the",
"values",
"in",
"a",
"numeric",
"field",
"calculate",
"each",
"record",
"s",
"deviation",
"from",
"the",
"average",
"and",
"put",
"the",
"deviation",
"in",
"a",
"percent",
"field",
"each",
"record",
... | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4120-L4131 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.percent | def percent( inputValues )
raise "'inputValues' must not be nil" if inputValues.nil?
raise "'inputValues' must be an Array" if not inputValues.is_a?(Array)
raise "'inputValues' must have at least two elements" if inputValues.length < 2
total = inputValues[0].to_f
total = 1.0 if total ... | ruby | def percent( inputValues )
raise "'inputValues' must not be nil" if inputValues.nil?
raise "'inputValues' must be an Array" if not inputValues.is_a?(Array)
raise "'inputValues' must have at least two elements" if inputValues.length < 2
total = inputValues[0].to_f
total = 1.0 if total ... | [
"def",
"percent",
"(",
"inputValues",
")",
"raise",
"\"'inputValues' must not be nil\"",
"if",
"inputValues",
".",
"nil?",
"raise",
"\"'inputValues' must be an Array\"",
"if",
"not",
"inputValues",
".",
"is_a?",
"(",
"Array",
")",
"raise",
"\"'inputValues' must have at le... | Given an array of two numbers, return the second number as a percentage of the first number. | [
"Given",
"an",
"array",
"of",
"two",
"numbers",
"return",
"the",
"second",
"number",
"as",
"a",
"percentage",
"of",
"the",
"first",
"number",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4134-L4142 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.deviation | def deviation( inputValues )
raise "'inputValues' must not be nil" if inputValues.nil?
raise "'inputValues' must be an Array" if not inputValues.is_a?(Array)
raise "'inputValues' must have at least two elements" if inputValues.length < 2
value = inputValues[0].to_f - inputValues[1].to_f
... | ruby | def deviation( inputValues )
raise "'inputValues' must not be nil" if inputValues.nil?
raise "'inputValues' must be an Array" if not inputValues.is_a?(Array)
raise "'inputValues' must have at least two elements" if inputValues.length < 2
value = inputValues[0].to_f - inputValues[1].to_f
... | [
"def",
"deviation",
"(",
"inputValues",
")",
"raise",
"\"'inputValues' must not be nil\"",
"if",
"inputValues",
".",
"nil?",
"raise",
"\"'inputValues' must be an Array\"",
"if",
"not",
"inputValues",
".",
"is_a?",
"(",
"Array",
")",
"raise",
"\"'inputValues' must have at ... | Given an array of two numbers, return the difference between the numbers as a positive number. | [
"Given",
"an",
"array",
"of",
"two",
"numbers",
"return",
"the",
"difference",
"between",
"the",
"numbers",
"as",
"a",
"positive",
"number",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4145-L4151 | train |
garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getFieldChoices | def getFieldChoices(dbid,fieldName=nil,fid=nil)
getSchema(dbid)
if fieldName
fid = lookupFieldIDByName(fieldName)
elsif not fid
raise "'fieldName' or 'fid' must be specified"
end
field = lookupField( fid )
if field
choices = []
choicesPro... | ruby | def getFieldChoices(dbid,fieldName=nil,fid=nil)
getSchema(dbid)
if fieldName
fid = lookupFieldIDByName(fieldName)
elsif not fid
raise "'fieldName' or 'fid' must be specified"
end
field = lookupField( fid )
if field
choices = []
choicesPro... | [
"def",
"getFieldChoices",
"(",
"dbid",
",",
"fieldName",
"=",
"nil",
",",
"fid",
"=",
"nil",
")",
"getSchema",
"(",
"dbid",
")",
"if",
"fieldName",
"fid",
"=",
"lookupFieldIDByName",
"(",
"fieldName",
")",
"elsif",
"not",
"fid",
"raise",
"\"'fieldName' or 'f... | Get an array of the existing choices for a multiple-choice text field. | [
"Get",
"an",
"array",
"of",
"the",
"existing",
"choices",
"for",
"a",
"multiple",
"-",
"choice",
"text",
"field",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4154-L4177 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.