_id stringlengths 2 6 | title stringlengths 9 130 | partition stringclasses 3
values | text stringlengths 30 4.3k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q18500 | Goodreads.Groups.group | train | def group(group_id)
data = request("/group/show", | ruby | {
"resource": ""
} |
q18501 | Goodreads.Groups.group_list | train | def group_list(user_id, sort = "my_activity")
data = request("/group/list", id: user_id, sort: sort)
| ruby | {
"resource": ""
} |
q18502 | Goodreads.Users.user | train | def user(id)
data = request("/user/show", | ruby | {
"resource": ""
} |
q18503 | Goodreads.Friends.friends | train | def friends(user_id, options={})
data = oauth_request("/friend/user/#{user_id}", options)
| ruby | {
"resource": ""
} |
q18504 | Goodreads.Reviews.recent_reviews | train | def recent_reviews(params = {})
skip_cropped = params.delete(:skip_cropped) || false
data = request("/review/recent_reviews", params)
return unless | ruby | {
"resource": ""
} |
q18505 | Goodreads.Reviews.review | train | def review(id)
data = request("/review/show", | ruby | {
"resource": ""
} |
q18506 | Goodreads.Reviews.reviews | train | def reviews(params = {})
data = request("/review/list", params.merge(v: "2"))
reviews = data["reviews"]["review"]
if reviews.present?
reviews.map | ruby | {
"resource": ""
} |
q18507 | Goodreads.Reviews.user_review | train | def user_review(user_id, book_id, params = {})
data = request('/review/show_by_user_and_book.xml', params.merge(v: "2", user_id: user_id, | ruby | {
"resource": ""
} |
q18508 | Goodreads.Reviews.create_review | train | def create_review(book_id, params = {})
params = params.merge(book_id: book_id, v: "2")
params[:read_at] = params[:read_at].strftime('%Y-%m-%d') if params[:read_at].is_a?(Time)
params[:'review[review]'] = params.delete(:review) if params[:review]
params[:'review[rating]'] = params.delete(:rati... | ruby | {
"resource": ""
} |
q18509 | Goodreads.Reviews.edit_review | train | def edit_review(review_id, params = {})
params = params.merge(v: "2")
params[:read_at] = params[:read_at].strftime('%Y-%m-%d') if params[:read_at].is_a?(Time)
params[:'review[review]'] = params.delete(:review) if params[:review]
params[:'review[rating]'] = params.delete(:rating) | ruby | {
"resource": ""
} |
q18510 | Goodreads.Books.search_books | train | def search_books(query, params = {})
params[:q] = query.to_s.strip
data = request("/search/index", | ruby | {
"resource": ""
} |
q18511 | Goodreads.Authors.author | train | def author(id, params = {})
params[:id] = id
| ruby | {
"resource": ""
} |
q18512 | Goodreads.Authors.author_by_name | train | def author_by_name(name, params = {})
params[:id] = name
name_encoded = URI.encode(name) | ruby | {
"resource": ""
} |
q18513 | PacketGen.Packet.insert | train | def insert(prev, protocol, options={})
klass = check_protocol(protocol)
nxt = prev.body
header = klass.new(options.merge!(packet: self))
add_header header, previous_header: prev
idx | ruby | {
"resource": ""
} |
q18514 | PacketGen.Packet.encapsulate | train | def encapsulate(other, parsing: false)
other.headers.each_with_index do |h, i|
| ruby | {
"resource": ""
} |
q18515 | PacketGen.Packet.decapsulate | train | def decapsulate(*hdrs)
hdrs.each do |hdr|
idx = headers.index(hdr)
raise FormatError, 'header not in packet!' if idx.nil?
prev_hdr = idx > 0 ? headers[idx - 1] : nil
next_hdr = (idx + 1) < headers.size ? headers[idx + 1] : nil
headers.delete_at(idx)
| ruby | {
"resource": ""
} |
q18516 | PacketGen.Packet.parse | train | def parse(binary_str, first_header: nil)
headers.clear
if first_header.nil?
# No decoding forced for first header. Have to guess it!
first_header = guess_first_header(binary_str)
if first_header.nil?
raise ParseError, 'cannot identify first header in string'
| ruby | {
"resource": ""
} |
q18517 | PacketGen.Packet.inspect | train | def inspect
str = Inspect.dashed_line(self.class)
headers.each do |header|
str << header.inspect
| ruby | {
"resource": ""
} |
q18518 | PacketGen.Packet.check_protocol | train | def check_protocol(protocol)
klass = Header.get_header_class_by_name(protocol)
raise ArgumentError, "unknown | ruby | {
"resource": ""
} |
q18519 | PacketGen.Packet.add_header | train | def add_header(header, previous_header: nil, parsing: false)
prev_header = previous_header || last_header
if prev_header
bindings = prev_header.class.known_headers[header.class]
bindings = prev_header.class.known_headers[header.class.superclass] if bindings.nil?
if bindings.nil?
... | ruby | {
"resource": ""
} |
q18520 | PacketGen.Packet.guess_first_header | train | def guess_first_header(binary_str)
first_header = nil
Header.all.each do |hklass|
hdr = hklass.new(packet: self)
# #read may return another object (more specific class)
hdr = hdr.read(binary_str)
# First header is found when, for one known header,
# * +#parse?+ is tru... | ruby | {
"resource": ""
} |
q18521 | PacketGen.Packet.decode_bottom_up | train | def decode_bottom_up
loop do
last_known_hdr = last_header
break if !last_known_hdr.respond_to?(:body) || last_known_hdr.body.empty?
nh = search_upper_header(last_known_hdr)
break if nh.nil?
nheader = nh.new(packet: self)
nheader = nheader.read(last_known_hdr.body)... | ruby | {
"resource": ""
} |
q18522 | PacketGen.Packet.search_upper_header | train | def search_upper_header(hdr)
hdr.class.known_headers.each do |nh, bindings|
| ruby | {
"resource": ""
} |
q18523 | RailsWorkflow.ProcessTemplate.dependent_operations | train | def dependent_operations(operation)
operations.select do |top|
top.dependencies.select do |dp|
dp['id'] == operation.template.id &&
| ruby | {
"resource": ""
} |
q18524 | RailsWorkflow.ErrorBuilder.target | train | def target
@target ||= begin
parent = context[:parent]
if parent.is_a? RailsWorkflow::Operation
parent.becomes(RailsWorkflow::Operation)
| ruby | {
"resource": ""
} |
q18525 | Natto.MeCabStruct.method_missing | train | def method_missing(attr_name)
member_sym = attr_name.id2name.to_sym
self[member_sym]
| ruby | {
"resource": ""
} |
q18526 | Natto.MeCab.parse | train | def parse(text, constraints={})
if text.nil?
raise ArgumentError.new 'Text to parse cannot be nil'
elsif constraints[:boundary_constraints]
if !(constraints[:boundary_constraints].is_a?(Regexp) ||
constraints[:boundary_constraints].is_a?(String))
raise ArgumentError.ne... | ruby | {
"resource": ""
} |
q18527 | Flapjack.Utility.truncate | train | def truncate(str, length, options = {})
text = str.dup
options[:omission] ||= "..."
length_with_room_for_omission = length - options[:omission].length
stop = options[:separator] ?
(text.rindex(options[:separator], length_with_room_for_omission) || | ruby | {
"resource": ""
} |
q18528 | Flapjack.Notifier.process_notification | train | def process_notification(notification)
Flapjack.logger.debug { "Processing notification: #{notification.inspect}" }
check = notification.check
check_name = check.name
# TODO check whether time should come from something stored in the notification
alerts = alerts_for(notification, ... | ruby | {
"resource": ""
} |
q18529 | Flapjack.Coordinator.setup_signals | train | def setup_signals
Kernel.trap('INT') { Thread.new { @shutdown.call(Signal.list['INT']) }.join }
Kernel.trap('TERM') { Thread.new { @shutdown.call(Signal.list['TERM']) }.join }
| ruby | {
"resource": ""
} |
q18530 | Khipu.BaseObject.build_from_hash | train | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /^Array<(.*)>/i
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v... | ruby | {
"resource": ""
} |
q18531 | Khipu.BaseObject.to_hash | train | def to_hash
hash = {}
attributes = self.class.attribute_map.sort_by {|key,value| key}
attributes.each { |attr, param|
value = self.send(attr)
| ruby | {
"resource": ""
} |
q18532 | Heroics.CLI.run | train | def run(*parameters)
name = parameters.shift
if name.nil? || name == 'help'
if command_name = parameters.first
command = @commands[command_name]
command.usage | ruby | {
"resource": ""
} |
q18533 | Heroics.Command.run | train | def run(*parameters)
resource_name = @link_schema.resource_name
name = @link_schema.name
result = @client.send(resource_name).send(name, *parameters)
result = result.to_a if result.instance_of?(Enumerator)
if | ruby | {
"resource": ""
} |
q18534 | Heroics.Link.run | train | def run(*parameters)
path, body = @link_schema.format_path(parameters)
path = "#{@path_prefix}#{path}" unless @path_prefix == '/'
headers = @default_headers
if body
case @link_schema.method
when :put, :post, :patch
headers = headers.merge({'Content-Type' => @link_schema... | ruby | {
"resource": ""
} |
q18535 | Heroics.Link.unpack_url | train | def unpack_url(url)
root_url = []
path_prefix = ''
parts = URI.split(url)
root_url << "#{parts[0]}://"
root_url << "#{parts[1]}@" unless parts[1].nil?
root_url << "#{parts[2]}"
| ruby | {
"resource": ""
} |
q18536 | Heroics.Client.method_missing | train | def method_missing(name)
name = name.to_s
resource = @resources[name]
if resource.nil?
# Find the name using the same ruby_name replacement semantics as when
# we set up the @resources hash
name = Heroics.ruby_name(name)
resource | ruby | {
"resource": ""
} |
q18537 | Heroics.Resource.method_missing | train | def method_missing(name, *parameters)
link = @links[name.to_s]
if link.nil?
address = "<#{self.class.name}:0x00#{(self.object_id << 1).to_s(16)}>"
| ruby | {
"resource": ""
} |
q18538 | Heroics.Schema.resource | train | def resource(name)
if @schema['definitions'].has_key?(name)
ResourceSchema.new(@schema, name) | ruby | {
"resource": ""
} |
q18539 | Heroics.LinkSchema.example_body | train | def example_body
if body_schema = link_schema['schema']
definitions = @schema['definitions'][@resource_name]['definitions']
Hash[body_schema['properties'].keys.map do |property|
# FIXME This is wrong! -jkakar
if definitions.has_key?(property)
| ruby | {
"resource": ""
} |
q18540 | Heroics.LinkSchema.format_path | train | def format_path(parameters)
path = link_schema['href']
parameter_size = path.scan(PARAMETER_REGEX).size
too_few_parameters = parameter_size > parameters.size
# FIXME We should use the schema to detect when a request body is
# permitted and do the calculation correctly here. -jkakar
| ruby | {
"resource": ""
} |
q18541 | Heroics.LinkSchema.resolve_parameters | train | def resolve_parameters(parameters)
properties = @schema['definitions'][@resource_name]['properties']
return [''] if properties.nil?
definitions = Hash[properties.each_pair.map do |key, value|
[value['$ref'], key]
end]
parameters.map do |paramet... | ruby | {
"resource": ""
} |
q18542 | Heroics.LinkSchema.resolve_parameter_details | train | def resolve_parameter_details(parameters)
parameters.map do |parameter|
# URI decode parameters and strip the leading '{(' and trailing ')}'.
parameter = URI.unescape(parameter[2..-3])
# Split the path into components and discard the leading '#' that
# represents the root of the s... | ruby | {
"resource": ""
} |
q18543 | Heroics.LinkSchema.unpack_multiple_parameters | train | def unpack_multiple_parameters(parameters)
parameters.map do |info|
parameter = info['$ref']
path = parameter.split('/')[1..-1]
info = lookup_parameter(path, @schema)
| ruby | {
"resource": ""
} |
q18544 | Heroics.LinkSchema.lookup_parameter | train | def lookup_parameter(path, schema)
key = path[0]
remaining = path[1..-1]
if remaining.empty?
return schema[key]
| ruby | {
"resource": ""
} |
q18545 | Heroics.LinkSchema.format_parameter | train | def format_parameter(parameter)
formatted_parameter = parameter.instance_of?(Time) | ruby | {
"resource": ""
} |
q18546 | Heroics.GeneratorLink.method_signature | train | def method_signature
@parameters.map { |info| info.name | ruby | {
"resource": ""
} |
q18547 | Cri.CommandDSL.option | train | def option(short, long, desc,
argument: :forbidden,
multiple: false,
hidden: false,
default: nil,
transform: nil,
&block)
@command.option_definitions << Cri::OptionDefinition.new(
short: short&.to_s,
long: lo... | ruby | {
"resource": ""
} |
q18548 | Cri.CommandDSL.param | train | def param(name, transform: nil)
if @command.explicitly_no_params?
raise AlreadySpecifiedAsNoParams.new(name, @command) | ruby | {
"resource": ""
} |
q18549 | Cri.CommandDSL.required | train | def required(short, long, desc, params = {}, &block)
params = params.merge(argument: :required)
| ruby | {
"resource": ""
} |
q18550 | Cri.Parser.run | train | def run
@running = true
while running?
# Get next item
e = @unprocessed_arguments_and_options.shift
break if e.nil?
if e == '--'
handle_dashdash(e)
elsif e =~ /^--./ && !@no_more_options
handle_dashdash_option(e)
elsif e =~ | ruby | {
"resource": ""
} |
q18551 | Cri.StringFormatter.wrap_and_indent | train | def wrap_and_indent(str, width, indentation, first_line_already_indented = false)
indented_width = width - indentation
indent = ' ' * indentation
# Split into paragraphs
paragraphs = to_paragraphs(str)
# Wrap and indent each paragraph
text = paragraphs.map do |paragraph|
# I... | ruby | {
"resource": ""
} |
q18552 | Cri.HelpRenderer.render | train | def render
text = +''
append_summary(text)
append_usage(text)
append_description(text)
| ruby | {
"resource": ""
} |
q18553 | Cri.Command.modify | train | def modify(&block)
dsl = Cri::CommandDSL.new(self)
if [-1, 0].include? block.arity
| ruby | {
"resource": ""
} |
q18554 | Cri.Command.define_command | train | def define_command(name = nil, &block)
# Execute DSL
dsl = Cri::CommandDSL.new
dsl.name name unless name.nil?
| ruby | {
"resource": ""
} |
q18555 | Cri.Command.commands_named | train | def commands_named(name)
# Find by exact name or alias
@commands.each do |cmd|
found = cmd.name == name || cmd.aliases.include?(name)
return [cmd] if found
| ruby | {
"resource": ""
} |
q18556 | Cri.Command.run | train | def run(opts_and_args, parent_opts = {}, hard_exit: true)
# Parse up to command name
stuff = partition(opts_and_args)
opts_before_subcmd, subcmd_name, opts_and_args_after_subcmd = *stuff
if subcommands.empty? || (subcmd_name.nil? && !block.nil?)
run_this(opts_and_args, parent_opts)
... | ruby | {
"resource": ""
} |
q18557 | Cri.Command.run_this | train | def run_this(opts_and_args, parent_opts = {})
if all_opts_as_args?
args = opts_and_args
global_opts = parent_opts
else
# Parse
parser = Cri::Parser.new(
opts_and_args,
global_option_definitions,
parameter_definitions,
explicitly_no_para... | ruby | {
"resource": ""
} |
q18558 | PuppetDebugger.Support.parse_error | train | def parse_error(error)
case error
when SocketError
PuppetDebugger::Exception::ConnectError.new(message: "Unknown host: #{Puppet[:server]}")
when Net::HTTPError
PuppetDebugger::Exception::AuthError.new(message: error.message)
when Errno::ECONNREFUSED
PuppetDebugger::Except... | ruby | {
"resource": ""
} |
q18559 | PuppetDebugger.Support.puppet_repl_lib_dir | train | def puppet_repl_lib_dir
File.expand_path(File.join(File.dirname(File.dirname(Fi | ruby | {
"resource": ""
} |
q18560 | PuppetDebugger.Support.do_initialize | train | def do_initialize
Puppet.initialize_settings
Puppet[:parser] = 'future' # this is required in order to work with puppet 3.8
Puppet[:trusted_node_data] = true
rescue ArgumentError => | ruby | {
"resource": ""
} |
q18561 | PuppetDebugger.Cli.key_words | train | def key_words
# because dollar signs don't work we can't display a $ sign in the keyword
# list so its not explicitly clear what the keyword
variables = scope.to_hash.keys
# prepend a :: to topscope variables
scoped_vars = variables.map { |k, _v| scope.compiler.topscope.exist?(k) ? "$::#{k... | ruby | {
"resource": ""
} |
q18562 | PuppetDebugger.Cli.to_resource_declaration | train | def to_resource_declaration(type)
if type.respond_to?(:type_name) && type.respond_to?(:title)
title = type.title
type_name = type.type_name
elsif type_result = /(\w+)\['?(\w+)'?\]/.match(type.to_s)
# not all types have a type_name and title so we
# output to a string and pars... | ruby | {
"resource": ""
} |
q18563 | PuppetDebugger.Cli.expand_resource_type | train | def expand_resource_type(types)
output = [types].flatten.map do |t|
if t.class.to_s =~ /Puppet::Pops::Types/
| ruby | {
"resource": ""
} |
q18564 | PuppetDebugger.Cli.handle_input | train | def handle_input(input)
raise ArgumentError unless input.instance_of?(String)
begin
output = ''
case input.strip
when PuppetDebugger::InputResponders::Commands.command_list_regex
args = input.split(' ')
command = args.shift
plugin = PuppetDebugger::Input... | ruby | {
"resource": ""
} |
q18565 | PuppetDebugger.Cli.read_loop | train | def read_loop
line_number = 1
full_buffer = ''
while buf = Readline.readline("#{line_number}:#{extra_prompt}>> ", true)
begin
full_buffer += buf
# unless this is puppet code, otherwise skip repl keywords
unless PuppetDebugger::InputResponders::Commands.command_lis... | ruby | {
"resource": ""
} |
q18566 | OEmbed.HttpHelper.http_get | train | def http_get(uri, options = {})
found = false
remaining_redirects = options[:max_redirects] ? options[:max_redirects].to_i : 4
until found
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == 'https'
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
http.rea... | ruby | {
"resource": ""
} |
q18567 | AwesomePrint.Puppet.cast_with_puppet_resource | train | def cast_with_puppet_resource(object, type)
cast = cast_without_puppet_resource(object, type)
# check the object to see if it has an acestor (< ) of the specified type
if defined?(::Puppet::Type) && (object.class < ::Puppet::Type)
cast = :puppet_type
elsif defined?(::Puppet::Pops::Types)... | ruby | {
"resource": ""
} |
q18568 | PuppetDebugger.Hooks.initialize_copy | train | def initialize_copy(orig)
hooks_dup = @hooks.dup
@hooks.each do |k, v|
| ruby | {
"resource": ""
} |
q18569 | PuppetDebugger.Hooks.add_hook | train | def add_hook(event_name, hook_name, callable=nil, &block)
event_name = event_name.to_s
# do not allow duplicates, but allow multiple `nil` hooks
# (anonymous hooks)
if hook_exists?(event_name, hook_name) && !hook_name.nil?
raise ArgumentError, "Hook with name '#{hook_name}' already defi... | ruby | {
"resource": ""
} |
q18570 | PuppetDebugger.Hooks.exec_hook | train | def exec_hook(event_name, *args, &block)
@hooks[event_name.to_s].map do |hook_name, callable|
begin
callable.call(*args, &block)
rescue | ruby | {
"resource": ""
} |
q18571 | SFRest.Task.task_status | train | def task_status(task_id)
current_path = "/api/v1/wip/task/#{task_id}/status"
res = @conn.get(current_path)
raise InvalidDataError, "No wip task returned for task id #{task_id}" if res['wip_task'].nil?
raise InvalidDataError, | ruby | {
"resource": ""
} |
q18572 | SFRest.Task.find_task_ids | train | def find_task_ids(limit = nil, page = nil, group = nil, klass = nil, status = nil)
res = find_tasks limit: limit, page: page, group: | ruby | {
"resource": ""
} |
q18573 | SFRest.Task.find_tasks | train | def find_tasks(datum = nil)
current_path = '/api/v1/tasks'
pb = SFRest::Pathbuilder.new
@conn.get | ruby | {
"resource": ""
} |
q18574 | SFRest.Task.globally_paused? | train | def globally_paused?
paused = false
current_path = '/api/v1/variables?name=wip_pause_global'
begin
res = @conn.get(current_path)
paused = res['wip_pause_global']
rescue | ruby | {
"resource": ""
} |
q18575 | SFRest.Task.pause_task | train | def pause_task(task_id, level = 'family')
current_path = '/api/v1/pause/' << task_id.to_s | ruby | {
"resource": ""
} |
q18576 | SFRest.Task.resume_task | train | def resume_task(task_id, level = 'family')
current_path = '/api/v1/pause/' << task_id.to_s | ruby | {
"resource": ""
} |
q18577 | SFRest.Task.wait_until_state | train | def wait_until_state(task_id, state, max_nap)
blink_time = 5 # wake up and scan
nap_start = Time.now
state_method = method("task_#{state}?".to_sym)
| ruby | {
"resource": ""
} |
q18578 | SFRest.Collection.collection_list | train | def collection_list
page = 1
not_done = true
count = 0
while not_done
current_path = '/api/v1/collections?page=' << page.to_s
res = @conn.get(current_path)
if res['collections'] == []
not_done = false
elsif !res['message'].nil?
return { 'messag... | ruby | {
"resource": ""
} |
q18579 | SFRest.Collection.create | train | def create(name, sites, groups, internal_domain_prefix = nil)
sites = Array(sites)
groups = Array(groups)
current_path = '/api/v1/collections'
| ruby | {
"resource": ""
} |
q18580 | SFRest.Collection.set_primary_site | train | def set_primary_site(id, site)
payload = { 'site_id' => site }.to_json | ruby | {
"resource": ""
} |
q18581 | SFRest.Update.modify_status | train | def modify_status(site_creation, site_duplication, domain_management, bulk_operations)
current_path = '/api/v1/status'
payload = { 'site_creation' => site_creation,
'site_duplication' => site_duplication,
| ruby | {
"resource": ""
} |
q18582 | SFRest.Update.start_update | train | def start_update(ref)
if update_version == 'v2'
raise InvalidApiVersion, 'There is more than one codebase use sfrest.update.update directly.'
end
update_data | ruby | {
"resource": ""
} |
q18583 | SFRest.Group.group_list | train | def group_list
page = 1
not_done = true
count = 0
while not_done
current_path = '/api/v1/groups?page=' << page.to_s
res = @conn.get(current_path)
if res['groups'] == []
not_done = false
| ruby | {
"resource": ""
} |
q18584 | SFRest.User.get_user_id | train | def get_user_id(username)
pglimit = 100
res = @conn.get('/api/v1/users&limit=' + pglimit.to_s)
usercount = res['count'].to_i
id = user_data_from_results(res, username, 'uid')
return id if id
pages = (usercount / pglimit) + 1
2.upto(pages) do |i|
| ruby | {
"resource": ""
} |
q18585 | SFRest.User.user_data_from_results | train | def user_data_from_results(res, username, key)
users = res['users']
users.each do |user|
return | ruby | {
"resource": ""
} |
q18586 | SFRest.User.create_user | train | def create_user(name, email, datum = nil)
current_path = '/api/v1/users'
payload = { name: name, mail: email }
| ruby | {
"resource": ""
} |
q18587 | SFRest.Stage.staging_versions | train | def staging_versions
possible_versions = [1, 2]
@versions ||= []
possible_versions.each do |version|
| ruby | {
"resource": ""
} |
q18588 | SFRest.Connection.put | train | def put(uri, payload)
headers = { 'Content-Type' => 'application/json' }
res = Excon.put(@base_url + uri.to_s,
headers: headers,
user: username,
| ruby | {
"resource": ""
} |
q18589 | SFRest.Connection.delete | train | def delete(uri)
headers = { 'Content-Type' => 'application/json' }
res = Excon.delete(@base_url + uri.to_s,
| ruby | {
"resource": ""
} |
q18590 | SFRest.Connection.api_response | train | def api_response(res, return_status = false)
data = access_check JSON(res.body), res.status
return_status ? [res.status, data] : data
rescue JSON::ParserError
message = | ruby | {
"resource": ""
} |
q18591 | SFRest.Pathbuilder.build_url_query | train | def build_url_query(current_path, datum = nil)
unless datum.nil?
| ruby | {
"resource": ""
} |
q18592 | SFRest.Variable.set_variable | train | def set_variable(name, value)
current_path = '/api/v1/variables'
payload = { 'name' | ruby | {
"resource": ""
} |
q18593 | SFRest.Site.site_list | train | def site_list(show_incomplete = true)
page = 1
not_done = true
count = 0
sites = []
while not_done
current_path = '/api/v1/sites?page=' << page.to_s
current_path <<= '&show_incomplete=true' if show_incomplete
res = @conn.get(current_path)
if res['sites'] == ... | ruby | {
"resource": ""
} |
q18594 | SFRest.Site.create_site | train | def create_site(sitename, group_id, install_profile = nil, codebase = nil)
current_path = '/api/v1/sites'
payload = { 'site_name' => sitename, 'group_ids' => [group_id],
| ruby | {
"resource": ""
} |
q18595 | SFRest.Role.get_role_id | train | def get_role_id(rolename)
pglimit = 100
res = @conn.get('/api/v1/roles&limit=' + pglimit.to_s)
rolecount = res['count'].to_i
id = role_data_from_results(res, rolename)
return id if id
pages = (rolecount / pglimit) + 1
2.upto(pages) do |i|
| ruby | {
"resource": ""
} |
q18596 | SFRest.Role.role_data_from_results | train | def role_data_from_results(res, rolename)
roles = res['roles']
| ruby | {
"resource": ""
} |
q18597 | Spree.BannerBox.duplicate | train | def duplicate
enhance_settings
p = self.dup
p.category = 'COPY OF ' + category
p.created_at = p.updated_at = nil
| ruby | {
"resource": ""
} |
q18598 | Learn.OptionsSanitizer.handle_missing_or_unknown_args | train | def handle_missing_or_unknown_args
if first_arg_not_a_flag_or_file?
exit_with_unknown_command
elsif has_output_flag? || has_format_flag?
check_for_output_file if has_output_flag?
| ruby | {
"resource": ""
} |
q18599 | Origin.Selectable.between | train | def between(criterion = nil)
selection(criterion) do |selector, field, value|
| ruby | {
"resource": ""
} |
Subsets and Splits
SQL Console for CoIR-Retrieval/CodeSearchNet-ccr-ruby-queries-corpus
Retrieves a large number of entries in the 'ruby' language, providing basic information but limited analytical value.