query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
Checks for multivalued fields, turns them into arrays, and combines all the values for the repeatable header.
|
def combine_multivalued_fields(uncombined_fields)
combined_fields = {}
uncombined_fields.each do |field|
normalized_header = normalize_header(field.header)
if multivalued?(normalized_header)
combined_fields[normalized_header] ||= Field.new(field.header, [])
combined_fields[normalized_header].value << field.value
else
combined_fields[normalized_header] ||= Field.new(field.header, field.value)
end
end
combined_fields.values
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def multiple_fields_to_one multfields, prefix=false\n vals = []\n multfields.each do |field, anotherval|\n if anotherval and not anotherval.empty? \n anotherval = anotherval.strip\n anotherval = field + \": #{anotherval}\" if prefix\n vals << anotherval\n end \n end\n vals.delete_if {|x| x.empty?}\n return vals * \", \" unless vals.empty?\n return nil\n end",
"def extract_multi_value_field(header, val, processed, key = nil)\n key ||= header.to_sym\n processed[key] ||= []\n val = val.strip\n # Workaround for https://jira.duraspace.org/browse/FCREPO-2038\n val.delete!(\"\\r\")\n processed[key] << (looks_like_uri?(val) && Image.controlled_properties.include?(header.to_sym) ? RDF::URI(val) : val)\n end",
"def extract_field(header, val, processed)\n return if val.blank?\n case header\n when 'type', 'accession_number', 'id', 'status', 'ark', 'call_number', 'preservation_level', 'visibility'\n # single valued fields\n processed[header.to_sym] = val\n when /^(created|issued|date_copyrighted|date_valid)_(.*)$/\n key = \"#{Regexp.last_match(1)}_attributes\".to_sym\n # TODO: this only handles one date of each type\n processed[key] ||= [{}]\n update_date(processed[key].first, Regexp.last_match(2), val)\n when 'collection_id'\n processed[:collections] ||= []\n processed[:collections] << { id: val }\n else\n last_entry = Array(processed[header.to_sym]).last\n if last_entry.is_a?(Hash) && !last_entry[:name]\n update_typed_field(header, val, processed)\n else\n extract_multi_value_field(header, val, processed)\n end\n end\n end",
"def transform_fields(desc,arr)\n if(arr.is_a?(Array))\n arr.each do |field| \n unless(field.is_a?(String) || field.is_a?(Symbol)) \n raise JiakSchemaException, \"#{desc} must be strings or symbols\"\n end\n end\n arr.map{|f| f.to_sym}.uniq\n elsif(arr.eql?(WILDCARD))\n arr\n else\n raise JiakSchemaException, \"#{desc} must be an array or WILDCARD\"\n end\n end",
"def mapping(header, result)\n\n warn(\"Header length = #{header.length} not equal to entry length = #{result[0].length}, some fields will missing!\") if header.length != result[0].length\n\n result_with_header = []\n\n result.each do |values|\n entry = {}\n i = 0\n header.each do |key|\n entry[key] = values[i]\n i += 1\n end\n\n result_with_header.push(entry)\n end\n\n result_with_header\n end",
"def add_to_multivalued_field( data, target, splitter )\n \n if data != nil\n data.split( splitter ).each do |entry|\n target.push( entry )\n end\n end\n \nend",
"def process_header_repeatable_field_names_do_not_have_numbers(header)\n\n child_field_group = nil\n\n first_field, rest_of_header = header.split(':',2)\n\n if first_field == header\n\n # we have a field name, i.e. a dynamic field\n # puts \"we got a field name: \" + \"#{first_field}\"\n\n return add_child_field first_field\n\n else\n \n # error condition if there is nothing after the ':'\n return nil if rest_of_header == ''\n\n # puts \"First part of header: \" + \"#{first_field}\"\n # puts \"Second part of header: \" + \"#{rest_of_header}\"\n\n # we have a field_group name, i.e. a dynamic field group\n\n # If the child field group does not exist, create one if needed.\n # first, see if there is even one already created\n if !( @child_field_groups.has_key? first_field )\n\n puts \"Key: #{first_field} not found\"\n\n child_field_group = Hyacinth::Utils::DynamicFieldGroupBuilder.new first_field, self\n @child_field_groups[first_field] = child_field_group\n\n else\n\n # even though we already have a DynamicFieldGroupBuilder created for this type of dynamic field group,\n # this may be a repeatable field, which means we need to create a new one if needed. The heuristic we use\n # here is that if we try to set a field that already exists, then this must be the next instance in a \n # repeatable field group\n if (@child_field_groups[first_field].field_exists? rest_of_header)\n\n # field exists, so start a new dynamic field\n child_field_group = Hyacinth::Utils::DynamicFieldGroupBuilder.new first_field, self\n \n else\n\n # use existing one\n child_field_group = @child_field_groups[first_field]\n \n end\n\n end\n\n return @child_field_groups[first_field].process_header_repeatable_field_names_do_not_have_numbers(rest_of_header)\n \n end\n\n end",
"def validate_header_pairs(row)\n errors = []\n row.each_with_index do |header, i|\n next if header == 'resource_type'\n next unless header.match(type_header_pattern)\n next_header = row[i + 1]\n field_name = header.gsub('_type', '')\n if next_header != field_name\n errors << \"Invalid headers: '#{header}' column must be immediately followed by '#{field_name}' column.\"\n end\n end\n raise errors.join(', ') if errors.present?\n end",
"def handle_empty_arrays\n @fields = {}.with_indifferent_access if @fields.length == 0\n @link_fields = {}.with_indifferent_access if @link_fields.length == 0\n end",
"def handle_empty_arrays\n @fields = {}.with_indifferent_access if @fields.length == 0\n @link_fields = {}.with_indifferent_access if @link_fields.length == 0\n end",
"def each_field(&blk)\n each do |k,v|\n str_v = if field_def(k).multivalued?\n v.join(', ')\n else\n v.to_s\n end\n\n yield k, str_v\n end\n end",
"def fields=(unfolded_fields)\n @fields = Mail::FieldList.new\n Kernel.warn \"WARNING: More than #{self.class.maximum_amount} header fields; only using the first #{self.class.maximum_amount} and ignoring the rest\" if unfolded_fields.length > self.class.maximum_amount\n unfolded_fields[0..(self.class.maximum_amount-1)].each do |field|\n\n if field = Field.parse(field, charset)\n if limited_field?(field.name) && (selected = select_field_for(field.name)) && selected.any?\n selected.first.update(field.name, field.value)\n else\n @fields << field\n end\n end\n end\n\n end",
"def fields_to_hash(these_fields)\n combined_fields = combine_multivalued_fields(these_fields)\n combined_pairs = combined_fields.map do |field|\n\n # does the normalize_ case ever happen?\n key = api_field_name_for(field.header) || normalize_header(field.header)\n [ key, encode_values(field.value) ]\n end\n Hash[ combined_pairs ]\n end",
"def process_csv_file(filename, no_of_unique,delimiter)\n @arr_unique = Array.new{hash.new}\n @arr_details = Array.new(@no_of_columns){{\"int\" => 0, \"float\" => 0, \"date\" => 0, \"datetime\" => 0, \"string\" => 0, \"max_value\" => 0, \"min_value\" => 0}}\n total_chunks = SmarterCSV.process(filename, {:col_sep => delimiter, :chunk_size => 200, :remove_empty_values => false, :remove_zero_values => false}) do |chunk|\n for i in 0..@headers.length-1\n arr = chunk.map{|x| x[@headers[i].to_sym]}\n if(@arr_unique[i].to_a.empty?)\n @arr_unique[i] = arr.uniq\n elsif(@arr_unique[i].size < no_of_unique.to_i+2)\n @arr_unique[i] |= arr.uniq\n elsif (arr.uniq.include?(nil) && !@arr_unique[i].include?(nil))\n @arr_unique[i].push(nil)\n elsif (arr.uniq.include?(\"NULL\") && !@arr_unique[i].include?(\"NULL\"))\n @arr_unique[i].push(\"NULL\")\n elsif (arr.uniq.include?(\"\\N\") && !@arr_unique[i].include?(\"\\N\"))\n @arr_unique[i].push(\"\\N\") \n elsif (arr.uniq.include?(\"\") && !@arr_unique[i].include?(\"\"))\n @arr_unique[i].push(\"\")\n elsif (arr.uniq.include?(\" \") && !@arr_unique[i].include?(\" \"))\n @arr_unique[i].push(\" \")\n end \n arr.each do |field|\n field_type = get_datatype(field)\n count = @arr_details[i][field_type]\n @arr_details[i][field_type] = count+1\n if(field != nil)\n begin\n if(@header_datatype[i] == \"int\" || @header_datatype[i] == \"float\") \n if(@arr_details[i][\"max_value\"] < field)\n @arr_details[i][\"max_value\"] = field\n end\n if(@arr_details[i][\"min_value\"] > field || @arr_details[i][\"min_value\"] == 0)\n @arr_details[i][\"min_value\"] = field\n end\n else\n if(@arr_details[i][\"max_value\"] < field.to_s.length)\n @arr_details[i][\"max_value\"] = field.to_s.length\n end\n if(@arr_details[i][\"min_value\"] > field.to_s.length || @arr_details[i][\"min_value\"] == 0)\n @arr_details[i][\"min_value\"] = field.to_s.length\n end\n end\n rescue Exception => e\n end\n end\n end\n end\n end\n end",
"def imprint_multiple\n lambda do |rec, acc, ctx|\n imprint_fields = []\n\n Traject::MarcExtractor.cached(\"260:264\").each_matching_line(rec) do |field, spec, extractor|\n imprint_fields << field\n end\n\n if imprint_fields.length > 1\n imprint_hash = imprint_fields.map do |field|\n assemble_imprint_hash(field)\n end\n acc.concat(imprint_hash) unless imprint_hash.to_s == ctx.output_hash['imprint_main'].to_s\n end\n end\n end",
"def build_fields(params_list)\n params_list = params_list.first.to_a if Hash === params_list.first\n \n params_list.map do |params|\n if Array === params\n params.flatten! if Array === params.second\n options = params.extract_options!\n name = params.first\n format = params.second\n else\n name = params\n options = {}\n end\n\n attributes = {format: format, collection: @current_collection}.merge(options)\n Field.new(name, attributes)\n end\n end",
"def rowify fields=nil\n fields ||= [\n :project_number,\n :organization,\n :fiscal_year,\n :title,\n :scope,\n :project_type,\n :sogr,\n :shadow,\n :multi_year,\n :emergency,\n :ali,\n :requested,\n :allocated\n ]\n \n field_library = {\n project_number: {label: \"Project ID\", method: :project_number, url: nil},\n organization: {label: \"Organization\", method: :organization_name, url: nil},\n fiscal_year: {label: \"Year\", method: :fy_year, url: nil},\n title: {label: \"Title\", method: :title, url: nil},\n scope: {label: \"Scope\", method: :team_ali_code_scope, url: nil},\n project_type: {label: \"Project Type\", method: :capital_project_type_name, url: nil},\n sogr: {label: \"SOGR\", method: :sogr, url: nil},\n shadow: {label: \"Shadow\", method: :notional, url: nil},\n multi_year: {label: \"Multi-Year\", method: :multi_year, url: nil},\n emergency: {label: \"Emergency Project\", method: :emergency, url: nil},\n ali: {label: \"ALI\", method: :ali_code, url: nil},\n requested: {label: \"Requested\", method: :total_cost, url: nil},\n allocated: {label: \"Allocated\", method: :total_funds, url: nil}\n\n }\n\n row = {}\n fields.each do |field|\n row[field] = {label: field_library[field][:label], data: self.send(field_library[field][:method]).to_s, url: field_library[field][:url]} \n end\n return row \n end",
"def toDataMetaForm\n result = <<DATAMETAFORM_HEADER\n/*\n Backspace codes specified as standard ASCII:\n http://www.december.com/html/spec/ascii.html\n\n There may be extra codes introduced later\n*/\nrecord\nDATAMETAFORM_HEADER\n indent = ' ' * 4\n @items.each { |i|\n result << indent << i.toDataMetaForm\n result << \"\\n\" if i.kind_of?(Field) # skip a line for a field for looks\n }\n result << \"\\n\" unless result[-1..-1] == \"\\n\"\n result << \"end\\n\"\n end",
"def patched\n fields.each do |h|\n next if incoming[h].to_s.empty?\n\n # If we didn't have anything before, take the new version\n if existing[h].to_s.empty? || existing[h].to_s.casecmp('unknown').zero?\n existing[h] = incoming[h]\n next\n end\n\n # These are _expected_ to be different on a term-by-term basis\n next if %i[term group group_id area area_id].include? h\n\n # Can't do much yet with these ones\n next if %i[source given_name family_name].include? h\n\n # Accept multiple values for multi-lingual names\n if h.to_s.start_with? 'name__'\n existing[h] += ';' + incoming[h]\n next\n end\n\n # TODO: accept multiple values for :website, etc.\n next if %i[website].include? h\n\n # Accept values from multiple sources for given fields\n if %i[email twitter facebook image].include? h\n existing[h] = [existing[h], incoming[h]].join(';').split(';').map(&:strip).uniq(&:downcase).join(';')\n next\n end\n\n # If we have the same as before (case insensitively), that's OK\n # NB: the casecmp version on its own isn't sufficient in some cases (e.g. Turkey)\n next if (existing[h] == incoming[h]) || existing[h].casecmp(incoming[h].downcase).zero?\n\n # Accept more precise dates\n if h.to_s.include?('date')\n if incoming[h].include?(existing[h])\n existing[h] = incoming[h]\n next\n end\n # Ignore less precise dates\n next if existing[h].include?(incoming[h])\n end\n\n # Store alternate names for `other_names`\n if h == :name\n @new_headers << :alternate_names\n existing[:alternate_names] ||= nil\n existing[:alternate_names] = [existing[:alternate_names], incoming[:name]].compact.join(';')\n next\n end\n\n @warnings << \" ☁ Mismatch in #{h} for #{existing[:uuid]} (#{existing[h]}) vs #{incoming[h]} (for #{incoming[:id]})\"\n end\n\n existing\n end",
"def partial_table(ary, sep=',')\n indexes = []\n res = \"\"\n ary.each_with_index do |field, i|\n idx = @ocp_solution[:headers].find_index(field)\n if idx then\n indexes << idx\n else\n ary.delete_at i\n end\n end\n res << ary.join(sep) + \"\\n\"\n self.length.times do |i|\n res << indexes.inject([]) {|a,e| a << @ocp_solution[:data][e][i] }.join(sep) + \"\\n\"\n end\n return res\n end",
"def compound_fields\n %i[file_data emma_data]\n end",
"def makeInputValuesDicts(record_array)\n\theader_record = record_array.shift\n\tvalues_hashes = []\n\n\trecord_array.each_with_index{\n\t\t|item, index|\n\t\ttheHash = Hash.new\n\t\theader_record.each_with_index{\n\t\t\t|jitem, jindex|\n\t\t\ttheHash[header_record[jindex].delete(\" \")] = record_array[index][jindex].delete(\" \")\n\t\t}\n\t\tvalues_hashes.push(theHash)\n\t\t#puts \"#{index} = #{item}\"\n\t}\n\treturn values_hashes\nend",
"def check_array_value(field, params)\n @properties[field] = params[field].present? ? params[field].split(\",\") : []\n end",
"def get_fields\n return @fields if @fields\n return @fields = CICPHash.new unless has_tag\n ape_items = CICPHash.new\n offset = 0\n last_possible_item_start = tag_data.length - ApeItem::MIN_SIZE\n tag_item_count.times do\n raise ApeTagError, \"End of tag reached but more items specified\" if offset > last_possible_item_start\n item, offset = ApeItem.parse(tag_data, offset)\n raise ApeTagError, \"Multiple items with same key (#{item.key.inspect})\" if ape_items.include?(item.key)\n ape_items[item.key] = item\n end\n raise ApeTagError, \"Data remaining after specified number of items parsed\" if offset != tag_data.length\n @fields = ape_items\n end",
"def parse_records(field_name)\n records = []\n\n [@values[field_name]].flatten.each do |raw_record|\n records << Hash[raw_record.split(@multi_value_delim).map {|pair| pair.split('=',2)}]\n end\n\n records\n end",
"def fields(input_fields)\n output = input_fields.gsub(/[\\s,]/ , \" \")\n output_array = output.split\n return output_array\nend",
"def multiple?(field_key)\n true\n end",
"def fields(*args)\n return @fields if args.empty?\n @fields = args.flatten.compact.map{|i| i.to_sym}\n end",
"def from_fields(input)\n input.map { |key, val| \"#{key}=#{val.inspect}\" }.join(', ')\n end",
"def load_data(row, columns, headers)\n #// HEADER EXCLUSION LIST:\n #// ----------------------\n exclusion_list = [\n 'Option_Types'\n ]\n attr_hash = {}\n exception_hash = {}\n sanitized_headers_array = []\n header_return_array = []\n \n for i in columns[0]..columns[1]\n exclusion_list.each do |exclusion|\n if headers[i] =~ /#{exclusion}/i\n exception_hash[exclusion] = row[i]\n elsif headers[i] == exclusion\n exception_hash[exclusion] = row[i]\n else\n attr_hash[headers[i]] = row[i] unless row[i].nil?\n sanitized_headers_array << headers[i]\n end\n end\n \n end\n header_return_array[0] = attr_hash\n header_return_array[1] = exception_hash\n header_return_array[2] = sanitized_headers_array\n return header_return_array\n end",
"def field_array(lines)\n entries = []\n text = lines.join\n text.scan(/^>.+<(.+)>\\n(.+\\n)+\\n/) do |name, data| \n entries << [name, data.chomp]\n end\n Hash[entries]\n end",
"def add_fields(arr,descr,fields)\n fields = fields[0] if(fields.size == 1 && fields[0].is_a?(Array))\n scrubbed = transform_fields(descr,fields)\n if(arr.eql?(WILDCARD))\n arr = scrubbed\n else\n (scrubbed - arr).each {|f| arr << f}\n end\n end",
"def record_header_redundant_additional(header, cursor)\n lengths = []\n nulls = []\n externs = []\n\n field_offsets = record_header_redundant_field_end_offsets(header, cursor)\n\n this_field_offset = 0\n field_offsets.each do |n|\n case header.offset_size\n when 1\n next_field_offset = (n & RECORD_REDUNDANT_OFF1_OFFSET_MASK)\n lengths << (next_field_offset - this_field_offset)\n nulls << ((n & RECORD_REDUNDANT_OFF1_NULL_MASK) != 0)\n externs << false\n when 2\n next_field_offset = (n & RECORD_REDUNDANT_OFF2_OFFSET_MASK)\n lengths << (next_field_offset - this_field_offset)\n nulls << ((n & RECORD_REDUNDANT_OFF2_NULL_MASK) != 0)\n externs << ((n & RECORD_REDUNDANT_OFF2_EXTERN_MASK) != 0)\n end\n this_field_offset = next_field_offset\n end\n\n # If possible, refer to fields by name rather than position for\n # better formatting (i.e. pp).\n if record_format\n header.lengths = {}\n header.nulls = []\n header.externs = []\n\n record_fields.each do |f|\n header.lengths[f.name] = lengths[f.position]\n header.nulls << f.name if nulls[f.position]\n header.externs << f.name if externs[f.position]\n end\n else\n header.lengths = lengths\n header.nulls = nulls\n header.externs = externs\n end\n end",
"def initial_data_type(filename,chunk,delimiter)\n @headers = Array.new\n @header_datatype = Array.new\n get_keys = false\n @arr_unique = Array.new{hash.new}\n #hash_datatype = {\"int\" => 0, \"float\" => 0, \"date\" => 0, \"string\" => 0}\n @arr_details = Array.new(@no_of_columns){{\"int\" => 0, \"float\" => 0, \"date\" => 0, \"datetime\" => 0, \"string\" => 0}}\n total_chunks = SmarterCSV.process(filename, {:col_sep => delimiter, :chunk_size => chunk, :remove_empty_values => false, :remove_zero_values => false}) do |chunk|\n if(get_keys == false)\n chunk.each do |row| \n @headers = row.keys\n #puts headers[0].to_sym\n get_keys = true\n break\n end\n end\n for i in 0..@headers.length-1\n arr = chunk.map{|x| x[@headers[i].to_sym]}\n if(@arr_unique[i].to_a.empty?)\n @arr_unique[i] = arr\n arr.each do |field|\n field_type = get_datatype(field)\n count = @arr_details[i][field_type]\n @arr_details[i][field_type] = count+1\n\n end\n else\n @arr_unique[i] |= arr\n arr.each do |field|\n field_type = get_datatype(field)\n count = @arr_details[i][field_type]\n @arr_details[i][field_type] = count+1\n end\n end\n end\n break\n end\n #To prepare hash with datatypes of every column to decide on the intial datatypes\n #puts @arr_details.inspect\n @arr_details.each do |hash|\n max_value = 0\n max_value_key = String.new\n hash.each do |key, value|\n if(max_value <= value)\n max_value = value\n max_value_key = key\n end\n end\n if max_value_key == \"int\"\n if hash[\"float\"] != 0\n max_value_key = \"float\"\n end\n end\n max_value_key = \"string\" if hash[\"string\"] != 0\n @header_datatype.push(max_value_key)\n end\n #puts @header_datatype.inspect\n end",
"def conditional_format packet\n packet.inject([]){ |a, (field_name, field_value)|\n a + ((extensions.conditional_reply_format[field_name] || {})[field_value] || [])\n }\n end",
"def inflate_functional_fields(data, original_key_order)\n output = []\n data.each do |row|\n output_row = {}\n\n processed_keys = []\n original_key_order.each do |original_key|\n if %w[ec go ipr].include? original_key\n # First, we take all distinct keys that start with \"ec\", \"go\" or \"ipr\"\n annotation_keys = row.keys.select { |key| key.start_with? original_key }\n processed_keys += annotation_keys\n unless annotation_keys.empty?\n # Each of the values of the annotation_keys is an array. All respective values of each of\n # these arrays need to be put together into one hash. (E.g. {a => [1, 2], b=> [x, y]} --> [{a: 1, b: x}, {a: 2, b: y}])\n reconstructed_objects = []\n (0..row[annotation_keys[0]].length).each do |i|\n reconstructed_object = {}\n annotation_keys.each do |annotation_key|\n reconstructed_object[%w[ec_number go_term ipr_code].include?(annotation_key) ? annotation_key : annotation_key[annotation_key.index('_') + 1, annotation_key.length]] = row[annotation_key][i]\n end\n reconstructed_objects << reconstructed_object\n end\n output_row[original_key] = reconstructed_objects\n end\n elsif row.key? original_key\n output_row[original_key] = row[original_key]\n end\n end\n\n output << output_row\n end\n output\n end",
"def json_fields_of(decorated_collection, fields_from_params = params[:fields])\n return [] if decorated_collection.blank?\n\n decorated = decorated_collection.first\n index_field_names = decorated.index_field_names.map(&:to_s)\n fields = (fields_from_params.presence || index_field_names).split(/\\s*,\\s*/).flatten\n fields & index_field_names\n end",
"def rowify fields=nil\n\n #Default Fields\n fields ||= [:asset_id,\n :org_name,\n :vin,\n :manufacturer,\n :model,\n :year,\n :type,\n :subtype,\n :service_status,\n :last_life_cycle_action,\n :life_cycle_action_date]\n\n \n row = {}\n fields.each do |field|\n field_data = field_library(field)\n row[field] = {label: field_data[:label], data: self.send(field_data[:method]).to_s, url: field_data[:url]} \n end\n return row \n end",
"def normalize_fields\n new_fields = CICPHash.new\n fields.each do |key, value|\n new_fields[key] = ApeItem.create(key, value).normalize_encodings\n end\n @fields = new_fields\n end",
"def ensure_array(field)\n add_step do |attrs|\n if attrs.has_key?(field) && !attrs[field].is_a?(Array)\n attrs[field] = [attrs[field]]\n end\n attrs\n end\n end",
"def populate_fields\n @header = populate_hmap_header\n string_t = @raw_data[header.strings_offset..-1]\n @bucktes = populate_buckets do |bucket|\n bucket_s = bucket.to_a.map do |key|\n string_t[key..-1].match(/[^\\0]+/)[0]\n end\n HMapBucketStr.new(*bucket_s)\n end\n end",
"def read_values_from_body(value_names)\n values_from_body = []\n [value_names].flatten.each do |value_name|\n values_from_body += read_value_from_body(value_name).split(\",\")\n end\n values_from_body.compact.uniq.map(&:strip) - [\"\"]\n end",
"def each(extra_headers = nil)\n return enum_for(__method__, extra_headers) { @headers.size } unless block_given?\n\n @headers.each do |field, value|\n yield(field, value.join(\", \")) unless value.empty?\n end\n\n extra_headers.each do |field, value|\n yield(field, value) unless value.empty?\n end if extra_headers\n end",
"def method_missing(name, *args, &block)\n #:nodoc:\n # Only take the structured fields, as we could take _anything_ really\n # as it could become an optional field... \"but therin lies the dark side\"\n field_name = underscoreize(name).chomp(\"=\")\n if Mail::Field::KNOWN_FIELDS.include?(field_name)\n if args.empty?\n header[field_name]\n else\n header[field_name] = args.first\n end\n else\n super # otherwise pass it on\n end\n #:startdoc:\n end",
"def make_fields(method, keys, values)\n return [] unless method == 'POST'\n\n fields = []\n keys, values = Array(keys), Array(values)\n keys.each_with_index do |name, i|\n value = values[i]\n next if name.to_s.empty? || value.to_s.empty?\n fields << Curl::PostField.content(name, value)\n end\n fields\n end",
"def jsonapi_fields\n return {} unless params[:fields].respond_to?(:each_pair)\n\n if defined?(ActiveSupport::HashWithIndifferentAccess)\n extracted = ActiveSupport::HashWithIndifferentAccess.new\n else\n extracted = Hash.new\n end\n\n params[:fields].each do |k, v|\n extracted[k] = v.to_s.split(',').map(&:strip).compact\n end\n\n extracted\n end",
"def pre_gen(record)\n numeric_fields.each do |field|\n if vals = record[field] and vals.is_a?(Array)\n record[field] = vals.join(\",\")\n end\n end\n end",
"def add_fields_to_request\n @fields.each do |f|\n @request += f + ',' if f\n end\n end",
"def conditional_format packet\n packet.inject([]){ |a, (field_name, field_value)|\n a + ((extensions.conditional_request_format[field_name] || {})[field_value] || [])\n }\n end",
"def set_fields(structure_hash)\r\n field_order = Array.new\r\n structure_hash[\"fields\"] = Hash.new\r\n \r\n structure_hash[\"fields\"][\"legal_first_name\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"legal_first_name\" } if field_order.push(\"legal_first_name\" )\r\n structure_hash[\"fields\"][\"legal_middle_name\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"legal_middle_name\" } if field_order.push(\"legal_middle_name\" )\r\n structure_hash[\"fields\"][\"legal_last_name\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"legal_last_name\" } if field_order.push(\"legal_last_name\" )\r\n structure_hash[\"fields\"][\"suffix\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"suffix\" } if field_order.push(\"suffix\" )\r\n structure_hash[\"fields\"][\"aka\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"aka\" } if field_order.push(\"aka\" )\r\n structure_hash[\"fields\"][\"insperity_name\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"insperity_name\" } if field_order.push(\"insperity_name\" )\r\n structure_hash[\"fields\"][\"ppid\" ] = {\"data_type\"=>\"int\", \"file_field\"=>\"ppid\" } if field_order.push(\"ppid\" )\r\n structure_hash[\"fields\"][\"ssn\" ] = {\"data_type\"=>\"int\", \"file_field\"=>\"ssn\" } if field_order.push(\"ssn\" )\r\n structure_hash[\"fields\"][\"dob\" ] = {\"data_type\"=>\"date\", \"file_field\"=>\"dob\" } if field_order.push(\"dob\" )\r\n structure_hash[\"fields\"][\"ethnicity\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"ethnicity\" } if field_order.push(\"ethnicity\" )\r\n structure_hash[\"fields\"][\"gender\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"gender\" } if field_order.push(\"gender\" )\r\n structure_hash[\"fields\"][\"mailing_address_1\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"mailing_address_1\" } if field_order.push(\"mailing_address_1\" )\r\n structure_hash[\"fields\"][\"mailing_address_2\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"mailing_address_2\" } if field_order.push(\"mailing_address_2\" )\r\n structure_hash[\"fields\"][\"mailing_city\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"mailing_city\" } if field_order.push(\"mailing_city\" )\r\n structure_hash[\"fields\"][\"mailing_zip\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"mailing_zip\" } if field_order.push(\"mailing_zip\" )\r\n structure_hash[\"fields\"][\"mailing_county\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"mailing_county\" } if field_order.push(\"mailing_county\" )\r\n structure_hash[\"fields\"][\"mailing_state\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"mailing_state\" } if field_order.push(\"mailing_state\" )\r\n structure_hash[\"fields\"][\"shipping_address_1\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"shipping_address_1\" } if field_order.push(\"shipping_address_1\" )\r\n structure_hash[\"fields\"][\"shipping_address_2\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"shipping_address_2\" } if field_order.push(\"shipping_address_2\" )\r\n structure_hash[\"fields\"][\"shipping_city\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"shipping_city\" } if field_order.push(\"shipping_city\" )\r\n structure_hash[\"fields\"][\"shipping_zip\" ] = {\"data_type\"=>\"int\", \"file_field\"=>\"shipping_zip\" } if field_order.push(\"shipping_zip\" )\r\n structure_hash[\"fields\"][\"shipping_county\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"shipping_county\" } if field_order.push(\"shipping_county\" )\r\n structure_hash[\"fields\"][\"shipping_state\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"shipping_state\" } if field_order.push(\"shipping_state\" )\r\n structure_hash[\"fields\"][\"region\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"region\" } if field_order.push(\"region\" )\r\n structure_hash[\"fields\"][\"work_im\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"work_im\" } if field_order.push(\"work_im\" )\r\n structure_hash[\"fields\"][\"employee_type\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"employee_type\" } if field_order.push(\"employee_type\" )\r\n structure_hash[\"fields\"][\"teacher_breakdown\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"teacher_breakdown\" } if field_order.push(\"teacher_breakdown\" )\r\n structure_hash[\"fields\"][\"department\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"department\" } if field_order.push(\"department\" )\r\n structure_hash[\"fields\"][\"department_id\" ] = {\"data_type\"=>\"int\", \"file_field\"=>\"department_id\" } if field_order.push(\"department_id\" )\r\n structure_hash[\"fields\"][\"department_category\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"department_category\" } if field_order.push(\"department_category\" )\r\n structure_hash[\"fields\"][\"department_focus\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"department_focus\" } if field_order.push(\"department_focus\" )\r\n structure_hash[\"fields\"][\"title\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"title\" } if field_order.push(\"title\" )\r\n structure_hash[\"fields\"][\"supervisor_team_id\" ] = {\"data_type\"=>\"int\", \"file_field\"=>\"supervisor_team_id\" } if field_order.push(\"supervisor_team_id\" )\r\n structure_hash[\"fields\"][\"peer_group_id\" ] = {\"data_type\"=>\"int\", \"file_field\"=>\"peer_group_id\" } if field_order.push(\"peer_group_id\" )\r\n structure_hash[\"fields\"][\"highest_degree\" ] = {\"data_type\"=>\"text\", \"file_field\"=>\"highest_degree\" } if field_order.push(\"highest_degree\" )\r\n structure_hash[\"fields\"][\"year_entered_education\" ] = {\"data_type\"=>\"int\", \"file_field\"=>\"year_entered_education\" } if field_order.push(\"year_entered_education\" )\r\n structure_hash[\"fields\"][\"active\" ] = {\"data_type\"=>\"bool\", \"file_field\"=>\"active\" } if field_order.push(\"active\" )\r\n \r\n structure_hash[\"field_order\"] = field_order\r\n return structure_hash\r\n end",
"def update_typed_field(header, val, processed)\n if header.match(type_header_pattern)\n stripped_header = header.gsub('_type', '')\n processed[stripped_header.to_sym] ||= []\n processed[stripped_header.to_sym] << { type: val }\n else\n fields = Array(processed[header.to_sym])\n fields.last[:name] = val\n end\n end",
"def update_typed_field(header, val, processed)\n if header.match?(type_header_pattern)\n stripped_header = header.gsub('_type', '')\n processed[stripped_header.to_sym] ||= []\n processed[stripped_header.to_sym] << { type: val }\n else\n fields = Array(processed[header.to_sym])\n fields.last[:name] = val\n end\n end",
"def form_entry_param\n Array.new.tap do |arr|\n form.fields.map do |field|\n if field.field_type_range?\n arr << { field.id.to_s => [:from, :to] }\n\n elsif field.field_type_datetime?\n arr << { field.id.to_s => [:date, :hours, :minutes] }\n\n elsif field.field_type_address?\n arr << { field.id.to_s => [:address, :city, :postal_code, :country] }\n\n elsif field.field_type_question_group?\n # TO DO\n arr << { 'field.id' => [ 'row_10' ] }\n\n elsif field.field_type_checkbox? || field.field_type_mcq?\n arr << { field.id.to_s => [] }\n\n elsif field.field_type_statement?\n # TO DO\n field.properties['statements'].each do |key, value|\n arr << field.id.to_s + \"_#{key}\"\n end\n\n elsif field.field_type_file?\n arr << field.id.to_s\n\n else\n arr << field.id.to_s\n end\n end\n end\n end",
"def add_all_fields(multiple, fields)\n METADATA_FIELDS.keys.each { |ns|\n add_fields_by_ns(multiple, fields, ns)\n }\n end",
"def response_fields\n return '*' if invalid_param('response_fields')\n\n @params['response_fields'].join(', ')\n end",
"def initialize_combined_fields\n # For each of the files in the batch, set the attributes to be the concatenation of all the attributes\n batch_document_ids.each_with_object({}) do |doc_id, combined_attributes|\n work = Hyrax.query_service.find_by(id: doc_id)\n terms.each do |field|\n combined_attributes[field] ||= []\n combined_attributes[field] = (combined_attributes[field] + work[field].to_a).uniq\n end\n names << work.to_s\n end\n end",
"def check_fields\n columns= resource.model.column_names - AutoRest::AR_MAGIC_COLUMNS\n\n default_columns= columns.select { |attr| attr !~ /.*_count$/ }.map do |elem|\n [elem.intern, elem.titleize]\n end\n\n # For storing columns, I use an array and not a hash --i.e.: (:column => 'Title') -- \n # to ensure the order of the columns. I convert the params from linear array to \n # grouped array to alivianate user's data entry:\n # [[:col0, \"name0\"], [:col1, \"name1\"]] becomes [:col0, \"name0\", :col1, \"name1\"]\n \n # *TODO* This should be cleaned a little, because right now is a bit difficult\n # to remember the way the attributes for each view work.\n\n [:for_index, :for_new, :for_edit, :for_show].each do |key|\n arr= fields.send(key)\n exc= exclude_fields.send(key)\n\n if !arr # User has not supplied columns.\n arr= default_columns\n else\n # enum_for creates an enum from array, therefore protecting the original array contents.\n # each slice returns an array of specified elements: [1,2,3,4] => 1..4 => [[1,2],[3,4]]\n arr= arr.enum_for(:each_slice, 2).to_a\n end\n \n # Remove excluded fields.\n arr= arr.reject { |e| exc.map{|elem|elem.to_s}.include?(e[0].to_s) } if exc\n fields.send(\"#{key}=\", arr)\n end\n end",
"def dynamic_fields\n fields = []\n variant_combinations.each do |field_variants|\n FIELD_TYPES.each do |type|\n fields << DynamicField.new(type, field_variants)\n end\n end\n fields\n end",
"def get_headers\nheader_values = {}\n i = 1\n # while !params[:header][:type_.to_s + \"#{i}\"].nil?\n while !params[:header_values_.to_s + \"#{i}\"].nil?\n\t value = params[:header_values_.to_s + \"#{i}\"].map!{|i| CGI::unescape(i).gsub(\"\\\"\", \"'\")}\n \theader_values[params[:header][:type_.to_s + \"#{i}\"]] = value\n i += 1\n end\n header_values\nend",
"def fields(*args)\n hash_fields = args.last.is_a?(Hash) ? args.pop : {}\n hash_fields[type] = args if args.any?\n munson.fields(hash_fields)\n end",
"def params_array_from(raw_params); end",
"def fields\n @fields = headers.map.with_index do |header, index|\n Field.new(header, row_data[index])\n end\n end",
"def prepare_data_for_writing(data_to_write, headers)\n if data_to_write.first.class.to_s.downcase =~ /hash/\n prepared_headers = data_to_write.first.keys.map(&:to_s)\n prepared_data_to_write = data_to_write.map { |data_h| data_h.values }\n return prepared_data_to_write, prepared_headers\n elsif data_to_write.first.class.to_s.downcase =~ /array/\n raise \"No headers provided for writing\" if !headers or headers.empty?\n\n return data_to_write, headers\n end\n end",
"def add_fields_by_ns(multiple, fields, ns)\n metadata_fields = METADATA_FIELDS[ns][:fields]\n metadata_fields.each{ |fieldPair|\n # if output is true then print out field name\n # if multiple has the default value\n # or one of the values in the yml file\n output = ( multiple == DEFAULT_MULTIPLE ) ?\n true :\n metadata_fields[fieldPair][:multiple] == multiple\n\n field = {}\n field[:name] = fieldPair[0]\n field[:attributes] = fieldPair[1]\n\n fields.push(field) if output\n }\n end",
"def csv_process_row_fields(pattern_data, row, index)\n orig_row = @csv_row_arr.clone\n\n # counting back from the end, remove blank cels. \n # but if there are blank cells in the middle, leave them (ick!)\n # i need to test if this step is even necessary #*\n [*0..(@csv_row_arr.size-1)].reverse.each { |i| orig_row.delete_at(i) if orig_row[i].nil? }\n\n # in case we have columns we are skipping, we will make a hash that maps \n # column numbers to field names, called \"field_names\". note the keys are integers\n # that correspond to column offsets, but the aren't necessarily contiguous, hence hash not array.\n @field_names = Hash[Array(*[0..orig_row.size-1]).zip(orig_row.map{|x|normalize_fieldname(x)})]\n @field_names.reject!{|k,v| @skip_cols[k]} if @skip_cols\n \n # in the wierd cases where a document repeats the same field name but might have different values,\n # we want to be able to report it and make an intelligent guess as to which column we want to use.\n @repeated_field_names = {}\n if (@field_names.size > @field_names.values.uniq.size)\n # we don't care which column it's in \n @field_names.each{|k,v| @repeated_field_names[v]||=0; @repeated_field_names[v]+=1;} \n @repeated_field_names.delete_if{|k,v| v==1}\n end\n end",
"def encode_fields(*fields)\n fields.map do |type, value|\n case type\n when :raw\n value\n when :string\n encode_string(value)\n when :list\n encode_list(value)\n when :mpint\n encode_mpint(value)\n when :time\n encode_time(value)\n when :uint64\n encode_uint64(value)\n when :uint32\n encode_uint32(value)\n when :options\n encode_options(value)\n else\n raise DecodeError, \"bad type: #{type}\"\n end\n end.join\n end",
"def format_inputs(inputs)\n @api.account_id = @options[:src]\n result = {}\n\n inputs.index.each do |input|\n # Array input format type isn't correct and must be changed to a json array.\n # More info here: http://reference.rightscale.com/api1.5/resources/ResourceInputs.html#multi_update\n if input.value =~ /^array:/\n array = input.value.sub(/^array:/, \"\").split(\",\")\n array.map {|a| a.sub!(/^/, \"\\\"text:\").sub!(/$/, \"\\\"\")}\n new_array = array.join(\",\")\n new_array.sub!(/^/, \"array:[\")\n new_array.sub!(/$/, \"]\")\n result[input.name] = new_array\n else\n result[input.name] = input.value\n end\n end\n\n return result\nend",
"def format_fields(fields)\n if fields.instance_of?(Array)\n return fields.join(\",\")\n elsif fields.instance_of?(String)\n return fields\n end\n end",
"def parse_header\n header.each do |field, value|\n self.instance_variable_set(\"@#{field}\", value) if HEADER_FIELDS.include? field\n end\n end",
"def split_header\n self.fields = raw_source.split(HEADER_SPLIT)\n end",
"def process_header(header)\n\n first_field, rest_of_header = header.split(':',2)\n\n if first_field == header\n\n # we have a field name, i.e. a dynamic field\n # puts \"we got a field name: \" + \"#{first_field}\"\n\n return add_child_field first_field\n\n else\n \n # error condition if there is nothing after the ':'\n return nil if rest_of_header == ''\n\n # puts \"First part of header: \" + \"#{first_field}\"\n # puts \"Second part of header: \" + \"#{rest_of_header}\"\n\n # we have a field_group name, i.e. a dynamic field group\n\n # puts \"Here is the first_field: #{first_field}\"\n dynamic_field_group_type = first_field.gsub(/\\d*/,'')\n # puts \"Here is the dynamic_field_group_type: #{dynamic_field_group_type}\"\n @child_field_groups[first_field] ||= Hyacinth::Utils::DynamicFieldGroupBuilder.new first_field, self\n # @child_dynamic_field_groups_by_type[dynamic_field_group_type] = {first_field => @child_field_groups[first_field]}\n # @child_dynamic_field_groups_by_type[dynamic_field_group_type] = { first_field => @child_field_groups[first_field] }\n @child_dynamic_field_groups_by_type[dynamic_field_group_type] = \n Hash.new unless child_dynamic_field_groups_by_type.has_key? dynamic_field_group_type\n @child_dynamic_field_groups_by_type[dynamic_field_group_type][first_field] = @child_field_groups[first_field]\n # @child_dynamic_field_groups_by_type[dynamic_field_group_type].store [first_field] = @child_field_groups[first_field]\n\n return @child_field_groups[first_field].process_header(rest_of_header)\n \n end\n\n end",
"def load_row_data(headers, row)\n # Hash of field values\n fields = {}\n\n # List of alternate spellings found in current row\n alt_spellings = []\n\n # Related words for current row\n see_also = []\n\n # List of hashes of source data for current row\n sources = []\n\n # Loop through the cells in the row\n row.each_with_index do |field_value, col_index|\n # Skip empty cells\n next unless field_value\n\n # Remove leading/trailing whitespace from field value\n field_value = field_value.strip\n\n # Get current header\n header = headers[col_index]\n\n if header.start_with? 'headword'\n headword_data = headword_data field_value\n fields = fields.merge headword_data\n next\n end\n\n if header.start_with? 'altspelling'\n alt_spellings << field_value\n next\n end\n\n if header.start_with? 'source'\n match = self.class.source_header_regex.match header\n\n # Get source number i.e. source1\n source_num = match[1].to_i - 1 # Subtract 1 since CSV vals are 1-based, and arrays are 0-based\n\n # Ref/original_ref/date/place\n source_component = match[2]\n\n # Find or create source record for current source\n current_source = sources[source_num] ||= {}\n\n # Add current field to source obj\n current_source[source_component.to_sym] = field_value\n current_source[:source_num] = source_num\n next\n end\n\n if header == 'see also'\n current_see_also = see_also_from_string field_value\n see_also += current_see_also\n next\n end\n\n # No match, so just add as is\n fields[header.to_sym] = field_value\n end\n\n # Fields that are handled specially\n special_fields = { alt_spellings: alt_spellings, see_also: see_also, sources: sources }\n\n # Add special fields to all others\n all_fields = special_fields.merge fields\n\n all_fields\n end",
"def unmappable_complex_headers\n [\n \"COVID-19 (Disease)--Complications\",\n \"COVID-19 (Disease)--Testing\",\n \"COVID-19 (Disease)--Treatment\",\n \"Feinberg School of Medicine--Buildings\",\n \"Illinois--History\",\n \"Illinois--Northern\"\n ]\n end",
"def make_fields(method, keys, values)\n return [] unless %w( POST PUT ).include? method\n\n fields = []\n keys, values = Array(keys), Array(values)\n keys.each_with_index do |name, i|\n value = values[i]\n next if name.to_s.empty? || value.to_s.empty?\n fields << Curl::PostField.content(name, value)\n end\n fields\n end",
"def flatten_struct!(fields, prefix: nil)\n fields.map do |field|\n type = field.first\n name = [prefix, field.last].compact.join(\"_\")\n\n if type.is_a? Array then\n flatten_struct!(type, prefix: name)\n else\n [[type.to_sym, name.to_sym]]\n end\n end.flatten(1)\n end",
"def convert_hash_body_to_array_of_arrays\n arrays = []\n request.body.keys.each do | key |\n [*request.body[key]].each do | value |\n arrays << [key, value]\n end\n end\n\n Pact::Reification.from_term(arrays)\n end",
"def helper_for_parsing_sprint_info obj, arr\n arr.map do |field_num|\n \"#{obj[0].split(',')[field_num].split(\"=\")[1]}\" if obj\n end\n end",
"def joinData(arr)\n return data = {\"rusr\" => arr[0][1..-1].split(\"!\")[0], \"raddress\" => arr[0].split(\"!\")[1], \"type\" => arr[1], \"where\" => arr[2][1..-1]}\n end",
"def build_data_array\n table = helper_class.new(@file_upload.file.path).to_table # # load data to array of hashes\n errors = []\n data = table.map do |item_hash|\n process_item(attributes(item_hash), errors)\n end\n [data, errors]\n end",
"def evaluate_row_from_headers(record_type)\n row_str = \"\\n\"\n #row_str = config.header_fields.collect.map{|fld| eval(\"eval_\" + fld.first.downcase.gsub(/(#|\\(|\\)| )/, \"_\") + fld[2])}.join(@delimiter )\n if record_type == \"plb\"\n plb_field_list = [\"Patient First Name\", \"Patient Last Name\", \n \"Patient Account Number\", \"835 Amount\", \"Xpeditor Document Number\",\n \"Total Charge\", \"Date Of Service\", \"Reject Reason\", \"Statement #\", \n \"Member Id\", \"Patient Date Of Birth\", \"Payer Name\", \"Reason Not Processed\",\n \"837 File Type\", \"PLB\", \"Unique Identifier\", \"Client Code\", \"Payer\", \n \"MRN\", \"Service Provider ID\", \"Transaction Type\"]\n row_str = row_str + config.header_fields.collect.map{|fld|\n if plb_field_list.include?(fld.first)\n eval(\"eval_plb_\" + fld.first.downcase.gsub(/(#|\\(|\\)| |\\/)/, \"_\")) \n else \n eval(\"eval_\" + fld.first.downcase.gsub(/(#|\\(|\\)| |\\/)/, \"_\"))\n end\n }.join(@delimiter) \n elsif record_type == \"extra plb\"\n plb_field_list = [\"Patient First Name\", \"Patient Last Name\",\n \"835 Amount\", \"Xpeditor Document Number\",\n \"Total Charge\", \"Date Of Service\", \"Reject Reason\", \"Statement #\",\n \"Member Id\", \"Patient Date Of Birth\", \"Reason Not Processed\",\n \"837 File Type\", \"PLB\", \"Unique Identifier\", \"Client Code\"]\n row_str = row_str + config.header_fields.collect.map{|fld|\n if plb_field_list.include?(fld.first)\n eval(\"eval_extra_plb_\" + fld.first.downcase.gsub(/(#|\\(|\\)| |\\/)/, \"_\"))\n else\n eval(\"eval_\" + fld.first.downcase.gsub(/(#|\\(|\\)| |\\/)/, \"_\"))\n end\n }.join(@delimiter)\n else\n row_str = row_str + config.header_fields.collect.map{|fld| eval(\"eval_\" + fld.first.downcase.gsub(/(#|\\(|\\)| |\\/)/, \"_\"))}.join(@delimiter)\n end\n row_str = row_str + @delimiter + Array.new(@config.custom_header_fields.size).join(@delimiter) if @config.custom_header_fields.size > 0\n row_str \n end",
"def to_params(fl = [])\n fl = Array(fl).flat_map { |field| field.split(/[\\s,]+/) }\n if fields.empty?\n fl << '*'\n else fields.empty?\n fl.delete('*')\n fl.concat(fields)\n fl.concat(default_fields)\n end\n { fl: fl.compact.uniq.join(' ') }\n end",
"def add_headers_from_arrays(curl, keys, values)\n keys, values = Array(keys), Array(values)\n\n keys.each_with_index do |key, i|\n next if values[i].to_s.empty?\n curl.headers[key] = values[i]\n end\n end",
"def build_fields\n # Empty the existing fields\n self.fields = {}\n\n # Build an array of all the future replaceable words\n array = message.scan(/\\{[\\w,\\s-]+\\}/).collect { |i| i.gsub(/[\\{\\}]/,'') }\n\n # Now build the new hash of fields, organized by word type (verbs, nouns, etc.)\n array.each do |field|\n key = field.downcase\n # Keep track of how many of each word type is in the text\n self.fields[key] = (self.fields[key].nil? ? 1 : self.fields[key] + 1)\n end\n end",
"def field_param(array)\n array.inject([]) do |result, field|\n result << \"#{field[:field]}: #{set_value(field[:value])}\"\n result\n end.join(\", \")\n end",
"def response_schema(additional_meta_fields = {})\n fields = Array.new \n # Rails.logger.debug(\"before making response schema, data columns are: \" + self.data_columns.size.inspect)\n # Rails.logger.debug(\"before making response schema, data columns are: \" + self.data_columns.class.inspect)\n \n self.data_columns.each do |column_name, opts| \n # Rails.logger.debug(\"data_column: \" + column_name.inspect)\n column_response_schema = {:key => column_name.to_s}\n \n if opts.has_key?(:parser)\n column_response_schema[:parser] = opts[:parser]\n elsif column_opts = self.data_columns[column_name.to_sym]\n if field_def = column_opts[:field_def]\n if yui_parser = field_def.yui_parser\n column_response_schema[:parser] = yui_parser\n end\n end\n end\n \n # Rails.logger.debug(\"adding field: \" + column_response_schema.inspect) \n fields << column_response_schema\n end\n \n\n # Rails.logger.debug(\"returning response schema, fields are: \" + fields.inspect) \n { :resultsList => 'records', \n :fields => fields,\n :metaFields => {\n :totalRecords => \"total_records\",\n :paginationRecordOffset => \"offset\",\n :paginationRowsPerPage => \"page_size\",\n :sortKey => \"order_key\",\n :sortDir => \"order_dir\"\n }.merge(additional_meta_fields)\n }\n end",
"def _field_assignments\n result = []\n @fields.each do |field|\n field_type = field.type.type_sym # Record, Union, Enum, Array or Map\n schema_base_type = _schema_base_class(field.type)\n field_base_type = _field_type(schema_base_type)\n method_argument = %i(array map).include?(field_type) ? 'values' : 'value'\n is_schema_class = %i(record enum).include?(schema_base_type.type_sym)\n\n field_initialization = method_argument\n\n if is_schema_class\n field_initialization = \"#{field_base_type}.initialize_from_value(value)\"\n end\n\n result << {\n field: field,\n field_type: field_type,\n is_schema_class: is_schema_class,\n method_argument: method_argument,\n deimos_type: deimos_field_type(field),\n field_initialization: field_initialization\n }\n end\n\n result\n end",
"def assign_csv_values_to_genericfile(row, generic_file)\n field_mappings = @import.import_field_mappings.where('import_field_mappings.key != ?', 'image_filename')\n field_mappings.each do |field_mapping|\n\n key_column_number_arr = @import.import_field_mappings.where(key: field_mapping.key).first.value.reject!{|a| a.blank? } \n key_column_value_arr = []\n\n # For certain fields the values in the csv are comma delimeted and need to be parsed\n if field_mapping.key == 'subject'\n key_column_number_arr.each do |num|\n key_column_value_arr = key_column_value_arr + (row[num.to_i].try(:split, ',') || [])\n end\n elsif field_mapping.key == 'collection_identifier'\n # it's not a multivalue field so let's just get the first mapping\n key_column_number_arr.each do |num|\n generic_file.collection_identifier = row[num.to_i]\n break\n end\n\n elsif field_mapping.key == 'measurements'\n key_column_number_arr.each do |num|\n measurement_hash = measurement_format_for(row[num.to_i].try(:strip))\n unless measurement_hash.nil?\n #insert field as a measurement object\n measurement = Osul::VRA::Measurement.create(measurement: measurement_hash[:width], measurement_unit: measurement_hash[:unit], measurement_type: \"width\") \n \n generic_file.measurements << measurement\n measurement = Osul::VRA::Measurement.create(measurement: measurement_hash[:height], measurement_unit: measurement_hash[:unit], measurement_type: \"height\") \n generic_file.measurements << measurement\n end\n end\n\n elsif field_mapping.key == 'materials'\n key_column_number_arr.each do |num|\n material_hash = material_format_for(row[num.to_i].try(:strip))\n unless material_hash.nil?\n material = Osul::VRA::Material.create(material_hash)\n generic_file.materials << material\n end\n end\n\n else\n key_column_number_arr.each do |num|\n key_column_value_arr << row[num.to_i]\n end\n end\n\n # materials and measurements are associations so they are updated differently \n unless field_mapping.key == 'materials' or field_mapping.key == 'measurements' or field_mapping.key == 'collection_identifier'\n key_column_value_arr = key_column_value_arr.map.reject{|a| a.blank?}\n generic_file.send(\"#{field_mapping.key}=\".to_sym, key_column_value_arr)\n end\n end\n end",
"def phrase_fields(*fields)\n boosted_fields = fields.pop if fields.last.is_a?(Hash)\n fields.each do |field_name|\n @setup.text_fields(field_name).each do |field|\n @query.add_phrase_field(field)\n end\n end\n if boosted_fields\n boosted_fields.each_pair do |field_name, boost|\n @setup.text_fields(field_name).each do |field|\n @query.add_phrase_field(field, boost)\n end\n end\n end\n end",
"def parse_common_fields(fields)\n timestamp = fields[:timestamp] || Time.new\n distinct_id = fields[:distinct_id]\n message_id = fields[:message_id].to_s if fields[:message_id]\n send_feature_flags = fields[:send_feature_flags]\n\n check_timestamp! timestamp\n check_presence! distinct_id, 'distinct_id'\n\n parsed = {\n timestamp: datetime_in_iso8601(timestamp),\n library: 'posthog-ruby',\n library_version: PostHog::VERSION.to_s,\n messageId: message_id,\n distinct_id: distinct_id,\n properties: {\n '$lib' => 'posthog-ruby',\n '$lib_version' => PostHog::VERSION.to_s\n }\n }\n\n if send_feature_flags\n feature_variants = fields[:feature_variants]\n feature_variants.each do |key, value|\n parsed[:properties][\"$feature/#{key}\"] = value\n end\n parsed[:properties][\"$active_feature_flags\"] = feature_variants.keys\n end\n parsed\n end",
"def add_all_field_names(multiple, field_names)\n METADATA_FIELDS.keys.each { |ns|\n add_field_names_by_ns(multiple, field_names, ns)\n }\n end",
"def decode_fields(raw, fields, offset=0)\n hash = {}\n total_read = 0\n\n fields.each do |key, type, *args|\n hash[key], read = case type\n when :string\n decode_string(raw, offset + total_read, *args)\n when :list\n decode_list(raw, offset + total_read, *args)\n when :mpint\n decode_mpint(raw, offset + total_read, *args)\n when :time\n decode_time(raw, offset + total_read, *args)\n when :uint64\n decode_uint64(raw, offset + total_read, *args)\n when :uint32\n decode_uint32(raw, offset + total_read, *args)\n when :public_key\n decode_public_key(raw, offset + total_read, *args)\n when :string_public_key\n decode_string_public_key(raw, offset + total_read, *args)\n when :options\n decode_options(raw, offset + total_read, *args)\n else\n raise DecodeError\n end\n total_read += read\n end\n\n [hash, total_read]\n end",
"def all_required(data, fields)\t\t\n\t\tif fields.nil? == true\n\t\t\treturn true\n\t\tend\n\t\t@api_errmsg = Array.new\n\t\tfields = fields.split(',')\n\t\tflag = true\n\t\tfields.each do |name|\n\t\t\tif data[name].nil?\n\t\t\t @api_errmsg.push(name)\n\t\t\t flag = false\n\t\t\tend\n\t\tend\n\t\tif flag == true\n\t\t return true\n\t\tend\n\t\treturn false\n\tend",
"def prepare_data(body)\n data = MultiJson.decode(body)\n content = StringIO.new(data['content'])\n resource_id = data['resource_id']\n\n data.keep_if { |k,v| %w{title description mimeType}.include? k}\n file_content = Google::APIClient::UploadIO.new(content, data['mimeType'])\n\n [resource_id, data, file_content]\nend",
"def sub_request_fields(key)\n return unless @opts[:\"#{key}_fields\"].present? ||\n @opts[:\"#{key}_associations\"].present? ||\n @opts[:\"#{key}_extra_fields\"].present?\n\n sub_fields = @opts[:\"#{key}_fields\"]\n sub_associations = @opts[:\"#{key}_associations\"]\n sub_opt_fields = @opts[:\"#{key}_extra_fields\"]\n\n [sub_fields, sub_associations, sub_opt_fields]\n end",
"def detail\n output = []\n detail_fields.each do |field_name|\n output << [field_name.to_s, field(field_name).to_s]\n end\n\n output\n end",
"def apply_metadata_properties(resource, fields, values)\n values.each_with_index do |val, i|\n if val.blank?\n Rails.logger.warn \"[#{log_prefix}] Ignoring empty field #{fields[i]}\"\n next\n end\n\n field = fields[i]\n\n # When multivalued save as an array\n if resource[field].is_a? Array\n resource[field] += val.split(\"|\")\n resource[field].uniq!\n else\n resource[field] = v\n end\n end\n\n resource\n end",
"def add_headers_from_arrays(curl, keys, values)\n keys, values = Array(keys), Array(values)\n\n keys.each_with_index do |key, i|\n next if values[i].to_s.empty?\n curl.headers[key] = values[i]\n end\n end",
"def fields_for(record_or_name_or_array, *args, &block)\n options = args.extract_options!.merge(:builder => self.class)\n super(record_or_name_or_array, *(args + [options]), &block)\n end",
"def get_first_array_elements(body, parts)\n part_count = 0\n parts.each do |part|\n part_count += 1\n body[full_part] = body[full_part][0] if body[full_part].is_a?(Array)\n end\n return body\nend",
"def formula_fields_for(record_or_name_or_array, *args, &block)\n options = args.extract_options!\n options[:builder] ||= @@builder\n fields_for(record_or_name_or_array, *(args << options), &block)\n end"
] |
[
"0.6174231",
"0.58449346",
"0.5778309",
"0.56037545",
"0.5589498",
"0.5524742",
"0.55157167",
"0.5432429",
"0.540262",
"0.540262",
"0.54020363",
"0.5379739",
"0.53390354",
"0.53290915",
"0.5322947",
"0.531397",
"0.5293062",
"0.5260944",
"0.52455777",
"0.52386403",
"0.5224557",
"0.5213506",
"0.52117336",
"0.52089804",
"0.520842",
"0.5206573",
"0.5200085",
"0.5188316",
"0.51867175",
"0.51847667",
"0.518166",
"0.5174113",
"0.5171757",
"0.5171577",
"0.5145435",
"0.51246566",
"0.5124177",
"0.51077044",
"0.50821793",
"0.5078067",
"0.5075818",
"0.507465",
"0.5071654",
"0.5069684",
"0.5068101",
"0.5060859",
"0.5057082",
"0.5046005",
"0.5038645",
"0.50378364",
"0.50312907",
"0.50153536",
"0.49969548",
"0.49918088",
"0.49909893",
"0.4989064",
"0.49870354",
"0.4982559",
"0.49822703",
"0.49781412",
"0.49751082",
"0.49709827",
"0.49656665",
"0.496207",
"0.49526167",
"0.494538",
"0.49376783",
"0.49299493",
"0.49255633",
"0.49201354",
"0.491953",
"0.4918012",
"0.4892458",
"0.48870787",
"0.48811188",
"0.48778194",
"0.48683608",
"0.48613882",
"0.48433277",
"0.4832969",
"0.4830646",
"0.4829169",
"0.48242468",
"0.48121548",
"0.48077473",
"0.4805854",
"0.48055258",
"0.4802779",
"0.47963408",
"0.47952375",
"0.4794865",
"0.47855997",
"0.47847304",
"0.4783891",
"0.47815016",
"0.4780823",
"0.47775346",
"0.47710213",
"0.47669908",
"0.4764867"
] |
0.69141644
|
0
|
quick check to see if this looks like a dotmation config file
|
def is_config?(data)
data.match(/dot|xdg/)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def valid_config_filename\n \"path to a valid config file\"\n end",
"def check_config_format(config_path)\n $config = YAML::load(File.open(config_path))\n \n if !$config\n p \"Nothing in configuration. Exiting...\"\n exit 2\n elsif !$config['apps']\n p \"No applications in configuration. Exiting...\"\n exit 2\n elsif !$config['urls']\n p \"WARN: No URLs in configuration\"\n return true\n end\nend",
"def valid_config?(config)\n # check if a file exist\n unless File.file?(config)\n return false\n # puts \"[error]\".red + \" File #{config} doesn't exist.\"\n # exit 1\n end\n # check if the file extension is .yaml\n unless File.extname(config) == \".yaml\"\n return false\n # puts \"[error]\".red + \" File #{config} doesn't seem to be a yaml file.\"\n # exit 1\n end\n true\n end",
"def config?\n raw_config.present?\n end",
"def can_be_configured?(vagrant_config, file_config)\n true\n end",
"def config_parsed?\r\n config_parsed\r\n end",
"def loaded_config?\n begin\n @config = YAML::load(File.open(@options.config_file))\n rescue => err\n @stderr.puts \"Error loading config file: #{err}\"\n return false\n end\n return true\nend",
"def config_file_loaded?\n @config_file_loaded\n end",
"def config_file?(config)\n File.file?(File.join(@config_root, config.to_s) << '.rb')\n end",
"def yaml_file?\n YAML_FILE_EXTS.include?(extname)\n end",
"def config_file?\n return false unless fetched?\n\n return File.exist? \"#{working_dir}/#{config_file}\"\n end",
"def valid_config?(config)\n file = BuildConfig.new(config, SETTINGS[:project]).contents\n set_options(file, config)\n end",
"def cfgExists?\n\t\treturn true if File.exists?(@CfgSpec)\n\t\treturn false\n\tend",
"def yaml_file?\n false\n end",
"def read_config(filename)\n\t\tif File.exists?(filename)\n\t\t\tbegin\n\t\t\t\treturn YAML.load_file(filename)\n\t\t\trescue\n\t\t\t\t@errors << \"A yml was in an unreadable format. Did you confuse tabs and spaces?\"\n\t\t\t\treturn false\n\t\t\tend\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def read_config_file; end",
"def is_zz?\n zz[:app_config] != nil\n end",
"def find_config(file); end",
"def validate(file)\n Kernel::load file\n ENDPOINT.each_key do |k|\n auth = ENDPOINT[k][:oneauth]\n name = auth.split(\":\",2).first\n if name != ENV[\"USER\"]\n $Logger.error \"User attempting to upload invalid config.rb with user name of #{name} instead of #{ENV[\"USER\"]} for this service\"\n return false\n end\n end\n\n return true\n end",
"def check_config\n list = []\n %w(app_key secret_key endpoint).map do |k|\n list << k unless config.has_key? k\n end\n\n raise \"[#{list.join(', ')}] not included in your yaml file.\" unless list.empty?\n end",
"def parse_from_file\n parsed_opts = YAML.load_file(config_path)\n parsed_opts.delete_if{|k| k.to_s == 'config_path'}\n parsed_opts.each_pair{|k,v| self[k] = v}\n true\n rescue Errno::ENOENT\n false\n end",
"def config_exists?(path)\n File.exist?(path)\n end",
"def parse_config_file(file)\n return {} unless File.exist?(file)\n\n case File.extname(file)\n when /\\.conf$/i\n parse_conf_file(file)\n when /\\.json$/i\n Oj.load_file(file, mode: :strict, symbol_keys: true)\n when /\\.ya?ml$/i\n begin\n require 'safe_yaml/load'\n SafeYAML.load_file(file) || {}\n rescue LoadError\n # Re-raise with a more descriptive message. This should generally\n # abort the configuration loading.\n raise LoadError.new(%{Could not load the requested resource. Please install the 'safe_yaml' gem via\nBundler or directly, and try loading again.\n})\n end\n end\n end",
"def validate_config() \n if !File.readable?(self.config_file)\n raise Errno::EACCES, \"#{self.config_file} is not readable\" \n end\n \n # FIX ME: need to validate contents/structure?\n end",
"def config_correct?(path)\n parse(path).kind_of?(Hash)\n end",
"def config?\n options[:config]\n end",
"def parse_config\n # search upward to find project root\n path = self.root\n if path\n return YAML.load_file(path + '/.version50')\n end\n\n # project root not found\n return false\n end",
"def has_yaml_props?\n file? && data[0][0..2] == \"---\"\n end",
"def config_file\n CONFIG_FILE\n end",
"def config_file\n env_config['config_file'] || raise('environment problem:environment information not loaded')\n end",
"def check_config(config_path)\n if File.exists?(config_path)\n check_config_format(config_path)\n return true\n else\n puts \"No configuration found. Please configure which apps to start in #{config_path}\"\n exit 1\n end\nend",
"def current_folder_has_souffle_config?\n File.exists? \"#{Dir.pwd}/souffle.json\"\n end",
"def config_file\n \"#{confdir}/config.yml\"\n end",
"def has_yaml_props?\n file? && @node.body[0..2] == \"---\"\n end",
"def internal?\n base_config_path = File.expand_path(File.join(ConfigLoader::RUBOCOP_HOME,\n 'config'))\n File.expand_path(loaded_path).start_with?(base_config_path)\n end",
"def test_rubocop_config_is_valid\n config_filepath = File.join(File.dirname(__FILE__), '..', '.rubocop.yml')\n\n $stderr = StringIO.new\n RuboCop::ConfigLoader.load_file(config_filepath)\n refute_match(/Warning:/, $stderr.string, \".rubocop.yml was unparseable!\")\n ensure\n $stderr = STDERR\n end",
"def check_config\n unless File.directory?(yolo_dir) and File.exist?(yaml_path)\n @error.run_setup\n load_config\n @formatter.setup_complete\n end\n end",
"def parse_config_file\n JSON.parse(File.read(CONFIG_FILE))\n rescue Errno::ENOENT\n abort \"#{CONFIG_FILE} does not exist\"\n rescue Errno::EACCES\n abort \"#{CONFIG_FILE} can't be read\"\n rescue JSON::ParserError\n abort \"#{CONFIG_FILE} is not valid JSON\"\n end",
"def load_config\n cfg = File.open(CONFIG) { |yf| YAML::load( yf ) } if File.exists?(CONFIG)\n # => Ensure loaded data is a hash. ie: YAML load was OK\n if cfg.class != Hash\n raise \"ERROR: Configuration - invalid format or parsing error.\"\n else\n if cfg['login'].nil?\n raise \"ERROR: Configuration: login not defined.\"\n end\n end\n\n return cfg\nend",
"def configuration_file_path; end",
"def test_invalid_defining_nothing\n cp = ConfigParser.new(\"data/invalid_defining_nothing.config\")\n assert_raise ConfigParser::ParseException do\n cp.results\n end\n end",
"def exists?\n conf_file.successful?\n end",
"def exists?\n conf_file.successful?\n end",
"def handle_config\n if @opts[:file].nil?\n default = true\n components = [File.dirname(__FILE__), '..', '..', Pull::DEFAULT_CONFIG_NAME]\n file = File.absolute_path(File.join(components))\n else\n default = false\n file = @opts[:file]\n end\n\n if not File.exists? file\n if default\n msg = \"Missing default config file, expected to be at #{file}\"\n else\n msg = \"Missing config file, expected to be at #{file}\"\n end\n Trollop::die msg\n else\n file\n end\n end",
"def default_config_file\n if File.exist?(kitchen_yml) && File.exist?(dot_kitchen_yml)\n raise UserError, \"Both #{kitchen_yml} and #{dot_kitchen_yml} found. Please use the un-dotted variant: #{kitchen_yml}.\"\n end\n\n File.exist?(kitchen_yml) ? kitchen_yml : dot_kitchen_yml\n end",
"def read_config_file(file); end",
"def parse_config(config); end",
"def has_yaml_header?(file); end",
"def check_config_exists(yaml_file)\n if File.exist?(yaml_file)\n return true\n else\n puts\n puts $pastel.white('The file: ') + $pastel.bold(yaml_file) + $pastel.white(' does not exist.')\n puts\n puts $pastel.red('Please check your config file') + \"\\n\"\n exit\n end\n end",
"def detect_configuration_file\n KNOWN_CONFIG_LOCATIONS.map{|f| projectize(f)}.detect{|f| File.exists?(f)}\n end",
"def config_file\n @config_file\n end",
"def config\n mode == \"autoinst_config\"\n end",
"def yaml_custom_config?(msg)\n msg[2] == :unknown_key && msg[1] == :root && YAML_CUSTOM_CONFIG.include?(msg[3][:key])\n end",
"def config_tool_needed?\n false\n end",
"def validate_bosh_deployer_config\n return false unless File.exist? bosh_deployer_config\n @deployed_microboshes = YAML.load_file(bosh_deployer_config)\n return false unless target_microbosh_config_path\n true\n end",
"def is_first_start()\n\t\t\tif (File.exist?(ControlCat::PATH + ControlCat::CONFIGFILE))\n\t\t\t\tputs \"#{self.to_s} Tells: File exists returning true\".green if ControlCat::DEBUG\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\tputs \"#{self.to_s} Tells: File does not exist returning false\".red if ControlCat::DEBUG\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def config_service?\n true\n end",
"def parse_people_config\n people_config_path = \"config/people/#{Etc.getlogin}.yml\"\n @people_config = ( YAML.load_file(people_config_path) if File.exist?(people_config_path) ) || YAML.load_file(\"config/people/roderik.yml\")\n end",
"def parse_dotfile\n if File.exists? Backdat::Config[:json]\n raise Backdat::Exceptions::InvalidDotfile,\n \"The .backdat file #{Backdat::Config[:json]} is invalid.\"\n else\n create_backdat_file\n end\n end",
"def check_directory_and_config_file(dir = '', config = '')\n if !Dir.exist?(dir) || !File.exist?(config)\n raise \"Can't find the _config.yml or the _site directory! Please create these files it!\"\n end\n end",
"def parse_config \n path = \"#{Rails.root}/config/mebla.yml\"\n return unless File.exists?(path)\n \n conf = YAML::load(ERB.new(IO.read(path)).result)[Rails.env]\n \n conf.each do |key,value|\n self.send(\"#{key}=\", value) if self.respond_to?(\"#{key}=\")\n end unless conf.nil?\n end",
"def dotfile()\n end",
"def dotfile()\n end",
"def outside_configured_directory?(dir); end",
"def test_invalid\n cp = ConfigParser.new(\"data/invalid.config\")\n assert_raise ConfigParser::ParseException do\n cp.results\n end\n end",
"def test_no_overrides\n config = load_config('test_configs/good-config.conf')\n\n assert_equal(26214400, config.common.basic_size_limit)\n assert_equal(52428800, config.common.student_size_limit)\n assert_equal(2147483648, config.common.paid_users_size_limit)\n assert_equal('/srv/var/tmp/', config.common.path)\n assert_equal('hello there, ftp uploading', config.ftp.name)\n assert_equal('/tmp/', config.ftp.path)\n assert_equal('/tmp/', config.ftp[:path])\n assert_equal(false, config.ftp.enabled)\n assert_equal('http uploading', config.http.name)\n assert_equal('/tmp/', config.http.path)\n assert_equal(%w(array of values), config.http.params)\n assert_equal({:name => 'hello there, ftp uploading', :path => '/tmp/', :enabled => false}, config.ftp)\n assert_equal(true, config.http[:'foo bar'])\n assert_nil(config.ftp.foo)\n end",
"def app_config_file(filename)\n File.read(File.dirname(__FILE__)+\"/../../app/config/\" + filename).split(\"\\n\")\nend",
"def config_file\n File.join(root, 'config.yml')\n end",
"def dotindex?\n @_dotindex ||= File.exist?(File.join(location, '.index'))\n end",
"def parsed_config\n @parsed_config ||= begin\n JSON.parse(config[:json_config], symbolize_names: true)\n rescue JSON::ParserError\n JSON.parse(File.read(config[:json_config]),\n symbolize_names: true)\n end\n end",
"def configuration?\n get_mode.to_s.include?('config')\n end",
"def config_valid?(config)\n !config[:pattern].nil?\nend",
"def load(filename = nil)\n unless filename\n basename = File.basename($0, '.*')\n return true if load(File.expand_path(basename, '~/.options')) rescue nil\n basename << \".options\"\n return [\n # XDG\n ENV['XDG_CONFIG_HOME'],\n '~/.config',\n *ENV['XDG_CONFIG_DIRS']&.split(File::PATH_SEPARATOR),\n\n # Haiku\n '~/config/settings',\n ].any? {|dir|\n next if !dir or dir.empty?\n load(File.expand_path(basename, dir)) rescue nil\n }\n end\n begin\n parse(*IO.readlines(filename).each {|s| s.chomp!})\n true\n rescue Errno::ENOENT, Errno::ENOTDIR\n false\n end\n end",
"def config_template_exist?\n Chef::Log.debug(\"config_template_exist?: Checking for config file template #{new_resource.config_file}\")\n config_resource = !find_resource!(:template, ::File.join(new_resource.config_file)).nil?\n\n Chef::Log.debug(\"config_template_exist?: #{config_resource}\")\n config_resource\n rescue Chef::Exceptions::ResourceNotFound\n Chef::Log.debug(\"config_template_exist?: Config file template #{new_resource.config_file} ResourceNotFound\")\n false\n end",
"def check_cpath(opts)\n unless opts[\"config\"].nil?\n opts_config_path = File.expand_path(opts[\"config\"])\n if !File.readable?(opts_config_path)\n raise Errno::EACCES.new \"Could not open config file: #{@opts_config_path}\"\n else\n set_opts_config(opts_config_path)\n end\n end\n end",
"def valid_file?(file)\n case file\n when 'exclude.exclude', 'include.include',\n 'include_exclude.exclude', 'include_exclude.include',\n 'env_exclude.env.exclude', 'env_include.env.include',\n 'include_env_exclude.include', 'include_env_exclude.env.exclude',\n 'include_exclude_env_include.exclude',\n 'include_exclude_env_exclude.include',\n 'include_env_include_env_exclude.env.exclude',\n 'exclude_env_include.exclude',\n 'exclude_env_include.env.include',\n /^include_env_include\\..*include$/,\n /^include_exclude_env_include\\..*include$/,\n /^include_exclude_env_exclude\\..*exclude$/,\n /^include_env_include_env_exclude\\..*include$/,\n /^exclude_env_exclude\\..*exclude$/,\n /^env_include_env_exclude\\.env\\./,\n /^exclude_env_include_env_exclude\\.(env\\.|exclude$)/,\n /^include_exclude_env_include_env_exclude\\./,\n /^env_symbol\\..*include$/\n return true\n when /^default\\./, /^exclude\\./, /^include\\./,\n /^env_exclude\\./, /^env_include\\./, /^include_env_include\\./,\n /^include_env_exclude\\./, /^include_exclude_env_include\\./,\n /^include_exclude_env_exclude\\./, /^exclude_env_include\\./,\n /^include_env_include_env_exclude\\./, /^exclude_env_exclude\\./,\n /^env_include_env_exclude\\./, /^exclude_env_include_env_exclude/,\n /^env_symbol\\./\n return false\n end\n\n # Raise an error if the file was not handled by existing logic.\n raise \"Invalid file (#{file}) specified in #{__method__}.\"\n end",
"def check_config_data(config)\n assert_equal(:CLIENTLOGIN, config.read('authentication.method'))\n assert_equal('ruby_test_suit',\n config.read('authentication.application_name'))\n assert_equal('mySecretPassword', config.read('authentication.password'))\n assert_equal('root@example.com', config.read('authentication.email'))\n assert_equal(1234567, config.read('authentication.network_code'))\n assert_equal(:SANDBOX, config.read('service.environment'))\n assert_nil(config.read('item.not.exists'))\n assert_equal(:default, config.read('item.not.exists', :default))\n end",
"def template_config\n File.read(options['puppet_config_template'])\nend",
"def in_path?\n config.paths.any? do |path_spec|\n path_spec === file\n end\n end",
"def is_tyrant_root?( dir )\n cfg = File.join( dir, config_file_basename )\n if File.directory?( dir ) and File.exist?( cfg ) then\n IO.readlines( cfg ).each do |line|\n return true if line.index( MAGIC_LINE )\n end\n end\n return false\n end",
"def read_config_file()\n if File.exists?(options[:config_file])\n return YAML.load_file(options[:config_file])\n else\n @logger.error \"Config file [#{options[:config_file]}] missing!\"\n end\n end",
"def read_configurations(file_name = T.unsafe(nil)); end",
"def configuration_file\n @config_file_name ||= MyRhouse.confpath( \"#{config_file_name}.yml\" )\n end",
"def first_run?\n not File.exists? '/boot/config/.boxcar'\n end",
"def already_configured?\n return unless File.exist?('.config.fgi.yml')\n puts 'There is already a FGI config on this project.'\n exit!\n end",
"def test_invalid_override\n e = assert_raise(RuntimeError) { load_config('test_configs/bad-override-config.conf') }\n assert_equal('Invalid key: path<> = /srv/var/tmp/', e.message)\n end",
"def default_config_file\n './deadlyzer.yml'\n end",
"def default_config?\n configuration == environment\n end",
"def default_config?\n configuration == environment\n end",
"def config\n @config_file\n end",
"def configuration_exists(conf_line,find_str)\n\n #Check that the configuration attribute exists\n conf_exists = conf_line.include?(find_str)\n conf_value = false\n\n #Ensure there is a value for the configuration line\n if conf_exists && conf_line.split('=')[1].chomp.strip.length > 0\n conf_value = true\n end\n\n return conf_value\n\nend",
"def has_config?(variable)\n # Make sure the configured configuration is loaded, if possible\n init\n\n begin\n value = self.config(variable)\n return (not value.nil?)\n rescue RuntimeError => err\n return false\n end\n end",
"def config_path\n test? ? \"config-test.yml\" : \"config.yml\"\n end",
"def should_generate? config\n File.basename(source_file)[0] != '_'\n end",
"def option_configs_valid?\n self.class.options_provider.configs_valid?(self)\n end",
"def uses_extension?\n @format =~ /\\.[^\\.]+$/\n end",
"def checkFileExists()\n if(File.exist?(@fileName_vars))\n return\n else\n abort(\"Error: could not find the config file. Please make sure it is in the root of the application folder.\")\n end\n end",
"def test_no_sections\n e = assert_raise(RuntimeError) { load_config('test_configs/no-sections-config.conf') }\n assert_equal('Key-value pair must be part of a section', e.message)\n end",
"def config_for name\n yaml = SpaceScrape.root.join 'config', \"#{ name }.yml\"\n\n unless yaml.exist?\n raise \"Could not load configuration. No such file - #{ yaml }\"\n end\n\n erb = ERB.new(yaml.read).result\n erbd_yaml = YAML.load erb\n\n erbd_yaml[SpaceScrape.environment.to_s] || {}\n rescue YAML::SyntaxError => e\n raise \"YAML syntax error occurred while parsing #{ yaml }. \" \\\n \"Please note that YAML must be consistently indented using spaces. Tabs are not allowed. \" \\\n \"Error: #{ e.message }\"\n end",
"def configured?; false; end"
] |
[
"0.73369086",
"0.70864165",
"0.70606035",
"0.686761",
"0.68008894",
"0.67525357",
"0.6727321",
"0.66040415",
"0.6554731",
"0.6509361",
"0.648607",
"0.64283407",
"0.64094245",
"0.63725823",
"0.63665044",
"0.63643384",
"0.63350236",
"0.63327134",
"0.63140386",
"0.6308351",
"0.6296344",
"0.6289941",
"0.6262716",
"0.6256932",
"0.62555516",
"0.6242209",
"0.6240814",
"0.622853",
"0.61884046",
"0.6154327",
"0.6144549",
"0.61444914",
"0.61387837",
"0.6134958",
"0.6115128",
"0.61020523",
"0.60914457",
"0.6063338",
"0.605501",
"0.6037346",
"0.60343164",
"0.6015514",
"0.6015514",
"0.60095847",
"0.5987028",
"0.5986439",
"0.5967414",
"0.59669065",
"0.5966787",
"0.5963889",
"0.5959473",
"0.5956939",
"0.5956134",
"0.5949692",
"0.5903896",
"0.59036785",
"0.5885995",
"0.58558035",
"0.58502895",
"0.5843035",
"0.5834445",
"0.5806535",
"0.5806535",
"0.5800778",
"0.5798347",
"0.579733",
"0.5792844",
"0.5788108",
"0.57741463",
"0.57728285",
"0.57721436",
"0.57714075",
"0.5769804",
"0.57693577",
"0.5767456",
"0.5763768",
"0.5761764",
"0.5755792",
"0.57526153",
"0.5741917",
"0.57376766",
"0.5721773",
"0.5714822",
"0.5712018",
"0.57106847",
"0.5709006",
"0.5703199",
"0.5700042",
"0.5700042",
"0.56999385",
"0.56991386",
"0.5699095",
"0.5690117",
"0.5688006",
"0.56866944",
"0.56857276",
"0.5677523",
"0.56708676",
"0.5662194",
"0.5658591"
] |
0.7345876
|
0
|
arg is the path to the config file (checks for existence first), a url or a github name. If given a file then it can give line number error messages.
|
def initialize(arg=nil)
set_from_config!(arg) if arg
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def highlight_config_error(file, line)\n config_file_lines = []\n\n # A file line is split into the line number (index) and the line content.\n # The line number is converted to string (to_s), right justified 3 characters with a colon, and its trimmed (chomp)\n\n IO.readlines(file).each_with_index {|l, i| config_file_lines << \"#{(i + 1).to_s.rjust(3)}: #{l.chomp}\"}\n # mark the appropriate line with a red color, if its just one line, then mark the zeroth line.\n # if not get the range (deducting 2), and mark the second line.\n if line == 1\n lines = config_file_lines[0..3]\n lines[0] = text.color(lines[0], :red)\n else\n lines = config_file_lines[Range.new(line - 2, line)]\n lines[1] = text.color(lines[1], :red)\n end\n text.msg \"\"\n # print the name of the file in white\n text.msg text.color(\" # #{file}\", :white)\n # print the rest of the line.\n lines.each {|l| text.msg(l)}\n text.msg \"\"\n end",
"def check_line(filename, line_number, line_content)\n\t\tend",
"def set_from_config!(arg)\n @config_data = \n if arg.include?(\"://\")\n open(arg) {|io| io.read }\n elsif File.exist?(arg)\n @config_filename = arg\n IO.read(arg)\n else\n url = \"https://raw.github.com/#{arg}/#{DEFAULT_CONFIG_GITHUB_REPO}/master/#{DEFAULT_CONFIG_GITHUB_PATH}\"\n begin\n open(url) {|io| io.read }\n rescue\n raise RuntimeError, \"assuming this is a github account name, but config file does not exist!: #{url}\"\n end\n end\n raise \"config file doesn't look like config file\" unless is_config?(@config_data)\n (@data, @repos) = read_config_data(@config_data, @config_filename)\n self\n end",
"def load_error(path)\n log.fatal(\"#{path} is either missing or formatted incorrectly!\")\n load_error = <<END\n#{path} is either missing or formatted incorrectly!\n\nTo run this script, you need to create a file named\n#{path} with your configuration in the following format:\n\n# Comment\n:key: 'value'\n:string: 'string value'\n:integer: 123\n:boolean: true/false\n:array:\n- '1st'\n- '2nd'\n:hash:\n-\n:sub_key: 'sub value'\n\nEND\n return load_error\n end",
"def line_number=(_arg0); end",
"def line_number=(_arg0); end",
"def line_number=(_arg0); end",
"def potential_line?(filename, lineno); end",
"def config_error(path, error); end",
"def check_gh_link(file)\n\n File.foreach(file).with_index do |line, line_num|\n\n # If the link is present, return nil so the next file can be parsed.\n return nil if line.match(GHLINKREGEX)\n\n # Return an error message if the 'edit on GitHub' link is not present by line number 7.\n if line_num == 7\n @errors << \"No edit link found in #{file}\"\n break\n end\n end\nend",
"def valid_config_filename\n \"path to a valid config file\"\n end",
"def validate_config\n if config['repo'].nil? || !config['repo'].is_a?(String) || config['repo'].empty?\n error \"No 'repo' value found in 'steel.yml' or on the command line!\"\n error \"Which repo would you like to pull files from?\"\n Choice.help\n exit 2\n end\n end",
"def test_third_line\n assert_equal \" def valid_working_gemspec_args\\n\",\n Working.file_third_line(__FILE__)\n end",
"def format_compile_error(file_name, file_path, reason,\n line, cursor); EMPTY; end",
"def line_number\n raise \"This loader doesn't support line_number\"\n end",
"def check_format_rules(line_number, line)\n errors = []\n unless line_number > 0\n conventions = ['feat', 'fix', 'build', 'chore', 'ci', 'docs', 'style', 'refactor', 'perf', 'test']\n conventional_commit_conventions = conventions.map{|x| Regexp.new '(^' + x + ')' + '(\\(.*\\))?!?: [\\w+\\D\\-\\d+]'}\n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n if conventional_commit_check.empty?\n unless line.include?('HOTFIX')\n errors << \"\\tError: Your custom commit doesn't seem like following conventional commit rules.\"\n errors << \"\\tCheck https://www.conventionalcommits.org\"\n end\n end\n errors << \"\\tError: Your subject contains #{line.split(':')[1].length} characters. Subject should be less than 50 characters\" if line.split(']')[1]&.length.to_i > 50\n errors << \"\\tError: Commit message subject should start in Capital.\" if line.split(']')[1] && line.split(']')[1].lstrip[0] == line.split(']')[1].lstrip[0].downcase\n end\n return errors\nend",
"def test_invalid_file_correct_args_length\n assert_output(\"File not found!\\n\") {@grapher.make_graph(['hi.txt'])}\n end",
"def check_format_rules(line_number, line)\n conventional_commit_conventions = [ 'feat(.*): ', 'fix(.*): ', 'chore(.*): ', 'install(.*): ', 'improvement(.*): ', 'ci(.*): ', 'ui(.*): ', 'style(.*): ' ] \n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n errors = []\n if conventional_commit_check.empty?\n unless line.include?('HOTFIX')\n return errors << \"Error : Your commit message seems like not following conventional commit rules, please check your commit's convention\"\n end\n end\n errors << \"Error : Your commit message contains #{line.length} characters. Commit message should be less than 72 characters in length.\" if line.length > 72\n errors << \"Error : Your subject contains #{line.split(':')[1].length} characters. Subject should be less than 50 characters\" if line.split(':')[1].length > 50\n errors << \"Error : Commit message subject should start in Capital.\" if line.split(':')[1].lstrip[0] == line.split(':')[1].lstrip[0].downcase\n return errors\nend",
"def lineNum() # Had to move this to above the first call or it didn't work. Didn't think that was necessary\n caller_infos = caller.first.split(\":\")\n # Note caller_infos[0] is file name\n caller_infos[1]\nend",
"def check_file(file_result)\n begin\n ::YAML.load(File.read(file_result.path))\n rescue Psych::SyntaxError => e\n file_result.add_issue(\n line_number: e.line,\n character: e.column,\n level: :error,\n raw_message: e.problem,\n )\n end\n end",
"def lineno=(_arg0); end",
"def handle_config\n if @opts[:file].nil?\n default = true\n components = [File.dirname(__FILE__), '..', '..', Pull::DEFAULT_CONFIG_NAME]\n file = File.absolute_path(File.join(components))\n else\n default = false\n file = @opts[:file]\n end\n\n if not File.exists? file\n if default\n msg = \"Missing default config file, expected to be at #{file}\"\n else\n msg = \"Missing config file, expected to be at #{file}\"\n end\n Trollop::die msg\n else\n file\n end\n end",
"def use_file(file_arg, line)\n read = true\n file_arg.each do |file|\n f = check_file(file)\n exit 5 unless f\n f.each_line do |num|\n line += 1\n work_prompt(num, line, read)\n end\n f.close\n end\n end",
"def lineNum()\n caller_infos = caller.first.split(\":\")\n # Note caller_infos[0] is file name\n caller_infos[1]\nend",
"def check_file(filename)\n # set output format to 'simple' (easier to parse) and\n # include rubocop configuration file\n rubocop_res = `rubocop -f simple -c #{@options[:config]} #{filename}`\n results = parse_rubocop_output(rubocop_res)\n unless (results[:C].empty? &&\n results[:E].empty? &&\n results[:F].empty? &&\n results[:W].empty?) ||\n @options[:quiet]\n puts\n @options[:jenkins] ?\n puts(\"=== #{filename} ===\") :\n puts(\"=== #{filename} ===\".bold)\n print_offenses(results)\n end\n # Report results in a json file\n report_results(filename, results, 'coding_style') if @options[:report]\n # Return code\n (results[:C].empty? && results[:E].empty? && results[:F].empty?) ? 0 : 1\n end",
"def lineNum()\n caller_infos = caller.first.split(\":\")\n # Note caller_infos[0] is file name\n # caller_infos[1]\n return \"Line no. #{caller_infos[1]}\"\nend",
"def parse_file(file, arg={})\n begin\n parse_file!(file, arg)\n rescue => ex\n @error = ex.message\n nil\n end\n end",
"def lineno=(arg0)\n end",
"def errorfile(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"errorfile \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def arg_error\r\n puts \"Usage:\\nruby ruby_rush.rb *seed* *num_prospectors* *num_turns*\\n*seed* should be an integer\\n*num_prospectors*\"\\\r\n \" should be a non-negative integer\\n*num_turns* should be a non-negative integer\"\r\n exit 1\r\nend",
"def read_config_file(file)\n Meggy::Config.from_file(file)\n rescue SyntaxError => e\n @text.error \"You have invalid ruby syntax in your config file #{file}\"\n @text.info(text.color(e.message, :red))\n if file_line = e.message[/#{Regexp.escape(file)}:[\\d]+/]\n line = file_line[/:([\\d]+)$/, 1].to_i\n highlight_config_error(file, line)\n end\n exit 1\n rescue Exception => e\n @text.error \"You have an error in your config file #{file}\"\n @text.info \"#{e.class.name}: #{e.message}\"\n filtered_trace = e.backtrace.grep(/#{Regexp.escape(file)}/)\n filtered_trace.each {|line| text.msg(\" \" + text.color(line, :red))}\n if !filtered_trace.empty?\n line_nr = filtered_trace.first[/#{Regexp.escape(file)}:([\\d]+)/, 1]\n highlight_config_error(file, line_nr.to_i)\n end\n\n exit 1\n end",
"def load_error!(msg, path, node)\n line = node.start_line + 1\n column = node.start_column\n raise \"#{path}:#{line}:#{column}: error: #{msg}\"\n end",
"def check_line(file_name, line_number, line_content)\n\t\tif (line_content.length > LONG_LINE_LENGTH) then\n\t\t\tadd_note(LintWorm::Note::WARNING, \"Line exceeding #{LONG_LINE_LENGTH.to_s} bytes\", line_number) \n\t\tend\n\tend",
"def check_line(file_name, line_number, line_content)\n\t\tif (line_content.length > LONG_LINE_LENGTH) then\n\t\t\tadd_note(MsfLint::Note::WARNING, \"Line exceeding #{LONG_LINE_LENGTH.to_s} bytes\", line_number) \n\t\tend\n\tend",
"def show_usage_and_exit\r\n puts 'Usage:', 'verifier.rb *filename* file should be a blockchain.txt file'\r\n exit 1\r\nend",
"def file_line=(_arg0); end",
"def find_config(file); end",
"def with_optional_failures_filename(&proc)\n filename = config_source['failures_file']\n\n unless filename.blank?\n path = FilePath.new(filename)\n proc.call(path)\n end\n end",
"def debug_header(config)\n stderr.puts <<-EOF.strip\nruby: #{RUBY_DESCRIPTION}\nruby-lint: #{RubyLint::VERSION}\ndirectory: #{Dir.pwd}\ncaching: #{config.enable_cache}\ncache: #{config.cache_directory}\n EOF\n\n stderr.puts\n end",
"def validate_config(config)\n errors = []\n errors.push 'control_repos key is not an Array' unless config['control_repos'].is_a?(Array)\n errors.each { |l| log.error l }\n raise ErrorAndExit, 'Errors found in config file. Cannot proceed.' unless errors.empty?\n end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def line_number; end",
"def error_message\n \"JPT - #{setting_name} received an invalid argument: #{source}\"\n end",
"def check_config_format(config_path)\n $config = YAML::load(File.open(config_path))\n \n if !$config\n p \"Nothing in configuration. Exiting...\"\n exit 2\n elsif !$config['apps']\n p \"No applications in configuration. Exiting...\"\n exit 2\n elsif !$config['urls']\n p \"WARN: No URLs in configuration\"\n return true\n end\nend",
"def parse_position_one_arg(arg, old_mod=nil, show_errmsg=true, allow_offset=false)\n name, filename = nil, nil, nil\n begin\n # First see if argument is an integer\n lineno = Integer(arg)\n rescue\n else\n container = frame_container(@frame, false)\n filename = container[1] unless old_mod\n return nil, [container[0], canonic_file(filename)], lineno\n end\n\n # Next see if argument is a file name \n found = \n if arg[0..0] == File::SEPARATOR\n LineCache::cached?(arg)\n else\n resolve_file_with_dir(arg)\n end\n if found\n return nil, [container && container[0], canonic_file(arg)], 1 \n else\n matches = find_scripts(arg)\n if matches.size > 1\n if show_errmsg\n errmsg \"#{arg} is matches several files:\"\n errmsg Columnize::columnize(matches.sort, \n @settings[:width], ' ' * 4, \n true, true, ' ' * 2).chomp\n end\n return nil, nil, nil\n elsif matches.size == 1\n LineCache::cache(matches[0])\n return nil, ['file', matches[0]], 1\n end\n end\n\n # How about a method name with an instruction sequence?\n iseq = object_iseq(arg)\n if iseq && iseq.source_container[0] == 'file'\n filename = iseq.source_container[1]\n line_no = iseq.offsetlines.values.flatten.min\n return arg, ['file', canonic_file(filename)], line_no\n end\n\n if show_errmsg\n unless (allow_offset && arg.size > 0 && arg[0].downcase == 'o')\n errmsg(\"#{arg} is not a line number, read-in filename or method \" +\n \"we can get location information about\")\n end\n end\n return nil, nil, nil\n end",
"def msg_ERROR(source, args)\n return args[0]\n end",
"def handle_arguments(args)\n if input_file.nil?\n print_usage\n true\n else\n args.help || args.version\n end\n end",
"def definitions_at(filename, line, column); end",
"def bail_args(arg_err)\n bail \"Error: bad arguments - #{arg_err}\\n Hint: Use -h or --help\"\n end",
"def process_arguments\n if @options.config != nil\n if File.exist?(@options.config)\n load_config_file \n @config.each do |k, v|\n @project = v\n\n#need to do \n\n end\n else\n error(\"Config file does not exist\")\n end\n else\n @project = @options.project || \"NA\"\n @sub_dir = @options.sub_dir || \"NA\"\n @outname = @options.outname || @options.sub_dir\n @outdir = @options.outdir || $config[\"outdir\"]\n @bams = @options.bams\n @c_design = @options.c_design || nil\n @queue = @options.queue || $config[\"queue\"]\n @ref = @options.ref || \"hg19\"\n @rg_id = @options.rg_id || $config[\"rg\"][\"rg_id\"]\n @sample = @options.sample || \"NA\"\n\n end\n end",
"def lint(*args); end",
"def raise_error(message, line, col = 0, length = 0)\n line, col, length = line.line_num, line.column, line.length if line.is_a? Token\n\n header = \"#{@file}##{line}: \"\n str = \"Error: #{message}\\n\".red\n str << \"#{@file}##{line - 1}: #{@source.lines[line - 2].chomp}\\n\".light_black if line > 1\n str << \"#{header}#{(@source.lines[line - 1] || \"\").chomp}\\n\"\n str << (' ' * (col + header.length - 1))\n str << '^' << ('~' * (length - 1)) << \"\\n\"\n str << \"#{@file}##{line + 1}: #{@source.lines[line].chomp}\\n\".light_black if @source.lines[line]\n raise str\n end",
"def test_invalid_defining_nothing\n cp = ConfigParser.new(\"data/invalid_defining_nothing.config\")\n assert_raise ConfigParser::ParseException do\n cp.results\n end\n end",
"def line_number\n return unless backtrace and backtrace[0]\n\n backtrace[0].split(\":\")[1].to_i\n end",
"def test_invalid\n cp = ConfigParser.new(\"data/invalid.config\")\n assert_raise ConfigParser::ParseException do\n cp.results\n end\n end",
"def format_compile_warning(file_name, file_path, reason,\n line, cursor); EMPTY; end",
"def validate(path)\n if config_exists?(path) and config_correct?(path)\n parse(path)\n else\n puts load_error(path)\n exit 1\n end\n end",
"def check_arg()\n if ARGV.length > 1\n print \"ERROR: Too many command line args.\\n\"\n print \"USAGE: #{$PROGRAM_NAME} [--FixThemAll]\\n\"\n exit ERR_EXIT_ARGS2MANY\n end\n if ARGV.length == 1 && ARGV[0] != '--FixThemAll'\n print \"ERROR: Invalid argument on command line: '#{ARGV[0]}'\\n\"\n print \"USAGE: #{$PROGRAM_NAME} [--FixThemAll]\\n\"\n exit ERR_EXIT_ARGINVALID\n end\nend",
"def test_rubocop_config_is_valid\n config_filepath = File.join(File.dirname(__FILE__), '..', '.rubocop.yml')\n\n $stderr = StringIO.new\n RuboCop::ConfigLoader.load_file(config_filepath)\n refute_match(/Warning:/, $stderr.string, \".rubocop.yml was unparseable!\")\n ensure\n $stderr = STDERR\n end",
"def valid?(*arg)\n ::File.exist?(arg.last) ? arg : nil\n end",
"def set_gem_version_and_file line, file, line_num\n if line =~ @gem_name_version\n @tracker.config.add_gem $1, $2, file, line_num\n end\n end",
"def usage\n $stderr.puts \"usage: #{$PROGRAM_NAME} <repo_name> load_check_head\"\n $stderr.puts \" #{$PROGRAM_NAME} <repo_name> save_check_head <check_head>\"\n $stderr.puts \" #{$PROGRAM_NAME} <repo_name> push_statuses_after_check_head\"\n $stderr.puts \" #{$PROGRAM_NAME} <repo_name> recent_statuses [offset [limit]]\"\n exit 1\nend",
"def validate(args, config)\n errors = ValidationErrors.new\n config.options.each do |(name, option)|\n validate_argument(args.option(name), option, errors) \\\n if args.options.key?(name.to_s)\n end\n raise(Cliqr::Error::IllegalArgumentError, \"illegal argument error - #{errors}\") \\\n unless errors.empty?\n args\n end",
"def load_error=(_arg0); end",
"def validate_naming_options(args, options)\n if args.empty?\n $stderr.puts(\"Error due to missing files to analyze. You must provide at least one log file (csv).\\n\")\n exit!\n end\n\n if !options.update.empty? && !File.exist?(options.update)\n $stderr.puts(\"Error: File #{options.update} does not exist.\\n\")\n exit!\n end\nend",
"def config_path(arg = nil)\n set_or_return(:config_path,\n arg,\n kind_of: String,\n default: '/etc/hipache.json')\n end",
"def custom_config_path\n argv.each_with_index do |arg, index|\n if arg == \"--config-path\" || arg == \"-c\"\n next_arg = argv[index + 1]\n raise ConfigPathNotProvided.new if next_arg.nil?\n raise ConfigPathInvalid.new(next_arg) unless File.file?(next_arg) && File.readable?(next_arg)\n\n return next_arg\n end\n end\n nil\n end",
"def do_error_command(name, file) \n output, result = compile_file(name)\n errors = parse_output(output)\n saved = []\n ln = 1 # first line is already parsed, start loop at 2\n file.each do |line| \n ln = ln + 1\n match = line.match(/(\\/\\/+).*ERROR(.*)/)\n unless !match.nil? && match[1].length == 2 \n\t\t\tunless errors[ln].nil?\n\t\t\t\terrors[ln].each do |err|\n\t\t\t\t\tsaved << [err, \"\"]\n\t\t\t\tend\n\t\t\tend\n next\n end\n\n regex = \"#{name}:#{ln}:.+:.*#{match[2].strip}\"\n regelse = \"#{name}:#{ln}:.+:.*\"\n\n\t\tif errors[ln].nil? \n\t\t\tsaved << [\"\", regex]\n\t\t\tnext\n\t\tend\n\n errors[ln].each do |err|\n omatch = output.match(regex)\n unless omatch.nil? \n next\n\t\t\tend\n\t\t\tsaved << [err, regex]\n end\n\tend\n\n if saved.length > 0 \n puts \"----------------------------------------------------------------------\"\n puts \"BUG: %s unmatched errors \" % name\n puts \"----------------------------------------------------------------------\"\n saved.each do |error|\n puts \"#{error[0]} -- #{error[1]}\"\n end\n puts \"----------------------------------------------------------------------\"\n exit 1\n end\nend",
"def err_missing (message, usage)\n raise \"Missing argument --#{message}\\n#{usage}\"\n end",
"def __find_caller__(str)\n i_caller = str[0]\n if i_caller =~ /([^:]+):([0-9]+)(:.*)?/\n file = File.expand_path($1)\n line = $2.to_i\n if not $__source_files__.include?(file)\n $__source_files__.push(file)\n end\n [file, line]\n else\n puts i_caller\n puts \"[Internal Error] __find_caller__ is called inappropriately.\" \n exit(1)\n end\nend",
"def fail(message) [:fail, message.to_s, line, file]; end",
"def line_num; end",
"def usage_page\n Format.usage(\"You can run me with the following flags: #{File.basename(__FILE__)} -[d|e|h] -[f] <path/to/file/if/any>\")\n exit\nend",
"def optest_file_error(line)\n print \"\\nTesting Operator File Error: #{line}\\n\"\n args = line.split(/ /)\n result = TabulatorOperator.new.operator_command(args)\n assert((result =~ /^File*/), \"Expected File error: #{result}\")\n end",
"def call(filepath, linenum) # should separate to a class?\n command = (@command || detect_command()) % [linenum, filepath] # or [filepath, linenum]\n log(command)\n `#{command.untaint}`\n end",
"def verify_file_under_repo(filepath)\n unless File.expand_path(filepath).starts_with?(GIT_REPO)\n raise \"Invalid path=#{filepath}, must be under git-wiki repository\"\n end\n filepath\n end",
"def error(msg) log(ERROR, \"ERROR \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end",
"def defs(file, line, col); end",
"def defs(file, line, col); end",
"def error_line msg\n return \"llmk error: #{msg}\"\n end",
"def lineno\n end",
"def lineno\n end",
"def check_build_src_file(rb_file)\n if !rb_file\n puts \"Please provide a Ruby file to build\"\n exit\n elsif !File.exists? rb_file\n puts \"Can't find file: #{rb_file}\"\n exit\n end\nend",
"def error(msg:, item: nil)\n @badline = true\n if item.nil?\n puts \"#{@filename}:#{@line_no + 1} #{msg}\"\n else\n puts \"#{@filename}:#{@line_no + 1}:#{item} #{msg}\"\n end\n end",
"def error_line(comment, line_number, item, line, exception = nil)\n puts \"#{comment}::#{line_number}::#{exception.class}::#{item}::::#{line}\"\n end",
"def refs(file, line, col); end",
"def refs(file, line, col); end",
"def scan_file (file_name)\n #for each line\n File.open(file_name).each do |line|\n parsed_line = parse_line line\n raise \"Invalid spec format:\\n\" + line if parsed_line.class == InvalidLine\n update_on_new_line parsed_line\n end \n @test_suite.add_test_case current_test_case if current_test_case && @state.class == AddingTestCases\n @test_suite\n end",
"def check_file(filename)\n lines = []\n line_num = 0\n # Get tags to search in file\n pattern = define_regexp\n # Read lines of file\n File.open(filename, 'r') do |file|\n file.each_line do |line|\n line_num += 1\n lines << [line_num, line] if line =~ /#{pattern}/i\n end\n end\n # Report results in json file\n report_results(filename, lines, 'tags') if @options[:report]\n # Print results if required\n unless @options[:quiet] || lines.empty?\n puts\n @options[:jenkins] ?\n puts(\"=== #{filename} ===\") :\n puts(\"=== #{filename} ===\".bold)\n print_tags(lines)\n end\n 0\n end",
"def lineno; end",
"def lineno; end",
"def lineno; end",
"def syntax_error!(message, args = {})\n args[:orig_line] ||= @orig_line\n args[:line] ||= @line\n args[:lineno] ||= @lineno\n args[:column] ||= args[:orig_line] && args[:line] ? args[:orig_line].size - args[:line].size : 0\n raise SyntaxError.new(message, options[:file], args[:orig_line], args[:lineno], args[:column])\n end",
"def call(env)\n if revision_file.exist?\n ok revision_file.read\n elsif git_repository?\n ok git_current_commit_sha\n else\n not_found 'Could not determine SHA'\n end\n end",
"def check(config = {})\n defaults = {validator: 'clang-format', file_extensions: ['.h', '.m', '.mm'], ignore_file_patterns: []}\n config = defaults.merge(config)\n validator = *config[:validator]\n file_extensions = [*config[:file_extensions]]\n ignore_file_patterns = [*config[:ignore_file_patterns]]\n\n diff = ''\n case danger.scm_provider\n when :github\n diff = github.pr_diff\n when :gitlab\n diff = gitlab.mr_diff\n when :bitbucket_server\n diff = bitbucket_server.pr_diff\n else\n raise 'Unknown SCM Provider'\n end\n\n changes = get_changes(diff, file_extensions, ignore_file_patterns)\n offending_files, patches = resolve_changes(validator, changes)\n\n message = ''\n unless offending_files.empty?\n message = 'Code style violations detected in the following files:' + \"\\n\"\n offending_files.each do |file_name|\n message += '* `' + file_name + \"`\\n\\n\"\n end\n message += 'Execute one of the following actions and commit again:' + \"\\n\"\n message += '1. Run `%s` on the offending files' % validator + \"\\n\"\n message += '2. Apply the suggested patches with `git apply patch`.' + \"\\n\\n\"\n message += patches.join(\"\\n\")\n end\n\n return if message.empty?\n fail VIOLATION_ERROR_MESSAGE\n markdown '### Code Style Check'\n markdown '---'\n markdown message\n end",
"def location=((filename, lineno))\n @filename = filename\n @lineno = lineno if lineno\n end"
] |
[
"0.62650716",
"0.6073621",
"0.58032966",
"0.57874924",
"0.57857597",
"0.57857597",
"0.57857597",
"0.56303215",
"0.56060684",
"0.5559154",
"0.55367726",
"0.5463535",
"0.5462387",
"0.5460368",
"0.5424499",
"0.54067826",
"0.5389436",
"0.5387178",
"0.5384301",
"0.5381973",
"0.5347883",
"0.52640045",
"0.526302",
"0.5245096",
"0.5241297",
"0.5233474",
"0.5196608",
"0.5169141",
"0.51672524",
"0.51608366",
"0.51603466",
"0.513376",
"0.51326895",
"0.5123629",
"0.5121807",
"0.51097965",
"0.50997984",
"0.50993884",
"0.5095972",
"0.50862134",
"0.50795925",
"0.50795925",
"0.50795925",
"0.50795925",
"0.50795925",
"0.50795925",
"0.50795925",
"0.5079409",
"0.5071436",
"0.507106",
"0.5068399",
"0.50582206",
"0.5050247",
"0.504908",
"0.5048194",
"0.50449467",
"0.5036093",
"0.50328666",
"0.5010747",
"0.5000415",
"0.49846333",
"0.49777365",
"0.4971156",
"0.49706227",
"0.49674737",
"0.4956982",
"0.4940952",
"0.49349245",
"0.4928136",
"0.4924885",
"0.49222928",
"0.4921154",
"0.4918278",
"0.4913656",
"0.49093226",
"0.49037784",
"0.48993868",
"0.48865688",
"0.48853832",
"0.48380688",
"0.48376068",
"0.48354408",
"0.48292315",
"0.48292315",
"0.48182273",
"0.48150095",
"0.48150095",
"0.48104197",
"0.48040023",
"0.48039198",
"0.48022687",
"0.48022687",
"0.4796552",
"0.4794988",
"0.47828025",
"0.47828025",
"0.47828025",
"0.476293",
"0.4762149",
"0.47615883",
"0.47581843"
] |
0.0
|
-1
|
given a filename, a url, or a github name, will read the config file. returns self
|
def set_from_config!(arg)
@config_data =
if arg.include?("://")
open(arg) {|io| io.read }
elsif File.exist?(arg)
@config_filename = arg
IO.read(arg)
else
url = "https://raw.github.com/#{arg}/#{DEFAULT_CONFIG_GITHUB_REPO}/master/#{DEFAULT_CONFIG_GITHUB_PATH}"
begin
open(url) {|io| io.read }
rescue
raise RuntimeError, "assuming this is a github account name, but config file does not exist!: #{url}"
end
end
raise "config file doesn't look like config file" unless is_config?(@config_data)
(@data, @repos) = read_config_data(@config_data, @config_filename)
self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read_config_file(file); end",
"def read_config_file; end",
"def initialize\n @config = config_from_file || empty_config\n end",
"def config_file\n @config_file\n end",
"def initialize(file_name, config = Crossref::Config)\n @file_name = file_name\n @config = config.load_config\n end",
"def load!(filename)\n config_file = File.open(filename).read\n config = YAML.load(config_file)\n raise ConfigError(\"unable to load config file #{filename}\") unless config\n @_config = config\n end",
"def load_repo_config; end",
"def config\n @config_file\n end",
"def load_from_file filename\n fnm = File.exist?(filename) ? filename : File.join(@wd,filename)\n load_configuration(fnm)\n end",
"def parse(file_name)\n raise Mongify::ConfigurationFileNotFound, \"File #{file_name} is missing\" unless File.exists?(file_name)\n config = self.new\n config.instance_eval(File.read(file_name))\n config\n end",
"def get_config_from_file(filename)\n # Try to load the file from disk\n begin\n # Determine the extension\n ext = File.extname(filename)\n # Use the correct loader\n if ext == \".yml\"\n data = YAML.load_file(filename)\n elsif ext == \".json\"\n json = File.read(filename)\n data = JSON.parse(json)\n end\n rescue Exception => e\n raise \"Error loading file: #{filename} #{e}\"\n end\n\n # Fix up empty files\n if data.nil? or data == false\n warn \"Could not load configuration from '#{Config.config_files}'; it might be empty or malformed.\"\n data = {}\n end\n return data\n end",
"def config\n Timetrap::Config['github'] ||\n fail('Github settings missing in config file')\n end",
"def load(name)\n config_file \"#{name}\"\n end",
"def from_config(file = nil)\n config_file = config_file(file)\n\n init(config_file.config[:uri], config_file.config[:prefix])\n end",
"def get_url\n return @url if @url\n\n yml = YAML::load_file(\"#{repo_dir}/.ram_config\")\n yml = yml.it_keys_to_sym\n @url = yml[:url]\n\n UI.puts \"-> error while reading the YML #{e.to_s}\".red if @url.nil?\n @url\n end",
"def config\n @config ||= YAML.load File.read(@config_file)\n end",
"def config(value)\n # require value if File.exists?(value)\n if File.exists?(value)\n fc = File.read(value)\n self.instance_eval(fc)\n end\n end",
"def from_config\n config ||= YAML::load(File.open((File.join(File.dirname(__FILE__), 'config.yml'))))\nend",
"def config_file(filename)\n if filename =~ /^\\//\n @@config_file = filename\n else\n @@config_file = File.join(File.expand_path('~'),filename)\n end\n commands[:initconfig] = InitConfig.new(@@config_file)\n @@config_file\n end",
"def config_file\n CONFIG_FILE\n end",
"def configuration_file\n @config_file_name ||= MyRhouse.confpath( \"#{config_file_name}.yml\" )\n end",
"def get_gh_file_content(filename)\n uri = \"https://raw.githubusercontent.com/fastruby/rails-template/main/config_files/#{filename}\"\n Net::HTTP.get(URI(uri))\nend",
"def find_config(file); end",
"def config\n @config ||= YAML.load_file(@config_file_path)\n end",
"def config_filename= filename\n @cfg_filename = filename\n end",
"def config_load(config); end",
"def config\n @config ||= YAML.load_file(BASE_PATH + '/local.config.yml')\nend",
"def get_config(project)\n branch = get_release(project)\n YAML.load(get_github_file(project, branch, 'config/config.yml'))\n end",
"def get\n if File.exist?(@config_file)\n file = File.read(@config_file)\n @config = JSON.parse(file)\n end\n @config\n end",
"def load_config_file\n require 'yaml'\n YAML.load_file(@path)\n rescue Errno::ENOENT\n return\n end",
"def handle_config\n if @opts[:file].nil?\n default = true\n components = [File.dirname(__FILE__), '..', '..', Pull::DEFAULT_CONFIG_NAME]\n file = File.absolute_path(File.join(components))\n else\n default = false\n file = @opts[:file]\n end\n\n if not File.exists? file\n if default\n msg = \"Missing default config file, expected to be at #{file}\"\n else\n msg = \"Missing config file, expected to be at #{file}\"\n end\n Trollop::die msg\n else\n file\n end\n end",
"def load\n configuration # Need to call this to make sure it's populated\n self.instance_eval(IO.read(path), path, 1) if path && File.exists?(path)\n self\n end",
"def read_config!\n @config = YAML.load_file(CONFIG_FILE)\n end",
"def read_config_files(files); end",
"def read_config(name)\n read_config_file[name]\n end",
"def read_config_data(data, filename=nil)\n ConfigReader.new.read(data, filename)\n end",
"def initialize\n @path = File.join(File.expand_path('.'), FILE_NAME)\n unless File.exist?(@path)\n @path = (ENV['ASPELLBEE_CONFIG_PATH'] || File.join(File.expand_path('~'), FILE_NAME))\n end\n @data = load_config_file\n end",
"def read_config_file()\n if File.exists?(options[:config_file])\n return YAML.load_file(options[:config_file])\n else\n @logger.error \"Config file [#{options[:config_file]}] missing!\"\n end\n end",
"def load_config(filename)\n\t\t\tconfig = read_config(filename)\n\t\t\t@servers = config[:servers]\n\t\t\t@email_addr = config[:email][:addr]\n\t\t\t@email_sender = config[:email][:sender]\n\t\tend",
"def load_from_file(filename, environment)\n if File.exist?( filename ) then\n @loaded_from = filename\n configuration = YAML.load_file(filename)\n if environment_based?\n configuration = configuration[environment] or raise Error, \"environment #{environment} \" +\n \"not found in #{filename}\"\n configuration\n end\n keys.each do |k|\n raise Error, \"key missing: #{k}\" unless configuration.has_key?( k )\n end\n configuration.extend(AlternateConfig)\n configuration.config_file = self\n configuration\n else\n raise Error, \"file not found: #{filename}\"\n end\n end",
"def load(config_filename)\n eval(IO.read(config_filename), binding, config_filename)\n (local_variables - [\"config_filename\"]).each { |v| self[v] = eval(v, binding) }\n self\n end",
"def load_config( filename )\n\n fullname = \"#{Rails.application.root}/config/#{filename}\"\n begin\n config_erb = ERB.new( IO.read( fullname ) ).result( binding )\n rescue StandardError => ex\n raise( \"#{filename} could not be parsed with ERB. \\n#{ex.inspect}\" )\n end\n\n begin\n yml = YAML.load( config_erb )\n rescue Psych::SyntaxError => ex\n raise \"#{filename} could not be parsed as YAML. \\nError #{ex.message}\"\n end\n\n config = yml.symbolize_keys\n @configuration = config[ Rails.env.to_sym ].symbolize_keys || {}\n end",
"def load_config(config_file)\n YAML.load(File.open(config_file))\nend",
"def config\n\tYAML.load(File.open(\"config.yaml\"))\nend",
"def config\n @config ||= YAML.load_file @options[:config_file]\n end",
"def load_config_file!(file=nil)\n @set_params = {}\n if file.nil?\n if defined?(Rails)\n file = \"#{Rails.root}/config/clicky-api.yml\"\n else\n return nil ## perhaps this should throw here?\n end\n end\n config = YAML.load_file(file) || {}\n ClickyAPI.set_params!(config)\n end",
"def load(fn)\n if File.file?(fn)\n begin\n File.open(fn).each do |line|\n #peel off terminators/leading spaces, etc.\n line.strip!\n\n #ignore comment lines...\n if (line[0..0]!=\"#\")\n keyval = line.split(\"=\") # split on equal sign\n\n #ignore blank lines\n if keyval.size>0\n key = keyval[0].strip\n value = keyval[1].strip\n self[key] = value\n end\n end\n end\n rescue\n raise \"Error: trouble loading data from file: #{fn}.\\nDetails: #{$!}\"\n end\n else\n raise \"Error: cannot find configuration file: #{fn}.\\nDetails: File not found.\"\n end\n end",
"def initialize(filename, environment = nil)\n raise \"Config #{filename} not found\" unless File.exist? filename\n @filename = filename\n @environment = environment || current_environment\n end",
"def initialize\n create_config unless File.exists?(config_file)\n load_settings\n set_domain\n end",
"def load_local\n files = lookup(CONFIG_FILE)\n file = files.find{ |f| File.file?(f) }\n new(*file)\n\n #if file\n # paths = [file]\n #else\n # dir = lookup(CONFIG_DIR).find{ |f| File.directory?(f) }\n # paths = dir ? Dir.glob(File.join(dir, '**/*')) : []\n #end\n #files = paths.select{ |path| File.file?(path) }\n end",
"def read_configuration(filename)\n raise GaudiConfigurationError, \"Cannot load configuration.'#{filename}' not found\" unless File.exist?(filename)\n\n lines = File.readlines(filename)\n cfg_dir = File.dirname(filename)\n begin\n cfg = parse_content(lines, cfg_dir, *keys)\n rescue GaudiConfigurationError\n raise GaudiConfigurationError, \"In #{filename} - #{$!.message}\"\n end\n\n return cfg\n end",
"def initialize()\n @config_file=\"projects.yml\"\n @config = YAML.load_file(@config_file)\n end",
"def load_config(filename = nil)\n self.config = {\n domain: [],\n sub: []\n }\n return if filename.nil? || filename.empty?\n CSV.foreach(filename, { col_sep: \"\\t\" }) do |row|\n action = row[0] || ''\n action.strip!\n action.downcase!\n # Skip empty lines and comments\n next if action.nil? || action.empty? || action[0] == '#'\n case action\n when '!', 'domain'\n domain = row[1] || ''\n domain.downcase!\n self.config[:domain].push(domain) unless domain.nil? || domain.empty?\n when '$', 'sub'\n regexp = row[1]\n replacement = row[2] || ''\n self.config[:sub].push([Regexp.new(regexp), replacement]) unless regexp.nil? || regexp.empty?\n end\n end\n nil\n end",
"def load_config_file\n \tproject_name = ENV['PROJECT_NAME']\n \tconfig_file_path = \"#{@configs_folder_path}#{project_name}.yaml\"\n\tif !File.exists?(config_file_path)\n log_message(\"No '#{project_name}.yaml' file found in configs directory.\")\n exit\n end\n @config = YAML.load_file(config_file_path)\n end",
"def load(filename)\n\t\t\traise ArgumentError.new unless filename\n\n\t\t\toptions = YAML::load(IO.read(filename))\n\t\t\tif(options)\n\t\t\t\tself.configure(options)\n\t\t\tend\n\t\tend",
"def load(filename)\n @config.load(filename)\n @rules.concat(@config.rules)\n self\n end",
"def load_config( name )\n config = INI.load_file( name )\n config\nend",
"def initialize_config(file_path = nil)\n @config = read_config_file(file_path)\n alias_server_attributes\n\n @https ||= {}\n end",
"def read_configurations(file_name = T.unsafe(nil)); end",
"def read(*args)\n raise ArgumentError.new('No arguments passed to ConfigReader#read') if args.empty?\n\n config = case\n when args.last.end_with?('.json')\n read_json_config(args)\n when args.last.end_with?('.yaml')\n read_yaml_config(args)\n else\n read_json_config(args) || read_yaml_config(args)\n end\n\n raise ArgumentError.new(\"Config file #{File.join(args)} not found\") if config.nil?\n\n config\n end",
"def read!\n file = root + FILENAME\n if file.exist?\n data = YAML.load(File.new(file))\n data.each do |name, value|\n self[name] = value\n end\n end\n return self\n end",
"def configuration_file\n gitpusshuten_root + '/config.rb'\n end",
"def config\n ensure_config_exists\n @config ||= (YAML.load_file(config_file) || {})\n end",
"def read_config config_path = ''\n return nil if config_path.empty?\n return nil unless File.file?(config_path)\n YAML.safe_load(File.read(config_path))\n end",
"def config\n @config ||= read_config\n end",
"def repository(name_or_file)\n DbAgile::Core::Repository::load(repository_path(name_or_file))\n end",
"def read_config_file\n config_path = File.expand_path(File.dirname(__FILE__)+\"/../../\")\n YAML.load_file(\"#{config_path}/config/#{@type}/config.yaml\")\n end",
"def read_config filename # {{{\n\n # Pre-condition check\n raise ArgumentError, \"Filename argument should be of type string, but it is (#{filename.class.to_s})\" unless( filename.is_a?(String) )\n\n # Main\n @log.message :debug, \"Loading this config file: #{filename.to_s}\"\n result = File.open( filename, \"r\" ) { |file| YAML.load( file ) } # return proc which is in this case a hash\n result = hashes_to_ostruct( result ) \n\n # Post-condition check\n raise ArgumentError, \"The function should return an OpenStruct, but instead returns a (#{result.class.to_s})\" unless( result.is_a?( OpenStruct ) )\n\n result\n end",
"def config\n @config ||= OpenStruct.new(YAML.load_file(self.config_path))\n end",
"def fetch\n cfg = {}\n cfg = YAML.load_file(@default) if File.file?(@default)\n\n local = {}\n if File.file?(@local)\n # Check for bad user input in the local config.yml file.\n local = YAML.load_file(@local)\n unless local.is_a?(Hash)\n raise StandardError, \"Wrong format for the config-local file!\"\n end\n end\n\n hsh = strict_merge_with_env(cfg, local)\n add_enabled(hsh)\n end",
"def uri\n conf['uri'] || git_source\n end",
"def get_config\n if ! @config\n if ! File.exists? self.get_config_file\n puts self.get_config_file + ' does not exist - copy lightwaverf-configy.yml from https://github.com/pauly/lightwaverf to your home directory or type \"lightwaverf configure\"'\n self.put_config\n end\n @config = YAML.load_file self.get_config_file\n end\n @config\n end",
"def get_config_file\n\t\t\t@@config_file_data ||= (\n\t\t\t\tconfig_file_name = @config[:file_name] || (RFM_CONFIG[:file_name] rescue nil) || 'rfm.yml'\n\t\t\t\tconfig_file_paths = [''] | (@config[:file_path] || (RFM_CONFIG[:file_path] rescue nil) || %w( config/ ))\n\t\t\t\tconfig_file_paths.collect do |f|\n\t\t\t\t\t(YAML.load_file(\"#{f}#{config_file_name}\") rescue {})\n\t\t\t\tend.inject({}){|h,a| h.merge(a)}\n\t\t\t) || {}\n\t\tend",
"def read_config(config_path = T.unsafe(nil)); end",
"def load_from(path)\n self.configure(Halcyon::Config::File.load(path))\n self\n end",
"def initialize(filename)\n config = nil\n if !filename.nil? && Pathname.new(filename).absolute?\n config = YAML.load_file(filename)\n else\n original_dir = Dir.pwd\n changed_dir = false\n until Dir.pwd == '/'\n # Try looking for filename specified by user.\n # If no filename was specified by the user, then look for\n # deploy.yml or deploy.yaml.\n if !filename.nil? && File.exist?(filename)\n config = YAML.load_file(filename)\n break\n elsif filename.nil? && File.exist?(DEPLOY_YAML)\n filename = DEPLOY_YAML\n config = YAML.load_file(filename)\n break\n end\n\n # KDT should run in the directory containing the deploy config file.\n changed_dir = true\n Dir.chdir('..')\n end\n if config.nil?\n Dir.chdir(original_dir)\n if ! filename.nil?\n raise \"Could not locate file: config file '#{filename}' in any directory\"\n else\n raise \"Could not locate file: config file '#{DEPLOY_YAML}' in any directory\"\n end\n end\n if changed_dir\n Logger.warn \"Changed directory to #{Dir.pwd} (location of #{filename})\"\n end\n end\n @filename = filename\n @original_config = config\n\n version = config.fetch('version', 1)\n check_and_warn(\n config.has_key?('version'),\n 'Expected .version to be specified, but .version is missing. Falling back to version 1 config schema')\n check_and_err([1, 2].include?(version), \"Expected valid version, but received unsupported version '#{version}'\")\n\n case version\n when 2\n fetch_and_parse_version2_config!\n else\n raise \"Unsupported version #{version}\"\n end\n end",
"def gitconfig\n return unless File.exist?('.git/config')\n lines = File.read('.git/config').split(\"\\n\")\n lines = lines.map do |line|\n md = /^\\s*url\\s*=\\s*ssh:\\/\\/git@git.nordstrom.net\\/its\\/(?<reponame>[\\w_]+).git/.match(line)\n line = \" url = git@gitlab.nordstrom.com:chef/cookbooks/#{md[:reponame]}.git\" if md\n line\n end\n File.write('.git/config', lines.join(\"\\n\"))\nend",
"def fetch_config\n Rails.logger.debug \"Loading #{@file}::#{@env}\" if Object.const_defined?('Rails') && Rails.logger.present?\n YAML::load_file(@file)[@env.to_s]\n end",
"def config_read\n f = File.expand_path(CONFIG_FILE)\n if File.readable? f\n load f\n # maybe we should check for these existing else crash will happen.\n #$bookmarks.push(*bookmarks) if bookmarks\n log \"loaded #{CONFIG_FILE} \"\n end\nend",
"def sources_config\n @_sources_config ||= YAML.load_file(Rails.root.join('config/sources_config.yml'))\n end",
"def load_config(filename = nil)\n return if filename.nil? || filename.empty?\n self.config = { domain: [], sub: [] }\n File.foreach(filename) do |line|\n action, params = config_parse(line)\n if action == :domain\n config_domain(*params)\n elsif action == :substitution\n config_substitution(*params)\n end\n end\n end",
"def config\n\t\t\t@config ||= begin\n\t\t\t\tfile = File.join(self.location, \"config.yaml\")\n\t\t\t\tif File.exists?(file)\n\t\t\t\t\tYAML::load_file(file)\n\t\t\t\telse\n\t\t\t\t\t{}\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def parse_from_file\n parsed_opts = YAML.load_file(config_path)\n parsed_opts.delete_if{|k| k.to_s == 'config_path'}\n parsed_opts.each_pair{|k,v| self[k] = v}\n true\n rescue Errno::ENOENT\n false\n end",
"def get_config config_file = \"_config.yml\"\n config_file = File.join(path, config_file)\n yml_data = YAML.load_file(config_file)\n return yml_data\n end",
"def config\n @config ||= YAML::load_file(File.join(@cwd, \"config\", \"settings.yml\"))\n end",
"def url\n SETTINGS[:url] || raise(\"Must provide URL - please edit file\")\nend",
"def url\n SETTINGS[:url] || raise(\"Must provide URL - please edit file\")\nend",
"def url\n SETTINGS[:url] || raise(\"Must provide URL - please edit file\")\nend",
"def config_file\n \"#{confdir}/config.yml\"\n end",
"def read_config(mgr)\n @config = mgr.read_config_file( File.join(cfg_dir, CONFIG_FILE),\n CONFIG_DOMAIN )\n end",
"def read_config_file(file)\n next_config = safe_load_file(file)\n check_config_is_hash!(next_config, file)\n Jekyll.logger.info \"Configuration file:\", file\n next_config\n rescue SystemCallError\n if @default_config_file ||= nil\n Jekyll.logger.warn \"Configuration file:\", \"none\"\n {}\n else\n Jekyll.logger.error \"Fatal:\", \"The configuration file '#{file}'\n could not be found.\"\n raise LoadError, \"The Configuration file '#{file}' could not be found.\"\n end\n end",
"def load_config(file)\n file = file + '.rb' if File.extname(file) == ''\n\n if chdir\n file = File.join(chdir, file)\n else\n file = File.join('.', file)\n end\n\n if File.exist?(file)\n return require(file)\n else\n raise \"config file not found -- `#{file}'\"\n end\n end",
"def initialize(filename = \"#{File.dirname(__FILE__)}/../conf/config.json\")\n if filename.instance_of?(Hash)\n @filename = nil\n @pjson = filename\n else\n @filename = filename\n json = File.read(filename)\n @pjson = JSON.parse(json)\n end\n end",
"def load!(config_file)\n @config = YAML.load(config_file)\n\n # Ensure the Slack URL key is set.\n if @config[APPLICATION_URL_KEY].nil?\n raise Exception.new(\"Ruh roh, you need to define a an application URL using #{APPLICATION_URL_KEY} in your configuration!\")\n end\n\n # Ensure the Slack URL key is set.\n if @config[SLACK_URL_KEY].nil?\n raise Exception.new(\"Ruh roh, you need to define a Slack endpoint using #{SLACK_URL_KEY} in your configuration!\")\n end\n end",
"def config\n @config ||= load_config\n end",
"def config_read\n f = File.expand_path(CONFIG_FILE)\n return unless File.readable? f\n\n hash = loadYML(f)\n @used_dirs = hash['DIRS']\n @visited_files = hash['FILES']\n @bookmarks = hash['BOOKMARKS']\n @used_dirs.concat get_env_paths\nend",
"def read_config_files\n load_config_files\n end",
"def app_config_file(filename)\n File.read(File.dirname(__FILE__)+\"/../../app/config/\" + filename).split(\"\\n\")\nend",
"def load_config()\n @config = get_xml(@xml_api_config_path)\n @config_doc = REXML::Document.new(@config)\n\n @config_doc = REXML::Document.new(@config)\n if !@config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].nil?\n @repository_url = @config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].text || \"\"\n end\n @repository_urls = []\n if !@config_doc.elements[\"/project/scm/locations\"].nil?\n @config_doc.elements.each(\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation\") { |e| @repository_urls << e.elements[\"remote\"].text }\n end\n if !@config_doc.elements[\"/project/scm/browser/location\"].nil?\n @repository_browser_location = @config_doc.elements[\"/project/scm/browser/location\"].text\n end\n if !@config_doc.elements[\"/project/description\"].nil?\n @description = @config_doc.elements[\"/project/description\"].text || \"\"\n end\n end",
"def load_config\n cfg = File.open(CONFIG) { |yf| YAML::load( yf ) } if File.exists?(CONFIG)\n # => Ensure loaded data is a hash. ie: YAML load was OK\n if cfg.class != Hash\n raise \"ERROR: Configuration - invalid format or parsing error.\"\n else\n if cfg['login'].nil?\n raise \"ERROR: Configuration: login not defined.\"\n end\n end\n\n return cfg\nend"
] |
[
"0.67986375",
"0.66661227",
"0.64985013",
"0.6364298",
"0.63393503",
"0.6318858",
"0.6314006",
"0.628132",
"0.62802494",
"0.62562203",
"0.62440175",
"0.62334657",
"0.62129724",
"0.62113583",
"0.62111723",
"0.62046295",
"0.6188979",
"0.61832756",
"0.61553156",
"0.6140488",
"0.6133129",
"0.6127241",
"0.6126202",
"0.61161935",
"0.61080456",
"0.6059944",
"0.60588545",
"0.60529",
"0.60394037",
"0.6031703",
"0.60257095",
"0.6025603",
"0.60245913",
"0.6022498",
"0.60184646",
"0.60168684",
"0.600359",
"0.6003555",
"0.59805864",
"0.5973058",
"0.59712344",
"0.5964338",
"0.5952536",
"0.59521234",
"0.594947",
"0.5929265",
"0.59263086",
"0.5922272",
"0.59198505",
"0.5898566",
"0.5894444",
"0.58937037",
"0.58761257",
"0.58745426",
"0.5871674",
"0.5869788",
"0.58618236",
"0.58543557",
"0.58518314",
"0.5828618",
"0.5819005",
"0.58126634",
"0.58111745",
"0.5808597",
"0.57994974",
"0.5799058",
"0.5798199",
"0.57930213",
"0.57875335",
"0.5786524",
"0.57856387",
"0.5773478",
"0.5761848",
"0.57592726",
"0.5758915",
"0.5758584",
"0.5757114",
"0.5755566",
"0.57468224",
"0.574395",
"0.5742945",
"0.57342875",
"0.57205653",
"0.5717905",
"0.5717772",
"0.5716516",
"0.5716516",
"0.5716516",
"0.5700314",
"0.5698269",
"0.56963605",
"0.5691898",
"0.56854165",
"0.5683642",
"0.5683136",
"0.56764084",
"0.56752986",
"0.5675078",
"0.56700695",
"0.56586784"
] |
0.7685288
|
0
|
returns data and repos. filename is helpful only for debugging.
|
def read_config_data(data, filename=nil)
ConfigReader.new.read(data, filename)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def data\n @data ||= file? ?\n repos.file(fs_path, revision) :\n repos.dir(fs_path, revision)\n end",
"def data\n @repo_data\n end",
"def data\n data = @repo.working_read(@path) rescue nil\n data\n end",
"def list_files repos\n raise \"required repository name\" unless repos\n res = HTTPClient.get_content(\"https://github.com/#{repos}/downloads\", {\n \"login\" => @login,\n \"token\" => @token\n })\n Nokogiri::HTML(res).xpath('id(\"manual_downloads\")/li').map do |fileinfo|\n obj = {\n :description => fileinfo.at_xpath('descendant::h4').text.force_encoding('BINARY').gsub(/.+?\\xe2\\x80\\x94 (.+?)(\\n\\s*)?$/m, '\\1'),\n :date => fileinfo.at_xpath('descendant::p/time').attribute('title').text,\n :size => fileinfo.at_xpath('descendant::p/strong').text,\n :id => /\\d+$/.match(fileinfo.at_xpath('a').attribute('href').text)[0]\n }\n anchor = fileinfo.at_xpath('descendant::h4/a')\n obj[:link] = anchor.attribute('href').text\n obj[:name] = anchor.text\n obj\n end\n end",
"def get_repositories\n get(\"#{url_base}/repositories?#{dc}\")[\"data\"]\n end",
"def data\n @data ||= RJGit::Porcelain.cat_file(@jrepo, @jblob) \n end",
"def get_contents\n raise \"can't get a repo without the repo's full_name (eg. 'fubar/ofxTrickyTrick')\" unless full_name\n\n begin\n response = GithubApi::repository_contents(full_name: full_name)\n rescue => ex\n Rails.logger.debug \"Failed to get repository contents: #{ex.message} (#{ex.class})\"\n return\n end\n\n unless response.success?\n Rails.logger.debug response.inspect.to_s.red\n return\n\tend\n\n @repo_contents_json = response.parsed_response\n end",
"def repos\n api.repos.map(&:to_hash)\n end",
"def raw_data_in_committer(committer, dir, filename)\n data = nil\n\n [*dir.split(::File::SEPARATOR), filename].each do |key|\n data = data ? data[key] : committer.tree[key]\n break unless data\n end\n\n data\n end",
"def repositories\n # TODO : merge with current data\n load_repos\n end",
"def find_repos( datasets )\n repos = []\n datasets.each do |dataset|\n league_key = dataset[0]\n league = Writer::LEAGUES[ league_key ]\n pp league\n path = league[:path]\n\n ## use only first part e.g. europe/belgium => europe\n repos << path.split( %r{[/\\\\]})[0]\n end\n pp repos\n repos.uniq ## note: remove duplicates (e.g. europe or world or such)\nend",
"def read_repository_info\n repository_url = File.open(@repository_conf).gets.chomp\n name = repository_url.split(\"/\").last.split(\".\").first\n return {\n :url => repository_url,\n :name => name,\n :container_prefix => container_prefix(name),\n :path => \"#{@work_dir}/#{name}\",\n }.freeze\n end",
"def list\n @repos\n end",
"def repos_file\n File.join(folder, REPOS_FILE_NAME)\n end",
"def get_repos\n\t\trepo_list = []\n\t\tparsed_config = begin\n\t\t\tYAML.load(File.open(@path_to_config_yml))\n\t\trescue ArgumentError => e\n \t\t\tputs \"Could not parse YAML: #{e.message}\"\n\t\tend\n\t\tparsed_config['sections'].each do |section|\n\t\t\trepo_list.push(section['repository']['name'].gsub(/\\w*-?\\w*\\//,''))\n\t\tend\n\t\trepo_list.sort\n\tend",
"def get_data\n @training_bad, @testing_bad = extract_commits('data/bad_commits/')\n @training_good, @testing_good = extract_commits('data/good_commits/')\n end",
"def repo_commits(repos)\n repos_commits = []\n repos.each do |repo|\n repos_commits << HTTParty.get(repo[\"commits_url\"].gsub(\"{/sha}\", \"\"))[0]\n end\n repos_commits\nend",
"def generate_repository_data_from_Puppetfile\n repositories = []\n\n # Open the Puppetfile\n File.open(@options[:puppetfile], 'r') do |fh|\n while (line = fh.gets) != nil\n # Skip blank lines, comments, anything that looks like a forge module\n next if line =~ Skipall_Regex\n next if Module_Regex.match(line)\n # When we see /mod 'modulename',/ it is possibly a properly formatted fixture\n if Repository_Regex.match(line)\n complete = false\n name = Regexp.last_match(1)\n while (line = fh.gets) != nil\n next if line =~ Skipall_Regex\n if Location_Only_Regex.match(line)\n # The Puppetfile may specify just a location /:git => 'https://github.com/author/puppet-modulename'/\n # We do not validate the URI protocol, just that it is a valid URI\n location = Regexp.last_match(1)\n puts \"Found module #{name} with location #{location}\" if @options[:debug]\n unless location.match(URI.regexp)\n puts \"#{location} is not a valid URI, skipping this repo\" if @options[:debug]\n break\n end\n repositories << {name: name, location: location}\n complete = true\n elsif Location_Plus_Regex.match(line)\n # Or it may provide more, with a trailing comma\n # :git => 'https://github.com/author/puppet-modulename',\n # :ref => '1.0.0'\n location = Regexp.last_match(1)\n while (line = fh.gets) != nil\n next if line =~ Skipall_Regex\n if Type_ID_Regex.match(line)\n type = Regexp.last_match(1)\n id = Regexp.last_match(2)\n puts \"Found module #{name} with location #{location}, #{type} of #{id}\" if @options[:debug]\n unless location.match(URI.regexp)\n puts \"#{location} is not a valid URI, skipping this repo\" if @options[:debug]\n break\n end\n repositories << {name: name, location: location, type: type, id: id}\n complete = true\n else\n # If the :git line ends with a comma but no type/ID is found, ignore it, we cannot properly determine the fixture\n puts \"Found module #{name} at location #{location}. Expected type/ID information but did not find any, skipping.\" if @options[:debug]\n complete = true\n end\n break if complete\n end\n else\n # If the /mod 'modulename',/ line is not followed with a :git string, ignore it, we cannot properly determine the fixture\n puts \"Found a reference to module #{name} but no location (:git) was provided, skipping.\" if @options[:debug]\n complete = true\n end\n break if complete\n end\n end\n end\n end\n\n repositories\n end",
"def data_path(filename)\n File.join(File.dirname(__FILE__), 'repo', filename)\n end",
"def repositories\n octokit.repositories('zold-io').map { |json| json['full_name'] }\n end",
"def list_repositories(file)\n repository_text = file.read\n int, varchar, function = self.int, self.varchar, self.function\n fields = [int, varchar, varchar, function, function]\n record_re = /#{'\\\\((' + fields.join( '),(' ) + ')\\\\)'}/\n results = []\n repository_text.scan(record_re) do |id_match, abbreviation_match, short_description_match, created_at_match, updated_at_match|\n id = Integer(id_match)\n abbreviation = abbreviation_match[1..-2]\n short_description = short_description_match[1..-2]\n created_at = created_at_match\n updated_at = updated_at_match\n #puts id_match, abbreviation_match, short_description_match, created_at_match, updated_at_match\n results << [id, abbreviation, short_description, created_at, updated_at]\n end\n results\n end",
"def get_list\n @list_of_repos\n end",
"def get_repo_content(type, username, repo_name) # :yields: String\n case type\n\n when Api_options::REPO::LANGUAGES\n \"#{BASE_URL}\" + \"#{REPOS}\" + \"#{username}/\" + \"#{repo_name}/languages\"\n when Api_options::REPO::CONTRIBUTORS\n BASE_URL + REPOS + \"#{username}\" + \"/\" + \"#{repo_name}\" + \"/\" + \"contributors\"\n when Api_options::REPO::README\n BASE_URL + REPOS + \"#{username}\" + \"/\" + \"#{repo_name}\" + \"/\" + \"readme\"\n end\n end",
"def get_repos\n # using oauth token to increase limit of request to github api to 5000\n client = Octokit::Client.new :access_token => self.github_token\n (client.repositories self.github_name, {:type => 'all'}).map do |repo|\n repo.full_name\n end\n end",
"def get_repo_names github_username , git_token\n\n Rails.cache.fetch(\"#{self.id}/repo_names\", expires_in: 6.hours) do\n repo_names = Array.new\n github = Github.new :oauth_token => git_token\n\n github.repos.list.body.each do |repo|\n if github_username == repo[\"owner\"][\"login\"]\n repo_names << { :user=>github_username ,:repo=>repo[\"name\"]}\n end\n end\n\n orgs_names = Array.new\n github.orgs.list.each do |org|\n orgs_names << org[\"login\"]\n end\n\n orgs_names.each do |oname|\n url = \"orgs/\"+oname+\"/repos\"\n \n github.get_request(url,Github::ParamsHash.new({})).each do |orepo|\n if oname == orepo[\"owner\"][\"login\"]\n repo_names << { :user=>oname ,:repo=>orepo[\"name\"]}\n end\n end\n end\n repo_names\n end\n end",
"def fetch_git_commiter_details_from_file\n creds = {}\n contents = \"\"\n if File.exists?(@vagrant_git_commiter_details)\n File.open(@vagrant_git_commiter_details, 'r') do |f|\n while line = f.gets\n contents += line\n end\n end\n end\n if !contents.empty?\n creds = JSON.parse contents\n end\n return creds\n end",
"def get_repos\n\t\t@repos = Repo.all\n\tend",
"def get_repo_info path=\".\", shell=nil\n defaults = {:type => @scm, :url => @url, :path => path}\n\n defaults.merge self.class.get_info(path, shell)\n end",
"def repository_data(user)\n Travis::RemoteVCS::Repository.new.show(\n repository_id: repository.id,\n admin_id: user.id\n )\n end",
"def acquire_repo_list\n set_auth\n set_github_repo_name\n repo_list = []\n (@github.repos.list org: GITHUB_ORG).each do |l|\n repo_list << l[:name]\n end\n repo_list\nend",
"def ExtractInfoFromFileContents file_contents\ndata = file_contents.split('|')\n# Remove the first line\n# Remove the project_name from data\n# Remove the line below project_name\ndata = data.drop(3)\n\n# Now, everything is in 3-tuple <key, value, \"\\n\">\ndata.shift\nproject_name = data.first\nproject_name = project_name.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nrepo_url = data.first\nrepo_url = repo_url.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nhead_sha = data.first\nhead_sha = head_sha.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nnum_commits = data.first\nnum_commits = num_commits.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nnum_merges = data.first\nnum_merges = num_merges.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nreverts_msg = data.first\nreverts_msg = reverts_msg.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nreverts_complete = data.first\nreverts_complete = reverts_complete.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\nreverts_partial = data.first\nreverts_partial = reverts_partial.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\ncps_complete = data.first\ncps_complete = cps_complete.gsub(/\\s+/, \"\")\ndata = data.drop(3)\n\ncps_partial = data.first\ncps_partial = cps_partial.gsub(/\\s+/, \"\")\ndata = data.drop(2)\n\nproject_name_repo_url_head_sha_combined = project_name + \"\\n\" + repo_url + \"\\n\" + head_sha\nreturn [project_name_repo_url_head_sha_combined, num_commits, num_merges, reverts_msg, reverts_complete, reverts_partial, cps_complete, cps_partial]\n\nend",
"def get_my_repos\n repos = []\n\n (1..get_total_repo_pages_count.to_i).each do |index|\n get_json( \"#{ GITHUB_USER_REPOS_URL }?per_page=100&page=#{ index }\" ).each do |item|\n repos << item[ 'full_name' ]\n end\n end\n\n return repos\nend",
"def get_repos\n begin\n @repos ||= github_api_setup.repos.list\n rescue Exception => e\n logger.error \"Github #get_repos error #{e}\"\n end\n end",
"def repo; end",
"def repo; end",
"def repo; end",
"def repo; end",
"def repos\n @repos ||= get(\"/repos/show/#{login}\")['repositories'].map { |r| Repo.new(connection, r) }\n end",
"def request_repo_data\n self.class.get(\"/#{@repo}\", headers: {\n 'Authorization' => \"token #{@token}\",\n 'User-Agent' => 'stefanrush/weightof.it'\n })\n end",
"def find_repositories\n @repos = GithubApi.call :repos\n end",
"def repositories\n response = self.class.get('/repositories').body\n JSON.parse(response)\n end",
"def repos\n @repos ||= OY.repos\n end",
"def repos\n client.repos({}, query: { sort: \"asc\" })\n end",
"def get_repo(repo_id)\n response=client.extensions.repository.retrieve_with_details(repo_id)\n code=response.code\n body=response.body\n case code\n when 200\n repo=JSON.parse(body.to_json)\n type = repo[\"notes\"][\"_repo-type\"]\n #puts repos\n repo_data=nil\n case type\n when REPO_TYPE_RPM\n yum_distributor = repo[\"distributors\"].select{ |d| d[\"distributor_type_id\"] == 'yum_distributor'}[0]\n yum_importer = repo[\"distributors\"].select{ |d| d[\"distributor_type_id\"] == 'yum_importer'}[0]\n distributor = nil\n if yum_distributor\n distributor = {\n :auto_publish => yum_distributor[\"auto_publish\"],\n :last_publish => yum_distributor[\"last_publish\"],\n :config => yum_distributor[\"config\"]\n }\n end\n importer = nil\n if yum_importer\n importer = {\n :last_sync => yum_importer[\"last_sync\"],\n :config => yum_importer[\"config\"]\n }\n end\n\n repo_data={\n :id => repo[\"id\"],\n :name => repo[\"display_name\"],\n :description => repo[\"description\"],\n :content_unit_counts => repo[\"content_unit_counts\"],\n :type => REPO_TYPE_RPM,\n :last_unit_removed => repo[\"last_unit_removed\"],\n :last_unit_added => repo[\"last_unit_added\"],\n :distributor => distributor,\n :importer => importer,\n }\n #puts repos\n when REPO_TYPE_PUPPET\n puppet_distributor = repo[\"distributors\"].select{ |d| d[\"distributor_type_id\"] == 'puppet_distributor'}[0]\n distributor =nil\n if puppet_distributor\n distributor = {\n :auto_publish => puppet_distributor[\"auto_publish\"],\n :last_publish => puppet_distributor[\"last_publish\"],\n :config => puppet_distributor[\"config\"]\n }\n end\n repo_data={\n :id => repo[\"id\"],\n :name => repo[\"display_name\"],\n :description => repo[\"description\"],\n :content_unit_counts => repo[\"content_unit_counts\"],\n :type => REPO_TYPE_PUPPET,\n :last_unit_removed => repo[\"last_unit_removed\"],\n :last_unit_added => repo[\"last_unit_added\"],\n :distributor => distributor\n }\n else\n end\n repo_data\n else\n raise \"Exception: cannot get repository detail: response code :#{code}\"\n end\n end",
"def export_stored_repository_data\n current_export.output_logger.info \"Exporting pull requests...\"\n pull_requests.sort_by(&:created_date).each(&:export)\n end",
"def commit_info(params)\n user, repo = params[\"user\"], params[\"repo\"]\n shas = get_last_30_days_commits(user, repo)\n commit_hash = {}\n file_arr = []\n hydra = Typhoeus::Hydra.new\n shas.each do |sha|\n request = Typhoeus::Request.new(\"#{GithubApiConstants::GITHUB_ROOT}/repos/#{user}/#{repo}/commits/#{sha}?access_token=#{GITHUB_ACCESS_TOKEN}\")\n request.on_complete do |response|\n if response.success?\n parsed_sha_info = JSON.parse(response.response_body)\n author = parsed_sha_info[\"commit\"][\"author\"][\"name\"]\n files = parsed_sha_info[\"files\"].collect { |f| f[\"filename\"] }\n commit_hash[files] = author\n file_arr << files\n else\n raise RepoExceptionHandler::GithubAPILimitReached.new(GithubApiConstants::GITHUB_API_LIMIT_REACHED_MESSAGE)\n end\n end\n hydra.queue(request)\n end\n hydra.run\n return commit_hash, file_arr\n end",
"def load_details\n @commits = Package.new.git_commits\n @packages = Package.latest_first \n @package = Package.new\n end",
"def load_repos\n MultiJson.decode(File.new(repos_file, 'r').read)\n end",
"def repo\n @repo\n end",
"def getRepositoryFile\n return @REPOSITORYFILEORFIELD\n end",
"def fetch_github_data\n self.info = GithubInfoFetcher.new.call(github_path).to_h\n end",
"def loadRepository\n\n @DIR_NAME = @REPOSITORYPATHORSELECT\n\n #puts \"#{@DIR_NAME} Index is... #{@DIR_NAME.index(\"/\")} : #{@@FS}\"\n\n \t\tif (@DIR_NAME.index(\"/\") != nil && @@FS == \"\\\\\" )\n \t\t\t@DIR_NAME = Parser.replaceAll(@DIR_NAME,\"/\",@@FS)\n \t\telsif( @DIR_NAME.index(\"\\\\\") != nil && @@FS == \"/\")\n \t\t\t@DIR_NAME = Parser.replaceAll(@DIR_NAME,\"\\\\\",@@FS)\n end\n\n #puts \"1 dirname... #{@DIR_NAME}\"\n\n @DIR_NAME = @DIR_NAME[0..@DIR_NAME.rindex(@@FS)]\n #puts \"2 dirname... #{@DIR_NAME}\"\n \t\t@FILE_NAME = @REPOSITORYPATHORSELECT\n #puts \"1 filename... #{@FILE_NAME}\"\n \t\tif( @FILE_NAME.index(\"/\") != nil && @@FS == \"\\\\\")\n \t\t\t@FILE_NAME = Parser.replaceAll(@FILE_NAME,\"/\",@@FS)\n \t\telsif( @FILE_NAME.index(\"\\\\\") != nil && @@FS == \"/\")\n \t\t\t@FILE_NAME = Parser.replaceAll(@FILE_NAME,\"\\\\\",@@FS)\n end\n #puts \"2 filename... #{@FILE_NAME}\"\n @FILE_NAME = @FILE_NAME[@FILE_NAME.rindex(@@FS)+1,@FILE_NAME.size]\n #puts \"3 filename... #{@FILE_NAME}\"\n\n #puts \"loadRepository : #{@DIR_NAME}\"\n if !File.exist?(@DIR_NAME)\n FileUtils.mkdir_p(@DIR_NAME)\n end\n if File.exist?(@DIR_NAME+@FILE_NAME)\n loadeOb = File.open(@DIR_NAME+@FILE_NAME).read\n @REPOSITORY = YAML::load(loadeOb)\n else\n @REPOSITORY = Hash.new\n end\n return @REPOSITORY\n end",
"def get_repos project_id\n $logger.info \"Getting repos\"\n\n # from the bitbucket api\n rest_endpoint = \"/rest/api/1.0/projects/#{PROJECT_ID}/repos\"\n\n http = Net::HTTP.new(BASE_GIT_URL, BASE_GIT_PORT)\n repos_request = Net::HTTP::Get.new(\"/rest/api/1.0/projects/#{PROJECT_ID}/repos?limit=1000\")\n repos_request.basic_auth GIT_USER, GIT_PASSWORD\n repos_response = http.request(repos_request)\n repos_response.value\n\n # https://confluence.atlassian.com/bitbucket/what-is-a-slug-224395839.html\n repos_body = JSON.parse(repos_response.body)\n repos = repos_body['values'].map { |v| v['slug'] }\n\n $logger.info \"Found repos #{repos}\"\n\n return repos\nend",
"def repos\n pry(Git::Multi.repositories)\nend",
"def travis_repos\n x = $travis_conn.get 'owner/ropenscibot/repos'\n x.travis_raise\n return MultiJson.load(x.body)\nend",
"def codeowners_data(opts = {})\n if opts[:codeowner_data]\n return opts[:codeowner_data]\n elsif opts[:codeowner_path]\n return File.read(opts[:codeowner_path]) if File.exist?(opts[:codeowner_path])\n elsif opts[:no_git]\n path = Dir.pwd.split(File::SEPARATOR)\n while !path.empty?\n POTENTIAL_LOCATIONS.each do |pl|\n current_file_path = File.join(path, pl)\n return File.read(current_file_path) if File.exist?(current_file_path)\n end\n path.pop\n end\n else\n path = current_repo_path\n POTENTIAL_LOCATIONS.each do |pl|\n current_file_path = File.join(path, pl)\n return File.read(current_file_path) if File.exist?(current_file_path)\n end\n end\n raise(\"[ERROR] CODEOWNERS file does not exist.\")\n end",
"def get_file(filename, branch_or_tag='master') \n\t\tlog = repo.log(branch_or_tag, filename) \n\t\treturn log.first.tree.contents.first.data\n\tend",
"def altered_files; `git show --name-only #{node} 2> /dev/null`.split(\"\\n\"); end",
"def repo_info\n # Extract user and project name from GitHub URL.\n url = git_config['remote.origin.url']\n if url.nil?\n puts \"Error: Not a git repository.\"\n return [nil, nil]\n end\n user, project = github_user_and_project(url)\n # If there are no results yet, look for 'insteadof' substitutions in URL and try again.\n unless user && project\n short, base = github_insteadof_matching(config_hash, url)\n if short and base\n url = url.sub(short, base)\n user, project = github_user_and_project(url)\n end\n end\n [user, project]\n end",
"def repo_name\n if @vcs == 'gitlab'\n @data['project']['name']\n elsif @vcs == 'tfs'\n @data['resource']['repository']['name']\n else\n @data['repository']['name']\n end\n end",
"def project_file\n if fetcher && fetcher.is_a?(NetFetcher)\n log.deprecated(log_key) do\n \"project_file (DSL). This is a property of the NetFetcher and will \" \\\n \"not be publically exposed in the next major release. In general, \" \\\n \"you should not be using this method in your software definitions \" \\\n \"as it is an internal implementation detail of the NetFetcher. If \" \\\n \"you disagree with this statement, you should open an issue on the \" \\\n \"Omnibus repository on GitHub an explain your use case. For now, \" \\\n \"I will return the path to the downloaded file on disk, but please \" \\\n \"rethink the problem you are trying to solve :).\"\n end\n\n fetcher.downloaded_file\n else\n log.warn(log_key) do\n \"Cannot retrieve a `project_file' for software `#{name}'. This \" \\\n \"attribute is actually an internal representation that is unique \" \\\n \"to the NetFetcher class and requires the use of a `source' \" \\\n \"attribute that is declared using a `:url' key. For backwards-\" \\\n \"compatability, I will return `nil', but this is most likely not \" \\\n \"your desired behavior.\"\n end\n\n nil\n end\n end",
"def get_git_info(root_dir)\n Dir.chdir(root_dir) do\n info = {\n :head => {\n :id => `\"#{@options[:git]}\" show --format='%H' --no-patch`.rstrip,\n :author_name => `\"#{@options[:git]}\" show --format='%an' --no-patch`.rstrip,\n :author_email => `\"#{@options[:git]}\" show --format='%ae' --no-patch`.rstrip,\n :commiter_name => `\"#{@options[:git]}\" show --format='%cn' --no-patch`.rstrip,\n :commiter_email => `\"#{@options[:git]}\" show --format='%ce' --no-patch`.rstrip,\n :message => `\"#{@options[:git]}\" show --format='%B' --no-patch`.rstrip,\n },\n :branch => `\"#{@options[:git]}\" rev-parse --abbrev-ref HEAD`.rstrip,\n :remotes => []\n }\n\n `\"#{@options[:git]}\" remote --verbose`.each_line do |line|\n line.match(/^(?<name>\\S+)\\s+(?<url>\\S+)(\\s+\\((fetch|push)\\))?/) do |match|\n info[:remotes] << Hash[match.names.zip(match.captures)]\n end\n end\n info[:remotes].uniq!\n info.delete(:remotes) if info[:remotes].empty?\n\n info\n end if Dir.exist?(root_dir)\n end",
"def repos_languages_data(git_user)\n allRepos = []\n github = Github.new oauth_token: current_employee.github_account.oauth_token\n myRepos = github.repos.list user: git_user\n myRepos.each do |repo|\n repo_languages = github.repos.languages git_user, repo.name\n repoHash = repo_languages.to_hash\n repoHash[\"name\"] = repo.name\n repoHash[\"created_at\"] = repo.created_at\n repoHash[\"updated_at\"] = repo.updated_at\n allRepos.push(repoHash.symbolize_keys!)\n end\n allRepos\n end",
"def path\n \"repos/#{@user}/#{name}\"\n end",
"def get_repo_details\n user = User.find_by(uuid: params[:uuid])\n client = Octokit::Client.new(:access_token => user.password)\n repo_map = {}\n client.repository(:user => user.gh_username, :repo => params[:repo_name]).each { |detail|\n repo_map[detail[0]] = detail[1]\n }\n repo_map['languages'] = client.languages(:user => user.gh_username, :repo => params[:repo_name]).map{ |langArray|\n langArray[0]\n }\n render :json => repo_map\n end",
"def repos(show_commits = false)\n response = @github.repos.list(user: 'siakaramalegos', sort: 'updated', direction: 'desc', page: 1, per_page: 10)\n repos = response.body\n\n repos.each_with_index do |repo, index|\n puts '-' * 80\n date_string = repo.updated_at\n date = DateTime.parse(date_string).to_date\n puts \"(#{index + 1}) #{repo.name}: #{repo.description} (updated: #{date.stamp('12/30/99')})\"\n\n if show_commits\n repo_commits = @github.repos.commits.list('siakaramalegos', repo.name, page: 1, per_page: 10).body\n\n repo_commits.each do |c|\n date_string = c.commit.author.date\n date = DateTime.parse(date_string).to_date\n puts \" #{c.commit.message} (#{date.stamp('12/30/99')})\"\n end\n end\n end\n puts '-' * 80\n repos\n end",
"def files\n return unless git_repo?\n output = Licensed::Shell.execute(\"git\", \"ls-files\", \"--full-name\", \"--recurse-submodules\")\n output.lines.map(&:strip)\n end",
"def get_gh_file_content(filename)\n uri = \"https://raw.githubusercontent.com/fastruby/rails-template/main/config_files/#{filename}\"\n Net::HTTP.get(URI(uri))\nend",
"def get_public_repos(user_name)\n get(\"/users/#{user_name}/repos\")\n end",
"def get_remotes()\n to_return = {}\n count = 1\n num_dirs = Dir.glob('./*/').size() -2 # exclude . and ..\n Dir.glob('./*/').each() do |dir|\n next if dir == '.' or dir == '..'\n\n print \"Processing directories...#{count}/#{num_dirs}\\r\" if !$verbose\n count += 1\n\n if(File.directory?(dir) and File.exists?(dir + '/.git'))\n Dir.chdir dir\n remotes = `git remote -v`.split(\"\\n\")\n\n vprint(dir.ljust(25))\n remotes.each() do |remote|\n if(remote.index('(fetch)'))\n parts = remote.split(\"\\t\")\n\n remote_name = get_remote_name(parts[1])\n vprint(\"[#{parts[0]} #{remote_name}]\".ljust(20))\n if(remote_name != nil)\n index = parts[0] + ' - ' + remote_name\n if(to_return[index] == nil)\n to_return[index] = Array.new()\n end\n to_return[index].push(dir)\n else\n puts \"\\nDon't know what to do with #{remote} in dir #{dir}\"\n end\n end\n end # end remotes loop\n\n vprint \"\\n\"\n Dir.chdir '..'\n end # end if file.directory\n end\n\n print \"\\n\"\n return to_return\nend",
"def file_log\n @repo.file_log repo_path\n end",
"def find_repos(user)\n user.repos\n end",
"def show\n user= params[:user]\n repo= params[:repo]\n puts user\n puts repo\n url = BASE_URL + \"repos/\" + user + \"/\" + repo + \"/collaborators\"+ \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n # url = BASE_URL + \"repos/rails/rails/collaborators\"\n # url = BASE_URL + \"repositories\"\n @repo = JSON.parse(open(url).read)\n @results = []\n\n\n @repo.each do |doc|\n ids = doc['login']\n url_people = BASE_URL + \"users/\" + ids + \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n @results << JSON.parse(open(url_people).read)\n end\n\n end",
"def parse_git_repo\n git_output = `git status --porcelain 2>&1`\n unless $?.exitstatus == 0\n puts \"Git error: make sure the current directory is a valid repo and that git is working.\"\n exit!\n end\n list = git_output.split(\"\\n\")\n # Get just what was added, modified, copied or moved.\n # Skip deleted files.\n files = list.reduce([]) do |a, f|\n file = /[\\?MARC ]{1,2} (.*\\.pp)/.match f\n a << file[1] if file\n a\n end\n files.uniq! # remove dupes, just in case.\n files.each { |f| PuppetFile.new(File.expand_path(f)) }\nend",
"def repos\n @client.repos.all.collect(&:clone_url)\n end",
"def files\n { 'branches_without_pulls.md' => { content: report } }\n end",
"def repo_dir; end",
"def getChangesOfCommit(commit_id = false)\n my_commit = ((commit_id == false and @repo.commits.size > 0) ? @repo.commits.first : @repo.commit(commit_id))\n if my_commit == nil\n return false\n end\n \n # get list of changed files and parse it\n @filelist = Hash.new\n options = {:r => true, :name_status => true, :no_commit_id => true}\n if @repo.commit(my_commit.sha).parents[0] == nil # if my_commit is the first commit\n options[:root] = true\n end\n changed_files_list = @git.diff_tree(options, my_commit.id).strip\n if changed_files_list.class == String and changed_files_list.length > 0\n changed_files_list.split(\"\\n\").each do |f|\n commit = my_commit\n operation = f[0,1] # D/M/A\n filepath = f[2..-1] # path+filename\n path = \"/\" + filepath.match(/^.+\\//).to_s # just path\n status = \"created\"\n if operation =~ /^D$/i # deleted\n # the file was deleted, so get the blob from the parent-commit\n commit = @repo.commit(my_commit.parents[0].sha)\n status = \"deleted\"\n elsif operation =~ /^M$/i # modified\n status = \"updated\"\n end\n blob = commit.tree/(filepath)\n\n #name = filepath.gsub(path[1..-1], '') #blob.name\n path = path.gsub(/\\/private\\/[0-9]+\\//,'')\n \n \n \n @filelist[\"/\" + filepath] = {\"uploaded\" => '1', \"status\" => status, \"blob_hash\" => blob.id, \"name\" => blob.name, \"path\" => \"/#{path}\", \"size\" => blob.size, \"filetype\" => blob.mime_type, \"filedate\" => @repo.commit(commit.sha).date.strftime('%T %F').to_s}\n \n \n end\n end\n\n if @filelist.size > 0\n return @filelist\n else\n return false\n end\n end",
"def get_repo\n raise \"can't get a repo without the repo's full_name (eg. 'fubar/ofxTrickyTrick')\" unless full_name\n\n begin\n response = GithubApi::repository(full_name: full_name)\n rescue => ex\n Rails.logger.debug \"Failed to get repository: #{ex.message} (#{ex.class})\"\n return\n end\n\n unless response.success?\n Rails.logger.debug response.inspect.to_s.red\n return\n\tend\n\n @repo_json = response.parsed_response\n end",
"def get_my_pull_requests\n repos_to_get = GITHUB_REPOS.kind_of?( Array ) ? GITHUB_REPOS : get_my_repos\n\n repos_to_get.each do |repo|\n status = []\n pulls_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/pulls?state=open\"\n\n get_json( pulls_url ).each_with_index do |item, index|\n sha = item[ 'head' ][ 'sha' ]\n status_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/commits/#{ sha }/status\"\n\n status << get_json( status_url )\n\n unless item[ 'assignee' ].nil?\n if item[ 'assignee' ][ 'login' ] == ENV[ 'GITHUB_USERNAME' ]\n color = ''\n state = status[ index ][ 'state' ]\n\n unless status[ index ][ 'statuses' ].empty?\n color = \"| color=#{ determine_status_color( state )}\"\n end\n\n puts \"#{ repo }: ##{ item[ 'number' ] } #{ item[ 'title' ] } #{ color } | href=#{ item[ 'html_url' ] }\"\n end\n end\n end\n end\nend",
"def files\n [@nuspec_file, @changelog_file, @readme_file]\n end",
"def files\n [@nuspec_file, @changelog_file, @readme_file]\n end",
"def get_readme_of_a_repository(username,repo_name) # :yields: JSON\n uri=URI.parse(@@uri_builder.get_repo_content(Api_options::REPO::README,username,repo_name))\n http=HttpHandler.initiate_http(uri)\n begin\n response=HttpHandler.get_response(http,uri)\n rescue ArgumentError\n puts \"Request failed with code: #{response.code}\"\n else\n @@responseStatus=true\n return response\n end\n end",
"def all\n return @raw_repos unless @raw_repos.empty?\n return [Template.root.basename.to_s] if Template.project?\n Template.root.join(Meta.new({}).repos_dir).children.map do |path|\n path.basename.to_s\n end\n\n rescue Errno::ENOENT\n then raise(\n Error::RepoNotFound\n )\n end",
"def get_repos\n\t\tif current_user.nil?\n\t\t\t@repos = Repo.where(:user_id => nil)\n\t\telse\n\t\t\t@repos = current_user.repos\n\t\tend\n\tend",
"def get_commits\n raise \"can't get a repo without the repo's full_name (eg. 'fubar/ofxTrickyTrick')\" unless full_name\n\n begin\n response = GithubApi::repository_commits(full_name: full_name)\n rescue => ex\n Rails.logger.debug \"Failed to get recent commit: #{ex.message} (#{ex.class})\"\n return\n end\n\n unless response.success?\n Rails.logger.debug response.inspect.to_s.red\n return\n\tend\n\n @repo_commits_json = response.parsed_response\n end",
"def list_repositories\n JSON.parse(request(:get, ''))\n end",
"def repos\n @repos ||= (user_repos + org_repos).flatten\n end",
"def repos_path\n ::File.expand_path(@repos_path)\n end",
"def get_sha_and_contents\n repo_req = @api.get do |req|\n req.headers['User-Agent'] = \"#{@user_agent}\"\n req.headers['Authorization'] = \"token #{@current_user.github_token}\"\n end\n\n repo_contents = JSON.parse(repo_req.body)['content']\n repo_sha = JSON.parse(repo_req.body)['sha']\n return { sha: repo_sha, content: repo_contents } \n end",
"def get_repos_by_orga(orga) \n\t\treturn self.fetch(\"repos?owner_name=#{orga}\")\n\tend",
"def get_repos\n @api.list_repositories\n end",
"def get_info(filename)\n @octokit_client = @octokit_client_factory.call if @octokit_client.nil?\n @octokit_client.contents @fullname, path: filename\n end",
"def repository_fields\n client.repo('git/git').fields\n end",
"def get_repo_users\n repo_users = Array.new\n github = Github.new :oauth_token => github_token\n\n github.repos.list.body.each do |repo|\n repo_users << repo[\"owner\"][\"login\"]\n end\n\n repo_users\n end",
"def git_data(options = {})\n @git_data ||= ApiFactory.new 'GitData', options\n end",
"def additional_disk_info\n raise \"repository hasn't been set!\" unless @my_repository\n\n return @repo_info[:branches], @repo_info[:contribs]\n end",
"def data(files, private_gist, description)\n i = 0\n file_data = {}\n files.each do |file|\n i = i + 1\n filename = file[:filename] ? file[:filename] : \"gistfile#{i}\"\n file_data[filename] = {:content => file[:input]}\n end\n\n data = {\"files\" => file_data}\n data.merge!({ 'description' => description }) unless description.nil?\n data.merge!({ 'public' => !private_gist })\n data\n end",
"def all_file_commits_data(path)\n time = ` cd /tmp/#{@repo} && git log --format=%ct #{path} `.split(\"\\n\").map{|time| time.to_i}\n ins_del = ` cd /tmp/#{@repo} && git log --numstat --format=%h #{path} | grep #{path} `.split(\"\\n\").map{|line| line.split(\" \")[0..1]}.map{|insert| insert.map{|x| x.to_i}}\n time.zip(ins_del)\n end",
"def format_repo(data)\n Cinch::Formatting.format(:green, \"#{data[\"repository\"][\"name\"]}\")\n end",
"def fetch_github_information\n self.associated_commit_shas = []\n self.branch_name = nil\n self.username = nil\n\n return if self.dev_build\n\n GithubService.run(self.project.github_root_url, self.project.github_repo) do |service|\n if self.is_branch_build\n self.associated_commit_shas = service.github_commits(10, self.commit_sha)\n self.branch_name = nil\n self.username = nil\n else\n self.associated_commit_shas = []\n info = service.user_and_branch_for_pull_request(self.pull_request_number)\n self.username = info[:user]\n self.branch_name = info[:branch]\n end\n end\n end"
] |
[
"0.714212",
"0.71261907",
"0.6785698",
"0.6780657",
"0.6704207",
"0.65609276",
"0.6550417",
"0.65123725",
"0.64992255",
"0.64853007",
"0.64511174",
"0.6438934",
"0.641075",
"0.6355222",
"0.62439364",
"0.6243057",
"0.6231202",
"0.62244225",
"0.6206093",
"0.6188503",
"0.6174837",
"0.61590254",
"0.6158673",
"0.6152824",
"0.61503804",
"0.6142568",
"0.61404634",
"0.61385465",
"0.6124439",
"0.61195886",
"0.6105932",
"0.6100488",
"0.6096116",
"0.60923326",
"0.60923326",
"0.60923326",
"0.60923326",
"0.608932",
"0.6085221",
"0.60834444",
"0.60744554",
"0.60709363",
"0.60669905",
"0.60620815",
"0.60554475",
"0.60426545",
"0.60348594",
"0.6025277",
"0.601407",
"0.59994227",
"0.5989223",
"0.59889805",
"0.59823406",
"0.597908",
"0.5970551",
"0.5963259",
"0.595598",
"0.59453505",
"0.59341985",
"0.59217536",
"0.59055716",
"0.5898476",
"0.5873769",
"0.58694726",
"0.5853215",
"0.5847768",
"0.582603",
"0.5823976",
"0.58214575",
"0.58163553",
"0.5797301",
"0.57968885",
"0.5789515",
"0.5785237",
"0.5782609",
"0.5759078",
"0.5743789",
"0.57415783",
"0.57411253",
"0.5725281",
"0.57231665",
"0.57231665",
"0.5723117",
"0.57191724",
"0.5713202",
"0.5708768",
"0.5702145",
"0.5700534",
"0.5699512",
"0.56877023",
"0.5685509",
"0.56851995",
"0.5676145",
"0.5672382",
"0.566532",
"0.56608105",
"0.5659737",
"0.565712",
"0.5655577",
"0.564811",
"0.5642325"
] |
0.0
|
-1
|
Render a single file as if it were a diff with no changes & full context
|
def render_orphan(sequence, name, timestamp)
@names << name
left_header = "--- New file"
right_header = right_header_line(name, timestamp)
helper = HeaderHelper.new(left_header, right_header, @names.count - 1)
result = template("html_header.erb").evaluate(helper)
# create one opcode with the entire content
opcodes = [
[:equal, 0, sequence.length-1, 0, sequence.length-1]
]
helper = hunk_context(sequence, sequence, nil, opcodes, 0)
result << template("html_hunk.erb").evaluate(helper)
result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def render_file!(f, target)\n done = 'keep'.white\n # unless newer?(target, f)\n tilt = Tilt::ERBTemplate.new(f)\n oh = File.open(target, 'wb')\n oh.write tilt.render(OpenStruct.new(@attrs.deep_merge(@config['attrs'])))\n oh.close\n\n # update template timestamp\n FileUtils.touch(f)\n done = 'rendered'.bold.green\n # end\n # done\n end",
"def compute_diff\n original_content_file = Tempfile.new(rand(1024).to_s)\n original_content_file.open\n original_content_file.write(content)\n original_content_file.flush\n diff = `diff #{original_content_file.path} #{tempfile.path}`\n diff.gsub!(/> (.*\\n)/m, '\\1'.green)\n diff.gsub!(/< (.*\\n)/m, '\\1'.red)\n ensure\n original_content_file.close\n original_content_file.unlink\n diff\n end",
"def render_file(path, options = {}, &block)\n\t\t\t\t\t\tout = render_file_without_retabulation(path, options, &block)\n\t\t\t\t\t\tif path =~ Retabulate::CONVERTABLE_FILETYPES\n\t\t\t\t\t\t\tout = Retabulate::retabulate(out)\n\t\t\t\t\t\tend\n\t\n\t\t\t\t\t\tout\n\t\t\t\t\tend",
"def file(context: nil, ignore_deletions: false)\n differ = \"git diff#{cmd}\"\n differ << \" --unified=#{context}\" if context\n differ << \" --diff-filter=d\" if ignore_deletions\n run(differ)\n end",
"def generate_diff\n jsons = version_jsons.map { |j| pretty_json(j) }\n differ = Differ.send(diff_method, *jsons).format_as(:html)\n differ.gsub!('<ins', \"\\n<ins\") if diff_method == :diff_by_line\n @diff = sanitize(differ).html_safe\n end",
"def show\n render layout: 'diff'\n end",
"def diff\n element_name = happy_path? ? @processor.kind.output_name : @processor.kind.error_name\n html_diff(\n @ciat_file.element(element_name).as_file,\n @ciat_file.element(element_name, :generated).as_file, \n @ciat_file.element(element_name, :diff).as_file)\n end",
"def file_to_render\n file\n end",
"def generate_diff(app_file:, prototype_file:)\n rails_file = File.join(app_fetcher.output_dir, app_file)\n prototype_file = File.join(prototype_fetcher.output_dir, prototype_file)\n\n File.join(diff_dir, File.basename(app_file)).tap do |output|\n system \"bin/codediff.py --wrap #{WRAP_WIDTH} --yes #{rails_file} #{prototype_file} -o #{output}\"\n end\n end",
"def render\n Tilt.new(@file)\n .render(OpenStruct.new(@binds))\n .delete!(\"\\n\")\n end",
"def to_html \n PrettyDiff::HtmlGenerator.generate_diff(chunks)\n end",
"def _render_one(entry)\n @entry = entry\n @filename = @entry.filename\n\n # avoid double render of layout path\n return if @entry.source_path == @layout_path\n\n # render. Result goes into @content_for_resources\n input = File.read(@entry.source_path)\n \n # render using either erb or haml\n case File.extname(@entry.source_path)\n when /\\.rhtml$/, /\\.html.erb$/\n @content_for_resources += eval(Erubis::Eruby.new.convert(input))\n when /\\.haml$/, /\\.html.haml$/\n require 'haml'\n @content_for_resources += Haml::Engine.new(input).to_html(self)\n end\n\n @filename =nil\n @entry = nil\n end",
"def diff(nocolor: false)\n xml = Nokogiri::XML(File.open(@path), &:noblanks)\n ideal = xml.to_xml(indent: 2)\n now = File.read(@path)\n differ(ideal, now, nocolor: nocolor)\n end",
"def render_to_file(output_path, context, properties = T.unsafe(nil)); end",
"def render_file(file)\n\t\tFile.open(file, File::RDWR|File::CREAT) do |f|\n\t\t\tf.flock(File::LOCK_EX)\n\t\t\tresult = render(f.read)\n\t\t\tf.rewind\n\t\t\tf.write(result)\n\t\t\tf.flush\n\t\t\tf.truncate(f.pos)\n\t\tend\n\tend",
"def cmd_diff\n print_tree(DiffEditor, nil, true)\n end",
"def render_file(src_file, options)\n render_string File.read(src_file), options\n end",
"def diff_output\n `\n git diff \\\n --diff-filter=AM \\\n --ignore-space-at-eol \\\n --no-color \\\n --cached \\\n -p \\\n -- '*.rb' '*.rake'\n `\n end",
"def diff\n require \"tempfile\"\n new_file = Tempfile.new([\"new_config.\", \".yml\"])\n new_file.write(sorted_file)\n result = `git diff --no-index -- #{file} #{new_file.path}`.gsub(\n no_slash_beginning(new_file.path),\n no_slash_beginning(file)\n )\n ensure\n new_file.close\n new_file.unlink\n result\n end",
"def process\n filename = \"index.markdown\"\n markdowns = {filename => []} \n state = :message\n message = [\"\\n\"]\n patch = []\n commit = nil\n (@gitlogp.split(\"\\n\")+[\"DONE\"]).each { |line|\n words=line.split\n if line.slice(0,1)==\" \" || words.length==0\n # commit messages start with 4 spaces, diff contents with 1 space\n if state==:message\n if words[0]==\"OUTPUT_FILE:\"\n filename = words[1]\n markdowns[filename] ||= []\n else\n message << \"#{line.slice(4..-1)}\"\n end\n else\n patch << \" #{line}\" if state==:patch\n end\n elsif words[0]==\"commit\" or words[0]==\"DONE\"\n if !commit.nil?\n # replace the short description line with a named link\n shortlog = message[2]\n message[2] = \"<a name='#{shortlog}'> </a>\"\n markdowns[filename] += message.map {|l|\n if l==\"SHOW_PATCH\"\n (patch+[\"{: .diff}\\n\"]).join(\"\\n\")\n else\n l\n end\n }\n series = tags[commit].slice(-2..-1)\n markdowns[filename] << \"\\n#{tags[commit]}: [view on github](#{@commit_link_base}#{commit}), [download #{series}-#{shortlog}.patch](#{@patch_link_base}/#{series}-#{shortlog}.patch)\\n{: .commit}\\n\"\n end\n \n message=[\"\\n\"]\n patch=[]\n\n commit = words[1]\n state = :message\n elsif [\"Author:\", \"Date:\", \"new\", \"index\", \"---\", \"+++\", '\\\\'].include?(words[0])\n # chomp\n elsif words[0]==\"diff\"\n state = :patch\n left = words[2].slice(2..-1)\n right = words[3].slice(2..-1)\n if left==right\n patch << \" ::: #{right}\"\n else\n patch << \" ::: #{left} -> #{right}\"\n end\n elsif words[0]==\"@@\"\n # git tries to put the function or class name after @@. This\n # works great for C diffs, but it only finds the class name in\n # Ruby, which is usually similar to the file name, Therefore\n # it's distracting cruft. Toss it.\n patch << \" #{words.slice(0,4).join(\" \")}\"\n else\n message << \"#{line.slice(4..-1)}\" if state==:message\n patch << \" #{line}\" if state==:patch \n end\n }\n output = {}\n markdowns.each do |fn, markdown|\n output[fn] = markdown.join(\"\\n\")\n Rails.logger.info(output[fn]) if respond_to? :Rails\n end\n return output\n end",
"def render_file(filename)\n to_file(filename)\n end",
"def render_file(filename)\n to_file(filename)\n end",
"def render\n File.open(@file.output_path, \"w\") { |file| file.write(super) }\n end",
"def render\n ERB.new(File.read(@file)).result(binding)\n end",
"def diff( string, &block )\n # Make sure the directory of the file exists.\n FileUtils.mkdir_p File.dirname( path )\n\n # Write the new string to the file.\n File.open path, 'w' do |f|\n f << Tilt.new( path ).render( string )\n end\n\n # If the file hasn't been checked in, raise an error.\n sh \"git ls-files #{path} --error-unmatch\" do |err|\n raise Errno::ENOENT, path\n end\n\n # If the file has changed, call the block.\n sh \"git diff --exit-code #{path}\" do |err|\n block.call err\n end\n end",
"def show_file(env, res, tag, path)\n body = \"(empty)\"\n git(\"show\", \"#{tag}:#{path}\") do |io|\n body = io.read\n end\n mime_type = Rack::Mime.mime_type(File.extname(path), \"text/plain\")\n if mime_type != \"text/plain\"\n res.write body\n res['Content-Type'] = mime_type\n return\n end\n E_show_file.result(binding)\n end",
"def generate_file_diff(left, right, overrides = {})\n defaults = {title_left: 'Expected', title_right: 'Actual', stylesheet: link('styles/compare_it.css')}\n overrides = defaults.merge(overrides)\n # Temporary file for the HTML report - it is deleted after we're done.\n temp_diff_file = Tempfile.new('diff')\n temp_diff_file.close\n # The Windows file paths.\n left_file = Converter.to_windows_path(left)\n right_file = Converter.to_windows_path(right)\n diff_file = Converter.to_windows_path(temp_diff_file.path)\n # Arguments\n # /min - Minimised mode.\n # /G: - Generate report, N - Line numbers, S - Statistics, X - External CSS, 0 - Context lines.\n executable = @config_manager['tool.compare_it.executable']\n args = [left_file, \"/=#{overrides[:title_left]}\", right_file, \"/=#{overrides[:title_right]}\", '/min', '/G:NSX0', diff_file]\n FileUtils.cd(Dir.tmpdir) { system(executable, *args) }\n # The diff content.\n diff_html = File.readlines(temp_diff_file.path)\n diff_html[0] = '<!DOCTYPE html>' + \"\\n\"\n diff_html[6] = '<link href=\"' + overrides[:stylesheet] + '\" rel=\"stylesheet\" type=\"text/css\" />' + \"\\n\"\n # Delete the temporary file.\n temp_diff_file.unlink\n # Return the diff content.\n diff_html.join\n end",
"def render(context)\n # super is the input\n file = Tempfile.new('')\n file.write(super)\n file.close # close temp file; flush content\n output = `/Users/pushpendrerastogi/Dropbox/se4u_github_io/_plugins/org2html.py #{file.path}`\n file.unlink # Delete temp file\n output\n end",
"def on_file_changed(content, out, path)\n SpacewalkHtmlClean.generate_diff(content, out, path)\n end",
"def render_file(file, context=nil, extra_context={})\n File.open(file, 'r') do |file|\n render_string file.read, context, extra_context\n end\n end",
"def cached_render_file\n rendered = uncached_render\n\n global_epath = Global.public_root/self.controller.mapping/extended_path\n FileUtils.mkdir_p(File.dirname(global_epath))\n File.open(global_epath, 'w+') {|fp| fp.print(rendered) }\n\n rendered\n end",
"def render!\n render :file => template_path\n end",
"def parse_diff\n # If there is a file, do some initialisation\n file_obj = File.new(@diff_filename, \"r\")\n temp_a = temp_r = nil \n \n # Then for each line found on the diff file\n # Do some bucket-ing between added and removed\n file_obj.each do |line|\n \n line = line.chomp!\n if line.match $regexes[:diff_info]\n # We are doing this 'diff' block-by-block \n # As initially it is planned to cross-reference the added/removed right per block \n # as it is easier and cheaper. Well, this structure is retained if we decided to have \n # 'extra' action when we finish with a 'diff' block\n # Pushing the temporary 'lines' back to where it should belong\n @added_lines.concat temp_a unless temp_a == nil\n @removed_lines.concat temp_r unless temp_r == nil\n \n # reset the temporary variable\n temp_a = []\n temp_r = []\n end #End if line.match $regexes[:diff_info]\n \n processed_line = \"\"\n if line.start_with? \">\", \"<\"\n sign = line.slice!(0).chr\n processed_line = line.strip.chomp\n \n # Get me out of here, comment is useless for this.\n next unless !processed_line.start_with? \"#\" \n \n if sign == \">\"\n # Should be put under added temporarily\n temp_a.push processed_line\n elsif sign == \"<\"\n # Should be put under removed temporarily\n temp_r.push processed_line\n end\n end #End if line.start_with? \">\", \"<\"\n end #End for-each\n end",
"def make_my_diffs_pretty!; end",
"def patch diff, direction\n i = j = 0\n diff.diff.each do |change|\n action = PATCHHASH[direction][change.action]\n case action\n when '-'\n while i < change.position\n i += 1\n j += 1\n end\n if direction == :patch\n @fileContent.delete_at(i)\n else\n @fileContent.delete_at(i + 1)\n end\n i += 1\n when '+'\n while j < change.position\n i += 1\n j += 1\n end\n @fileContent.insert j, change.element\n j += 1\n end\n end\n end",
"def diff\n @diff ||= begin\n commit.diffs.collect{|diff| diff.diff}.join(\"\\n\")\n end\n end",
"def process_primary_files_with_changes_only\n # We get the diff only so that we know which files have changed.\n # It's ok to use the reference commits because we're dealing with\n # content AT files only.\n diff = @repository.diff(@from_git_commit, @to_git_commit, context_lines: 0)\n fwc = []\n diff.patches.each { |patch|\n file_name = patch.delta.old_file[:path]\n # Skip non content_at files\n next if !@file_list.include?(file_name)\n # next if !file_name.index('63-0728')\n unless file_name =~ /\\/content\\/.+\\d{4}\\.at\\z/\n raise \"shouldn't get here: #{ file_name.inspect }\"\n end\n\n @logger.info(\" - process #{ file_name }\")\n\n absolute_file_path = File.join(@repository.base_dir, file_name)\n # Initialize content AT file `to` with contents as of `to_git_commit`.\n # It's fine to use the reference sync commit as the sync operation\n # doesn't touch content AT files, only STM CSV ones.\n content_at_file_to = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n absolute_file_path,\n @any_content_type\n ).as_of_git_commit(@to_git_commit)\n\n compute_st_ops_attrs = {\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n prev_last_operation_id: @prev_last_operation_id,\n execution_context: @execution_context,\n }\n\n compute_st_ops_attrs = refine_compute_st_ops_attrs(\n compute_st_ops_attrs,\n {\n from_table_release_version: @from_table_release_version,\n to_table_release_version: @to_table_release_version,\n absolute_file_path: absolute_file_path\n }\n )\n soff = SubtitleOperationsForFile.new(\n content_at_file_to,\n @repository.base_dir,\n compute_st_ops_attrs\n ).compute\n\n if soff.operations.any?\n # Only collect files that have subtitle operations\n @prev_last_operation_id = soff.last_operation_id\n fwc << soff\n end\n }\n\n # Then we add any files that have st_sync_required set to true and are\n # not in fwc already.\n @file_list.each { |content_at_filename|\n # Skip files that we have captured already\n next if fwc.any? { |soff| soff.content_at_file.repo_relative_path == content_at_filename }\n # Skip files that don't have st_sync_required set to true at to_git_commit\n dj_filename = content_at_filename.sub(/\\.at\\z/, '.data.json')\n # We use dj file contents at to_git_commit :at_child_or_ref\n dj_file = Repositext::RFile::DataJson.new(\n '_', # Contents are initialized later via #as_of_git_commit\n @language,\n dj_filename,\n @any_content_type\n ).as_of_git_commit(\n @to_git_commit,\n :at_child_or_ref\n )\n next if(dj_file.nil? || !dj_file.read_data['st_sync_required'])\n # This file is not in the list of fwc yet, and it has st_sync_required.\n # We add an soff instance with no operations. This could be a file\n # that has changes to subtitle timeslices only.\n content_at_file_from = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n content_at_filename,\n @any_content_type\n ).as_of_git_commit(@from_git_commit)\n soff = Repositext::Subtitle::OperationsForFile.new(\n content_at_file_from,\n {\n file_path: content_at_file_from.repo_relative_path,\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n },\n [] # No operations\n )\n fwc << soff\n }\n # Return list of unique files with changes\n fwc.uniq\n end",
"def unified\n builder = Builder::XmlMarkup.new\n builder.table(class: 'unified-diff diff csv-diff') do\n builder.colgroup do\n builder.col(class: 'line-nr')\n builder.col(class: 'line-nr')\n builder.col(span: @combined_headers.length)\n end\n builder.thead do\n builder.tr do\n builder.th(class: 'line-nr', title: I18n.t('submissions.show.your_output')) do\n builder.i(class: 'mdi mdi-18 mdi-file-account')\n end\n builder.th(class: 'line-nr', title: I18n.t('submissions.show.expected')) do\n builder.i(class: 'mdi mdi-18 mdi-file-check')\n end\n builder.th(colspan: @combined_headers.length)\n end\n builder.tr do\n builder.th(class: 'line-nr')\n builder.th(class: 'line-nr')\n builder << @combined_headers.join\n end\n end\n builder.tbody do\n if @simplified_table\n unified_simple_body builder\n else\n @diff.each do |chunk|\n is_empty, row = old_row chunk\n\n unless is_empty\n full_row = Array.new(@combined_headers.length) { |i| @gen_header_indices.index(i) }.map { |idx| idx.nil? ? '<td></td>' : row[idx] }\n\n builder << %(<tr>\n <td class=\"line-nr\">#{chunk.old_position + 1}</td>\n <td class=\"line-nr\"></td>\n #{full_row.join}\n </tr>)\n end\n\n is_empty, row = new_row chunk\n\n next if is_empty\n\n full_row = Array.new(@combined_headers.length) { |i| @exp_header_indices.index(i) }.map { |idx| idx.nil? ? '<td></td>' : row[idx] }\n\n builder << %(<tr>\n <td class=\"line-nr\"></td>\n <td class=\"line-nr\">#{chunk.new_position + 1}</td>\n #{full_row.join}\n </tr>)\n end\n end\n end\n end.html_safe\n end",
"def render_to_string(options)\n \"Rendered #{options[:file] || options[:partial]}.\"\n end",
"def local_diff\n `cd #{@local_path} && git diff HEAD`\n end",
"def render file_name\n template_file = @template_dir + file_name\n\n template = template_for template_file, false, RDoc::ERBPartial\n\n template.filename = template_file.to_s\n\n template.result @context\n end",
"def render_file(filename)\n File.open(filename, 'wb') { |f| render(f) }\n end",
"def create\n revisions do |orig_file, sha_list|\n sha_list.each_with_index do |sha, i|\n ver = (i + 1).to_s\n # Git revisioned file\n composeversions(orig_file, sha, ver) do |content, data, file_path|\n # dont re-write files\n if File.exist?(file_path)\n linecount(file_path)\n next\n end\n\n version_content = FrontMatter.new(data)\n version_content.content = content \n write(file_path, version_content.update)\n linecount(file_path)\n end\n end\n\n sha_list.map!.with_index { |sha, i| [] << sha << (i + 1) }\n # Git Diff combination files\n composediffs(orig_file, line_count, sha_list.combination(2)) do |content, data, file_path|\n content.sub!(DIFF_HEADER_REGEXP, '')\n if change?(content)\n VersionedFiles.frontmatter[\"no_change\"] = false\n styled_content = @style.style(content)\n data.merge!(@style.stats.final)\n else\n VersionedFiles.frontmatter[\"no_change\"] = \"no_change\"\n data[\"no_change\"] = true\n end\n\n fm = FrontMatter.new(data).create\n diff_file = fm << styled_content\n write(file_path, diff_file)\n end\n end\n end",
"def update_file\n output = (@blocks[:before] + @blocks[:attributes] + @blocks[:after]).join(\"\\n\").strip + \"\\n\"\n File.open(@filename,'w') { |f| f.write(output) } if output != @file\n end",
"def specfile\n rendered_file_for(:specfile)\n end",
"def git_diff_next\n unstaged_git_files.each do |unstaged_file|\n if unstaged_file.untracked?\n `echo UNTRACKED FILE #{unstaged_file.filename} >&2`\n copy_to_clipboard(unstaged_file)\n break\n elsif unstaged_file.deleted?\n `echo DELETED FILE #{unstaged_file.filename} >&2`\n copy_to_clipboard(unstaged_file)\n break\n elsif !unstaged_file.has_unstaged_changes?\n next\n else\n copy_to_clipboard(unstaged_file)\n exec \"git diff #{unstaged_file.filename}\"\n end\n end\nend",
"def to_html\n render_file(main)\n end",
"def show\n @test_var = \"\"\n commit = @repo.lookup(@commit.sha)\n if commit.parents.length > 0\n diff_commits = commit.parents[0].diff(commit, :context_lines => 100000000)\n @test_var = Iconv.conv('utf-8', 'latin1', diff_commits.patch())\n end\n render :layout => 'application'\n end",
"def do_diff(base_path, path)\n if base_path.nil?\n # If there's no base path, then the file\n # must have been added\n puts(\"Added: #{path}\")\n name = path\n elsif path.nil?\n # If there's no new path, then the file\n # must have been deleted\n puts(\"Removed: #{base_path}\")\n name = base_path\n else\n # Otherwise, the file must have been modified\n puts \"Modified: #{path}\"\n name = path\n end\n\n # Set up labels for the two files\n base_label = \"#{name} (original)\"\n label = \"#{name} (new)\"\n\n # Output a unified diff between the two files\n puts \"=\" * 78\n differ = Svn::Fs::FileDiff.new(@base_root, base_path, @root, path)\n puts differ.unified(base_label, label)\n puts\n end",
"def to_html\n return \"\" unless file_name\n return e if e?\n page = render.to_html\n path = File.dirname(file_path)\n # Get child content.\n # A reflexive.\n files(path).each do |file|\n doc = Document.new :base_path => self.base_path, :lang => self.lang, :indent => self.indent, :settings => self.settings, :web_path => self.web_path, :commit => self.commit, :repository => self.repository, :filename => file\n self.browsers << doc\n page += doc.to_html\n end\n dirs(path).each do |dir|\n # Plus one indent from parent. Change h[1-6] tag to h[2-7] if indent is 1.\n doc = Document.new :base_path => dir, :lang => self.lang, :indent => self.indent + 1, :settings => self.settings, :web_path => self.web_path[0..-2] + dir.gsub(self.base_path, \"\"), :commit => self.commit, :repository => self.repository\n self.childs << doc\n page += doc.to_html\n end\n page\n end",
"def render_for_file_with_inherit_views(template_path, status = nil, use_full_path = false, locals = {})\n if use_full_path and inherit_views? and found_path = find_inherited_template_path(template_path)\n template_path = found_path\n end\n render_for_file_without_inherit_views(template_path, status, use_full_path, locals)\n end",
"def partial(file_name)\n erb file_name, :layout => false\n end",
"def diff(fn1,fn2)\n result = ''\n f1 = File.open(fn1)\n f2 = File.open(fn2)\n while f1.eof? == false and f2.eof? == false\n line1 = f1.gets\n line2 = f2.gets\n result << \"<#{line1}\\n>#{line2}\\n\" if line1 != line2\n end\n if f1.eof? == false\n while f1.eof? == false\n line1 = f1.gets\n result << \"<#{line1}\\n\"\n end\n end\n if f2.eof? == false\n while f2.eof? == false\n line2 = f2.gets\n result \">#{line2}\\n\"\n end\n end\n f1.close\n f2.close\n result\nend",
"def renderFile(templateFile, targetFile)\n puts \"Render file: #{targetFile}\" \n erb=ERB.new(File.read(templateFile))\n File.new(targetFile,'w+').write(erb.result(binding))\n end",
"def test_independent_render_contexts\n yaml1 = \"<% def leaked_method; 'leak'; end %>\\n\"\n yaml2 = \"one:\\n name: <%= leaked_method %>\\n\"\n tmp_yaml [\"leaky\", \"yml\"], yaml1 do |t1|\n tmp_yaml [\"curious\", \"yml\"], yaml2 do |t2|\n File.open(t1.path) { |fh| fh.to_a }\n assert_raises(NameError) do\n File.open(t2.path) { |fh| fh.to_a }\n end\n end\n end\n end",
"def assert_renders_correctly(name, path)\n input_source = path.read\n output_source = @handler.compile(Template.new(input_source))\n value = @view.instance_eval output_source\n reference = (REFERENCE_PATH + @view.prawnto_options[:filename]).read\n\n message = \"template: #{name}\\n\"\n message += \">\"*30 + \" original template: \" + \">\"*20 + \"\\n\"\n message += input_source + \"\\n\"*2\n message += \">\"*30 + \" manipulated template: \" + \">\"*20 + \"\\n\"\n message += output_source + \"\\n\" + \"<\"*60 + \"\\n\"\n\n assert_equal reference, value, message\n end",
"def render(context)\n file = Tempfile.new('')\n file.write(super)\n file.close # close temp file; flush content\n output = `python #{file.path}`\n file.unlink # Delete temp file\n \"<figure><embed src=\\\"#{output}\\\" /></figure>\"\n end",
"def content_of file:, for_sha:\n result = output_of \"git show #{for_sha}:#{file}\"\n result = '' if result == default_file_content_for(file)\n result\nend",
"def diff_unified(text_old, text_new, label=\"--- old\\n+++ new\\n\", context=3)\n tmp_old = \"_tmp.old.#{rand()}\"\n tmp_new = \"_tmp.new.#{rand()}\"\n File.open(tmp_old, 'w') {|f| f.write(text_old) }\n File.open(tmp_new, 'w') {|f| f.write(text_new) }\n begin\n #diff = `diff -u #{tmp_old} #{tmp_new}`\n diff = `diff --unified=#{context} #{tmp_old} #{tmp_new}`\n ensure\n File.unlink(tmp_old)\n File.unlink(tmp_new)\n end\n diff.sub!(/\\A\\-\\-\\-.*\\n\\+\\+\\+.*\\n/, label.to_s)\n return diff\n end",
"def render_erb(fname)\n ERB.new(\n File.read(\"src/#{fname}.erb\")\n ).result(binding)\nend",
"def diff_file(from_file, to_file, context=3)\n seq1 = File.open(from_file).readlines\n from_mtime = File.stat(from_file).mtime\n seq2 = File.open(to_file).readlines\n to_mtime = File.stat(to_file).mtime\n sdiff = Diff::LCS.sdiff(seq1, seq2)\n diff_lines(seq1, seq2, from_file, to_file, from_mtime, \n to_mtime, context)\n end",
"def file_diff(fn1, fn2)\n result = ''\n File.open(fn1) do |f1|\n File.open(fn2) do |f2|\n while f1.eof? == false && f2.eof? == false\n line1 = f1.gets.chomp\n line2 = f2.gets.chomp\n result << \"<#{line1}\\n>#{line2}\\n\" if line1 != line2\n end\n if f1.eof? == false\n while f1.eof? == false\n line1 = f1.gets\n result << \"<#{line1}\\n\"\n end\n end\n if f2.eof? == false\n while f2.eof? == false\n line2 = f2.gets\n result << \">#{line2}\\n\"\n end\n end\n end\n end\n result\nend",
"def diff2; end",
"def edit_temp(opts = {})\n temp_file do |f|\n f.puts(opts[:temp])\n f.flush\n f.close(false)\n invoke_editor(f.path, opts[:line], true)\n @content = File.read(f.path)\n end\n end",
"def testget_leveled_file_contentUselessLVL\n # If set to 1, nothing will be leveled.\n RCodeLeveler::set_level(1)\n lNewContent, lDiff = RCodeLeveler.get_leveled_file_content('RequiredFiles/SimpleFile')\n File.open(\"#{File.dirname(__FILE__)}/RequiredFiles/SimpleFile.rb\", 'r') do |iFile|\n assert_equal(iFile.readlines, lNewContent)\n end\n assert_equal(false, lDiff)\n end",
"def createDiffResult(working_dir, channel_cfg, vimapp, isReleaseOperator,backupRoot)\n\n remotedir = readChannelDir(channel_cfg, vimapp) + \"/\"+ File.basename(working_dir)\n puts remotedir.green\n if File.directory?(remotedir) == false\n FileUtils.mkdir_p remotedir\n end\n\n reportFile1 = \"#{remotedir}/report\"\n reportFile2 = \"#{remotedir}/rdetail\"\n lines = File.open(reportFile1, \"r:UTF-8\").each_line.to_a\n\n hashes = Array.new\n lines.each do |line|\n if line.start_with? \"hash=\"\n hashes.push line.gsub(\"hash=\",\"\").strip.chomp\n end\n end\n\n g = gitOpen(working_dir)\n \n logs = getGitLog(g)\n local_branches = getGitBranches(g)[:local]\n diff = compareHashes g, logs, hashes\n \n def getDiffDetails(diffinfo)\n puts \"diffdetails\"\n data = Array.new \n\n diffinfo[:files].each do |file|\n print \"[\"\n print file[0].cyan\n print \"] \"\n print \"[+] #{file[1][:insertions]}\".green\n print \" \"\n print \"[-] #{file[1][:deletions]}\".red\n puts\n # file, insertions, deletions\n data.push \"file=#{file[0]},#{file[1][:insertions]},#{file[1][:deletions]}\"\n end\n\n return data \n end\n\n diff_details = getDiffDetails diff[1]\n \n puts \"\\n\\n|||||||||||||||||||||||||WRITE|||||||||||||||||||||||||||||||||\\n\\n\"\n\n puts \"hash=\"+diff[2]\n puts \"hash=\"+diff[3]\n diff_details.each do |d| \n puts d\n end\n\n diffReportDir = \"#{working_dir}/.diffreport\"\n FileUtils.mkdir_p diffReportDir \n\n #write diff detail to file \n r_detail = \"#{diffReportDir}/detail\"\n\n puts \">> 222\"\n f = File.open(r_detail, \"w:UTF-8\")\n diff[0].each do |l|\n f.puts l\n end\n f.close\n\n f = File.open(r_detail+\".color\", \"w:UTF-8\")\n diff[0].each do |l|\n if isPlus(l)\n f.puts l.green\n elsif isMinus(l)\n f.puts l.red\n else\n f.puts l\n end\n end\n f.close\n\n puts \">> 111\"\n #write diff to file\n diffReport = \"#{diffReportDir}/report\"\n f = File.open(diffReport, \"w:UTF-8\")\n f.puts \"hash=\"+diff[2]\n f.puts \"hash=\"+diff[3]\n diff_details.each do |d| \n f.puts d\n end\n f.close\n puts \"\\n\\nWRITTEN\\n\\n\".green\n\n if isReleaseOperator == false\n FileUtils.cp \"#{diffReport}\", \"#{reportFile1}\"\n FileUtils.cp \"#{r_detail}\", \"#{reportFile2}\"\n else\n metaOK = FileUtils.identical?(diffReport, reportFile1)\n detailOK = FileUtils.identical?(r_detail, reportFile2)\n \n puts \n print \"[ OVERVIEWS ] \" #metaOK.to_s.red\n puts metaOK ? \"IDENTICAL\".green : \"DIFFERENT\".red\n print \"[CODE DETAILS] \"\n puts detailOK ? \"IDENTICAL\".green : \"DIFFERENT\".red\n puts\n def compare(file1, file2)\n puts \">> compare\"\n lines1 = File.open(file1, \"r:UTF-8\").each_line.to_a\n lines2 = File.open(file2, \"r:UTF-8\").each_line.to_a\n def showInclusion(lines1, lines2, i)\n lines1.each do |line|\n if lines2.include?(line) == false\n if i == true\n puts \"[YOURS] \"+ line.chomp.cyan\n else\n puts \"[REMOTE] \"+ line.chomp.yellow\n end\n end\n end\n end\n showInclusion(lines1, lines2, true)\n showInclusion(lines2, lines1, false)\n end\n compare diffReport, reportFile1\n compare r_detail, reportFile2\n end\n\n files = Array.new\n diff_details.each do |d| \n if d.start_with? \"file=\"\n files.push d.gsub(\"file=\",\"\").strip.chomp\n end\n end\n if hashes.size > 0\n #compareBackupsWithOldVersion(g, working_dir, backupRoot, files, hash) \n #compareBackupsWithOldVersion(g, working_dir,backupRoot,files, hash[1]) \n end\n end",
"def render_to(path, opts={})\n overwrite = opts[:overwrite] || true\n path = File.expand_path(path)\n \n if File.exists?(path) && !overwrite\n raise RuntimeError, \"File already exists and not overwritable!\"\n end\n \n File.open(path, 'w') { |f| f.write(self.render) }\n end",
"def diff( *files, **options )\n\t\treturn self.server.run( :diff, *files, **options )\n\tend",
"def dodiff(item)\n trmt = Tempfile.new([tolocalname(item, @itemkey)+'_remote_', '.lua'])\n tlcl = Tempfile.new([tolocalname(item, @itemkey)+'_local_', '.lua'])\n if item.has_key? :script then\n Pathname.new(tlcl.path).open('wb') do |io|\n io << item[:script]\n end\n else\n Pathname.new(tlcl.path).open('wb') do |io|\n io << item[:local_path].read\n end\n end\n df = \"\"\n begin\n download(Pathname.new(trmt.path), item)\n\n cmd = $cfg['diff.cmd'].shellsplit\n cmd << trmt.path.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR || ::File::SEPARATOR)\n cmd << tlcl.path.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR || ::File::SEPARATOR)\n\n df, _ = Open3.capture2e(*cmd)\n ensure\n trmt.close\n trmt.unlink\n tlcl.close\n tlcl.unlink\n end\n df\n end",
"def template_for(file); end",
"def file_diff(fn1,fn2)\n result = ''\n File.open(fn1) do |f1|\n File.open(fn2) do |f2|\n while f1.eof? == false and f2.eof? == false\n line1 = f1.gets.chomp\n line2 = f2.gets.chomp\n result << \"<#{line1}\\n>#{line2}\\n\" if line1 != line2\n end\n if f1.eof? == false\n while f1.eof? == false\n line1 = f1.gets\n result << \"<#{line1}\\n\"\n end\n end\n if f2.eof? == false\n while f2.eof? == false\n line2 = f2.gets\n result \">#{line2}\\n\"\n end\n end\n end\n end\n result\nend",
"def render_for_file(file)\n Skates.logger.info {\n \"RENDERING : #{file}\"\n }\n Skates::Base::View.new(file, assigns)\n end",
"def diffs_to_api\n return @diffs_to_api if @diffs_to_api\n @diffs_to_api = []\n\n diffs.each do |diff|\n path = diff.delta.new_file[:path]\n # Presumably only the first commit\n next if path.split('.').first.to_s.downcase == \"readme\"\n\n lines = []\n diff.each_hunk.each do |hunk|\n lines += hunk.lines\n end\n\n html = OutputRenderer.diff(lines)\n status = diff.delta.status\n\n @diffs_to_api << {\n status: status,\n path: path,\n html: html,\n content: @repo.lookup(diff.delta.new_file[:oid]).content\n }\n\n end\n\n @diffs_to_api\n end",
"def render_as_format(from, to, format)\n puts \"Hola, bon dia!!\"\n puts from\n puts to\n thefile = `iconv -f ISO8859-1 #{from}`\n dotfile = Tempfile.new('dot')\n begin\n model = T2Flow::Parser.new.parse(thefile)\n T2Flow::Dot.new.write_dot(dotfile, model)\n dotfile.close\n `dot -T#{format} -o\"#{to}\" #{dotfile.path}`\n ensure\n dotfile.unlink\n end\nend",
"def get_compiled_file_content(path)\n begin\n Tilt.new(path.to_s).render({}, {\n :spec => spec\n })\n rescue RuntimeError\n File.read(path)\n end\n end",
"def changed?\n render unless result\n if exist?\n File.read(output) != result\n else\n true\n end\n end",
"def render\n ExtensionMatcher.new(path)\n .default { content }\n .on(\"html\") { compress render_erb }\n .on(\"md\") { compress render_erb }\n .on(\"erb\") { compress render_erb }\n .match\n end",
"def decorate(diff_file)\n if content = read_file(diff_file)\n diff_file.highlighted_diff_lines = content.map do |line|\n Gitlab::Diff::Line.init_from_hash(line)\n end\n end\n end",
"def render_exercise(template, digest_component: '')\n say \"Rendering: #{template}\"\n template = full_path(template)\n current_dir = Dir.pwd\n\n content = render(template)\n File.open(filename(template), 'w') { |f| f.write(\"#{content}\\n#{stamp(digest_component, template)}\") }\n\n say ok \"Finished: #{template}\"\n true\n rescue StandardError => e\n say error \"Failed to generate file from: #{template}\"\n say \"#{e.message}\\n#{e.backtrace}\"\n false\n ensure\n Dir.chdir(current_dir)\n end",
"def file_revert(file, ref)\n if file_revisions(file).map { |r| r[:commit] }.include? ref\n file = file.gsub(%r{^/}, '')\n full_path = File.expand_path(file, @root)\n content = File.read(file_revision_at(file, ref))\n File.open(full_path, 'w') { |f| f.puts content }\n end\n end",
"def render_for_file_with_dryml(template_path, status = nil, layout = nil, locals = {})\n render_for_file_without_dryml(template_path, status, layout, locals)\n rescue ActionView::MissingTemplate => ex\n # Try to use a DRYML <page> tag instead\n tag_name = @dryml_fallback_tag || \"#{File.basename(template_path).dasherize}-page\"\n\n text = call_dryml_tag(tag_name)\n if text\n render_for_text text, status \n else\n raise ex\n end\n end",
"def file_listing(commit)\n # The only reason this doesn't work 100% of the time is because grit doesn't :/\n # if i find a fix, it'll go upstream :D\n count = 0\n out = commit.diffs.map do |diff|\n count = count + 1\n if diff.deleted_file\n %(<li class='file_rm'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n else\n cla = diff.new_file ? \"add\" : \"diff\"\n %(<li class='file_#{cla}'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n end\n end\n \"<ul id='files'>#{out.join}</ul>\"\n end",
"def render\n\n\t\t\tcontent = render_object.render\n\n\t\t\tif params[:output_file]\n\t\t\t\tcreate_output_file(content)\n\t\t\telse\n\t\t\t\tputs content\n\t\t\tend\n\n\t\tend",
"def print_file_diffs(file_safety, repo, fname, user_name)\n entry = file_safety[fname]\n repolatest = entry['last_changed_rev']\n safe_revision = entry['safe_revision']\n\n if safe_revision.nil?\n first_revision = set_safe_revision\n print_repo_file_diffs(repolatest, repo, fname, user_name, first_revision)\n else\n\n rev = get_last_changed_revision(repo, fname)\n if rev\n mime = get_mime_type(repo, fname)\n end\n\n print_repo_file_diffs(repolatest, repo, fname, user_name, safe_revision) if repolatest != safe_revision\n end\nend",
"def run\n # Try to get the diff_filename and open it for the comparison\n # And if this is the first time the import is run, there wont be any diff_filename whatsoever, so we loop from the file directly =)\n get_diff_from_previous_file if @diff_filename.nil?\n \n # If this is run for the first time, we are not gonna have the diff_file, so\n # What we are doing is to read all of the lines, and put them under \"added\" section\n if (File.file? @diff_filename)\n # Parse the diff file\n parse_diff \n else\n # We read it from the file directly\n parse_file\n end\n \n # Return with the hash representation of the difference\n return self.line_diff\n end",
"def show_changed_files(status)\n status.each_line do |line|\n if line =~ /^#\\t/ # only print out the changed files (I think)\n if line =~ /new file:|modified:|deleted:/\n puts \" #{line}\" \n else\n puts \" #{line.chop}\\t\\t(may need to be 'git add'ed)\" \n end\n end\n end\nend",
"def patch(diffs)\n @hash = nil # invalidate any cached image\n\n Dir.chdir(root) do\n diffs.each do |diff|\n flag, key, v1, _ = diff\n # if key =~ /\\[/\n # keyname = key.match(/^(.*)\\[\\]$/).captures\n # elsif key =~ /\\./\n # keyname, subkey = key.match(/^(.*)\\.(.*)$/).captures\n # else\n # keyname = key\n # end\n\n dirname, filename, fieldname = Treet::Repo.filefor(key)\n filepath = \"#{dirname}/#{filename}\"\n\n case flag\n when '~'\n # change a value in place\n # load the current data & overwrite with the new value\n # idempotent: this will overwrite the file with the same contents\n if fieldname\n # hash entry\n data = File.exists?(filepath) ? JSON.load(File.open(filepath)) : {}\n data[fieldname] = v1\n File.open(filepath, \"w\") {|f| f << JSON.pretty_generate(data)}\n else\n # string entry\n File.open(filepath, \"w\") {|f| f << v1}\n end\n\n when '+'\n # add something\n if fieldname\n # writing a value into a hash\n # idempotent: this will overwrite the file with the same contents\n data = File.exists?(filepath) ? JSON.load(File.open(filepath)) : {}\n data[fieldname] = v1\n Dir.mkdir(dirname) unless Dir.exists?(dirname)\n File.open(filepath, \"w\") {|f| f << JSON.pretty_generate(data)}\n else\n # writing an entire hash into an array entry\n # idempotent: this will overwrite the file with the same contents\n subfile = \"#{dirname}/#{Treet::Hash.digestify(v1)}\"\n Dir.mkdir(dirname) unless Dir.exists?(dirname)\n case v1\n when Hash\n # hash entry\n File.open(subfile, \"w\") {|f| f << JSON.pretty_generate(v1)}\n else\n # string entry - create empty file with this name\n FileUtils.touch(subfile)\n end\n end\n\n when '-'\n # remove something\n if fieldname\n # this is a key in a subhash\n if File.exists?(filepath)\n # if the subhash is missing, there's nothing to remove, so do nothing (for idempotence)\n data = JSON.load(File.open(filepath))\n data.delete(fieldname)\n if data.empty?\n # all keys have been removed, clean up the file\n File.delete(filename)\n else\n File.open(filepath, \"w\") {|f| f << JSON.pretty_generate(data)}\n end\n end\n elsif dirname == \".\"\n # this is a top-level string\n File.delete(filename) if File.exists?(filename) # need the existence check for idempotence\n else\n # this is an array, we look for a match on the entire contents via digest\n subfile = \"#{dirname}/#{Treet::Hash.digestify(v1)}\"\n File.delete(subfile) if File.exists?(subfile) # need the existence check for idempotence\n # TODO: if dirname is now empty, should it be removed? is that worthwhile?\n end\n end\n end\n end\n\n to_hash # ?? return the patched data? or no return value? true/false for success?\n end",
"def render(filename, content)\n if renderer = renderer_for(filename)\n renderer.call content\n else\n content\n end\n end",
"def render( filename, options = {} )\n options[:scope] = binding() unless options[:scope]\n\n return self.renderer.render( filename, options )\n end",
"def render_other\n repo = Repo.find_by(unique_identifier: @document.unique_identifier, new_format: true)\n return '' if repo.nil?\n\n assets = repo.assets.where(mime_type: ['application/pdf', 'application/gzip'])\n return '' if assets.blank?\n\n ordered_files = repo.structural_metadata.user_defined_mappings['sequence'].map { |i| i['filename'] }\n assets = assets.sort_by { |a| ordered_files.index(a.filename) }\n\n render partial: 'other_display/file_download', locals: { assets: assets }\n end",
"def save_diff_file(full_diff_pathname, open_mode = 'a+')\n File.open(full_diff_pathname, open_mode) do |f|\n f.puts \"-- #{full_diff_pathname}\\r\\n\"\n f.puts 'SET SQL_MODE = \"NO_AUTO_VALUE_ON_ZERO\";'\n f.puts 'SET AUTOCOMMIT = 0;'\n f.puts 'START TRANSACTION;'\n f.puts 'SET time_zone = \"+00:00\";'\n f.puts '/*!40101 SET NAMES utf8 */;'\n f.puts \"\\r\\n--\\r\\n\"\n\n f.puts sql_diff_text_log\n\n f.puts \"\\r\\n--\\r\\n\"\n f.puts 'COMMIT;'\n end\n end",
"def renderdiffviewdiffcont\n @article = Article.find(1)\n render 'articles/show'\n end",
"def test_rendered_action\n process :nothing\n assert !@response.rendered_with_file?\n\n process :hello_world\n assert @response.rendered_with_file?\n assert 'hello_world', @response.rendered_file\n end",
"def freeze_file\n generated_file(@component.basename + \".frz\")\n end",
"def liquify data_obj, template_file, output\n validate_file_input(template_file, \"template\")\n begin\n template = File.read(template_file) # reads the template file\n template = Liquid::Template.parse(template) # compiles template\n rendered = template.render(data_obj.data) # renders the output\n rescue Exception => ex\n message = \"Problem rendering Liquid template. #{template_file}\\n\" \\\n \"#{ex.class} thrown. #{ex.message}\"\n @logger.error message\n raise message\n end\n unless output.downcase == \"stdout\"\n output_file = output\n generate_file(rendered, output_file)\n else # if stdout\n puts \"========\\nOUTPUT: Rendered with template #{template_file}:\\n\\n#{rendered}\\n\"\n end\nend",
"def test_format_without_path\n formatted = DiffLog.format(\"/projects/xiki/trunk/\", \"diff_log.rb\",\n \"|--- /projects/xiki/trunk/diff_log.rb\t2008-03-03 20:35:30.000000000 -0500\n |+++ /tmp/latest-diff.txt\t2008-03-03 20:35:44.000000000 -0500\n |@@ -56,0 +57 @@\n |+#new\n |\".gsub(/^ *\\|/, '')\n )\n\n result =\n \"|/projects/xiki/trunk/\n | diff_log.rb\n | :57\n | +|#new\n |\".gsub(/^ *\\|/, '')\n assert_equal(result, formatted)\n end",
"def colorized_diff(&block); end",
"def diffem\n\t\tputs \"\\nFile 1 [#{file1.size} bytes]\"\n\t\tputs \"File 2 [#{file2.size} bytes]\\n\\n\"\n\n\t\tcount = 0\n\n\t\t@file1.each_byte do |byte|\n\t\t\tif byte == @file2[count]\n\t\t\t\tprint sprintf(ColorConstants::BLUE + \"%02x \", byte)\n\t\t\telse\n\t\t\t\tprint sprintf(ColorConstants::RED + \"%02x \", byte)\n\t\t\tend\n\n\t\t\tcount = count+1\n\n\t\t\tif count % 32 == 0\n\t\t\t\tprint \"\\n\"\n\t\t\tend\n\t\tend\n\n\t\tputs ColorConstants::NO_COLOR + \"\\n---\"\n\t\tcount = 0\n\n\t\t@file2.each_byte do |byte|\n\t\t\tif byte == @file1[count]\n\t\t\t\tprint sprintf(ColorConstants::BLUE + \"%02x \", byte)\n\t\t\telse\n\t\t\t\tprint sprintf(ColorConstants::RED + \"%02x \", byte)\n\t\t\tend\n\n\t\t\tcount = count+1\n\n\t\t\tif count % 32 == 0\n\t\t\t\tprint \"\\n\"\n\t\t\tend\n\t\tend\n\tend",
"def render_self!(files)\n files.each do |f|\n if File.exists?(f + @config['tpl_ext'])\n basename = f.sub(/^#{@app_root}\\//, '')\n carp \"From #{'self'.blue.bold} render #{basename.bold}\",\n render_file!(f + @config['tpl_ext'], f), 1\n end\n end\n end",
"def extract_source_from_file(file_path, env = {})\n HtmlMockup::Template.open(file_path, :partials_path => self.project.partial_path, :layouts_path => self.project.layouts_path).render(env.dup)\n end",
"def render(aContextObject = Object.new, theLocals)\n return '' if @representation.empty?\n\n prev = nil\n result = @representation.each_with_object('') do |element, subResult|\n # Output compaction rules:\n # -In case of consecutive eol's only one is rendered.\n # -In case of comment followed by one eol, both aren't rendered\n unless element.is_a?(EOLine) && \n (prev.is_a?(EOLine) || prev.is_a?(Comment))\n subResult << element.render(aContextObject, theLocals)\n end\n prev = element\n end\n\n return result\n end"
] |
[
"0.6746669",
"0.6353739",
"0.6335399",
"0.63290465",
"0.6302568",
"0.61235553",
"0.6111975",
"0.61047834",
"0.6079808",
"0.6035596",
"0.59908634",
"0.5984947",
"0.5971413",
"0.5901739",
"0.5890334",
"0.58665586",
"0.584461",
"0.5812923",
"0.5806066",
"0.5793864",
"0.5791748",
"0.5791748",
"0.57616985",
"0.5749931",
"0.5737486",
"0.57341903",
"0.5728439",
"0.5711316",
"0.57066935",
"0.5694925",
"0.5672012",
"0.5667174",
"0.5605357",
"0.5601493",
"0.5565096",
"0.55605626",
"0.55570996",
"0.555584",
"0.5513087",
"0.5511366",
"0.5511024",
"0.5496215",
"0.54914135",
"0.54911894",
"0.5480016",
"0.5455806",
"0.5454515",
"0.5437727",
"0.5433683",
"0.5423776",
"0.5411363",
"0.5402069",
"0.5392246",
"0.53908247",
"0.5382194",
"0.53821135",
"0.5378488",
"0.53756666",
"0.5374417",
"0.5358389",
"0.5358387",
"0.53583395",
"0.5350556",
"0.534365",
"0.53411597",
"0.5339386",
"0.5333641",
"0.53303474",
"0.5330265",
"0.5325022",
"0.53216815",
"0.5321617",
"0.53179866",
"0.53133994",
"0.5304125",
"0.5302282",
"0.5294731",
"0.52889293",
"0.5286661",
"0.52845883",
"0.5283425",
"0.52789384",
"0.5271848",
"0.52702975",
"0.52664286",
"0.5254111",
"0.52529794",
"0.52484185",
"0.5248283",
"0.5245699",
"0.52439606",
"0.5243211",
"0.5242963",
"0.5242367",
"0.5240731",
"0.5231182",
"0.522367",
"0.5217447",
"0.52170265",
"0.52156734",
"0.5209164"
] |
0.0
|
-1
|
override to add/change templates
|
def template_path(filename)
File.join(PatienceDiff::TEMPLATE_PATH, filename)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_template\n end",
"def add_template_pages; end",
"def templates; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template(name); end",
"def templates_for(file); end",
"def template_for(file); end",
"def determine_template(options); end",
"def create_template\n self.template = \"template 14231\"\n end",
"def add_template(*args)\n templates.add_template(*args)\n end",
"def templates=(_arg0); end",
"def template(*path); end",
"def template_name; end",
"def template_name; end",
"def apply_template_before?; end",
"def user_template\n super\n end",
"def get_template(template); end",
"def rendered_templates; end",
"def template() false end",
"def template(name, &b)\n @app.templates[name] = b\n end",
"def apply_template_after?; end",
"def new\n @template = CustomTemplate.new\n\n \trender :layout => \"templates\"\t\n end",
"def create_templates\n files = %w(_filter _form index admin edit show new)\n files.each do |file|\n template \"assets/templates/#{file}.html.haml.erb\", \"app/assets/templates/#{class_name.tableize}/#{file}.html.haml\"\n end\n end",
"def create_view_templates\n unless @check_migration\n template 'views/images.html.erb', File.join(file_path, \"_images.html.erb\")\n template 'views/image.html.erb', File.join(file_path, \"_image.html.erb\")\n template 'views/images_field.html.erb', File.join(file_path, \"_images_field_#{@chunk}.html.erb\")\n else\n unless File.exists?(\"#{file_path}/_images_field_#{@chunk}.html.erb\")\n template 'views/images_field.html.erb', File.join(file_path, \"_images_field_#{@chunk}.html.erb\")\n end\n end\n end",
"def initialize_template(record)\n source = record.body || \"\"\n virtual_path = \"pages/#{I18n.locale}_#{record.name}_#{record.permalink}\"\n handler = ActionView::Template.registered_template_handler('erb')\n details = {\n :format => Mime['html'],\n :updated_at => record.updated_at,\n :virtual_path => virtual_path\n }\n ActionView::Template.new(source, \"DbPageTemplate - #{virtual_path}\", handler, details)\n end",
"def template_source\n raise NotImplementedError\n end",
"def extensions_for(template_class); end",
"def extensions_for(template_class); end",
"def template_map\n \n end",
"def use_template(template)\n @template = template\n end",
"def _render_template(options); end",
"def _render_template(options); end",
"def find_template(options)\n if options[:template] && (template_opts, meth = opts[:named_templates][template_name(options)]; meth)\n if template_opts\n options = template_opts.merge(options)\n else\n options = Hash[options]\n end\n\n options[:inline] = send(meth)\n\n super(options)\n else\n super\n end\n end",
"def template\n @template ||= self.class.template\n end",
"def render(*args)\n tpls_file = (@__caller_info__ || __caller_info__).first.first\n self._template_parser.load(tpls_file).parse.each do |template_name, raw_content|\n # no controller name if absolute view path\n ctrl_name = template_name.match(/^\\//) ? nil : self.controller_name\n path = Merb.dir_for(:view) / self._template_location(template_name.gsub(/^\\//,''), nil, ctrl_name)\n file = VirtualFile.new(raw_content, path)\n TEMPLATES[path.to_s] = file\n end\n super\n end",
"def hook_add_templates\n @flavor.class.after_add_templates do |templates, resource_action|\n templates.each do |template|\n actions_taken << \"#{resource_action} template #{template}\"\n end\n end\n end",
"def use_template(template)\n @template = template\n end",
"def template\n @template\n end",
"def add_template(name, *args)\n if args.size == 1 and Template===args[0]\n @templates[name] = args[0]\n else\n @templates[name] = template(*args)\n end\n end",
"def template_page(site); end",
"def add_template(filepath)\n # templates must be strings for ERB\n @template = File.read(filepath)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def set_user_template(opts)\n opts = check_params(opts,[:templates])\n super(opts)\n end",
"def configure_views\n helpers do\n def find_template(views, name, engine, &block)\n _, dir = views.detect { |k,v| engine == Tilt[k] }\n dir ||= views[:default]\n super(dir, name, engine, &block)\n end\n end\n end",
"def template_types_for_view\n\t\ttt = {}\n\t\tif File.exists?(theme_template_path + '/skin.liquid')\n\t\t\ttt[:rooms] = 'Rooms-Templates'\n\t\tend\n\t\tif File.exists?(theme_template_path + '/tickets')\n\t\t\ttt[:events] = 'Events-Templates'\n\t\tend\n\t\tif File.exists?(theme_template_path + '/vouchers')\n tt[:vouchers] = 'Voucher-Templates'\n end\n\t\treturn tt\n\tend",
"def initialize( * )\n\t\tsuper\n\t\t@template = self.load_template\n\tend",
"def find_template(views, name, engine, &block)\n\t\t \t#normal\n\t\t super(views, name, engine, &block)\n\t\t #_layout folder\n\t\t super(Paths.layout_path, name.to_s, engine, &block)\n\t\t end",
"def hook_add_templates\n @flavor.class.before_add_templates do |templates, resource_action|\n if :create == resource_action && fail_on_clobber\n templates.each do |template|\n if File.exist?(destination_path(template))\n fail \"tried to overwrite file #{template}; pass '-a clobber' to override\"\n end\n end\n end\n end\n end",
"def initialize(template_text,options={})\n @renderer_extension_modules=[]\n\n @name=options[:template_name]\n @templates_root_dir= options[:templates_directory]# || \"#{::Rails.root.to_s}/app/views\"\n\n @output_buffer=\"\"\n #unique tag for escaping post and pre processing tags\n @ltag=\"!@@@##$$1212\"\n @rtag=\"!723465hjf3!@#\"\n\n @default_language=options[:default_language] || \"en\"\n\n\n @escape_tags= options[:tags_to_escape] || []\n @runtime_tags= options[:runtime_tags] || []\n\n\n #escape blocks that will be run at view time\n @template_text=template_text.clone\n @escape_tags.each do |etag|\n escape_tag_content( etag,@template_text)\n\n \n end\n\n# raise \"need templates directory\" unless options[:templates_directory]\n\n #escape all normal dynamic blocks for preprocessing\n @template_text=@template_text.gsub(\"<%\",@ltag).gsub(\"%>\",@rtag).gsub(\"<$\",\"<%\").gsub(\"$>\",\"%>\")\n \n #turn the setup block into a proc <## ##> into executable blocks\n @template_text=@template_text.gsub(\"<##\",\"<% set_setup_proc{ \").gsub(\"##>\",\"} %>\")\n\n #turn the key block into a proc <## ##> into executable blocks\n @template_text=@template_text.gsub(\"<!!KEY\",\"<% set_key_proc{ \").gsub(\"!!KEY>\",\"} %>\")\n\n\n @raw_template=compile(@template_text)\n #this hold variations of the template after it has been localized\n #into different languages, but before rendering\n @localized_templates={}\n @setup_proc=nil\n @key_proc=nil\n @render_base=options[:render_base]\n @template_name=options[:template_name]\n #this tag will be used to create non cachable dynamic blocks\n\n\n if options.has_key?(:helpers) && options[:helpers]!=nil\n options[:helpers].each do |helper|\n include helper\n end\n end\n \n end",
"def add_handlers\n template 'templates/dry/app.tt', \"#{name}/app.rb\"\n end",
"def _template\n @template\n end",
"def templates(&block)\n instance_eval(&block)\n end",
"def method_missing(meth, *args, &block)\n if @template.respond_to?(meth)\n @template.send(meth, *args)\n else\n super\n end\n end",
"def method_missing(meth, *args, &block)\n if @template.respond_to?(meth)\n @template.send(meth, *args)\n else\n super\n end\n end",
"def template_files\r\n \t[].concat(@templates)\r\n end",
"def show_template\n self.template\n end",
"def show_template\n self.template\n end",
"def register(template_class, *extensions); end",
"def render_template(context, options); end",
"def initialize_template(record)\n\n end",
"def main_content\n do_include(@template)\n end",
"def with_template(template)\n @template = template\n self\n end",
"def initialize (template); @template = template; end",
"def default_template=(name)\n @default_template = name\n end",
"def new\n @mytemplate = Mytemplate.new\n @categories = Category.all(:order => :priority) \n @subcategories = Subcategory.all(:order => :priority)\n \n render 'admin/mytemplates/new', :layout => false\n end",
"def template_name=(_arg0); end",
"def template_name=(_arg0); end",
"def use_template(klass)\n define_singleton_method(:source_location) { klass.source_location }\n end",
"def template(name,locals={})\n Tilt.new(Dir.glob(\"#{settings.service.templates_dir}/#{name}.*\").first)\n .render(self,locals)\n end",
"def template(template)\n @template = \"#{Aina::TEMPLATES_DIR}/#{template}\" if template\n end",
"def create_default_template_file\n unless self.description.redirection_required?\n self.localizations.each do |page_localization|\n file_path = File.join(Rails.root, \"app\", \"views\" , \"pages\" , \"#{self.view}.#{page_localization.locale.slug}.html.haml\" )\n unless File.exists?(file_path)\n file = File.new(file_path, \"w\")\n\n page_localization.contents.each do |content|\n file.puts(\"= @page.easy_contents(:#{content.section_name})\")\n end\n file.close\n end\n end\n end\n end",
"def template\n @__template\n end",
"def view_template(source, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first || source.sub(/\\.tt$/, '')\n \n source = File.expand_path(source.to_s)\n context = instance_eval('binding')\n \n create_file destination, nil, config do\n content = ERB.new(::File.binread(source), nil, '-', '@output_buffer').result(context)\n content = block.call(content) if block\n content\n end\n end",
"def find_template(views, name, engine, &block)\n I18n.fallbacks[I18n.locale].each { |locale|\n super(views, \"#{name}.#{locale}\", engine, &block) }\n super(views, name, engine, &block)\n end",
"def meta name, opts = {}, &block\n Base.sources.current_load_source.templates.add name, opts, block\n end",
"def target_template()\n @target_template.dup\n end",
"def template\n @template.content\n end",
"def template(value)\n @template = value\n end",
"def template_guide\n @title = \"Template Guide\"\n end",
"def convert_template!\n tag! \"template\" do\n convert_s! \"name?\"\n if @version >= 119\n convert_id!\n end\n\n convert_array! \"subtemplates\" do\n convert_subtemplate!\n end\n\n convert_array! \"children\" do\n convert_uientry_gen2!\n end\n\n out_ofs! \"end of template?\"\n end\n end",
"def template(set_template)\n @template = set_template\n end",
"def find_templates(name, details, prefix, partial)\n raise NotImplementedError\n end",
"def find_template(views, name, engine, &block)\n Array(views).each {|v|super(v, name, engine, &block) }\n end",
"def find_templates(name, prefix, partial, details)\n # checks if the format has a fallback chain\n if @fallback_formats.has_key?(details[:formats].first)\n details = details.dup\n details[:formats] = Array.wrap(@fallback_formats[details[:formats].first]) \n end\n super(name, prefix, partial, details)\n end",
"def template\n Kernel.const_get(template_name.upcase << '_TEMPLATE')\n end",
"def template_path() 'demo/admin/billing.erb' end",
"def initialize\n @templates = Array.new\n end",
"def set_template\n Settings.reload!\n @template = Template.find(params[:id])\n end",
"def render\n case File.extname(@template_file)\n when '.erb'\n render_erb\n else\n render_plain\n end\n end",
"def template(arg=nil)\n set_or_return(:template, arg, :kind_of => String, :required => true)\n end",
"def template(_template_name)\n \"This is a dummy template! <%= dummy %> \\n \"\\\n 'Here is a global value <%= dummy_global %>'\n end"
] |
[
"0.7978485",
"0.7597656",
"0.75656074",
"0.7231371",
"0.7231371",
"0.7231371",
"0.7231371",
"0.7231371",
"0.7231371",
"0.7231371",
"0.706379",
"0.69378155",
"0.6736379",
"0.66987044",
"0.6674104",
"0.6652837",
"0.6651881",
"0.6633436",
"0.6589501",
"0.6589501",
"0.65857697",
"0.6576754",
"0.6573222",
"0.6565836",
"0.65305895",
"0.6521528",
"0.6505981",
"0.6461129",
"0.6426292",
"0.6415849",
"0.63721037",
"0.63388854",
"0.6338475",
"0.6338475",
"0.6335042",
"0.6324694",
"0.6307661",
"0.6307661",
"0.6268586",
"0.626562",
"0.6257253",
"0.6256469",
"0.6256203",
"0.62503195",
"0.6245441",
"0.62128973",
"0.6212061",
"0.61949164",
"0.61949164",
"0.61949164",
"0.61949164",
"0.61949164",
"0.6169823",
"0.6156918",
"0.61385006",
"0.6128123",
"0.6128099",
"0.6119485",
"0.6110943",
"0.6096705",
"0.60938644",
"0.6089809",
"0.60847837",
"0.60847837",
"0.6079614",
"0.60657275",
"0.60657275",
"0.606202",
"0.6050844",
"0.6042074",
"0.6040791",
"0.60324067",
"0.60318494",
"0.60293394",
"0.60139364",
"0.5998642",
"0.5998642",
"0.5992727",
"0.5992181",
"0.5977511",
"0.59760624",
"0.59699184",
"0.59544504",
"0.594993",
"0.5944541",
"0.59444433",
"0.59369093",
"0.5928903",
"0.5914134",
"0.591213",
"0.59099734",
"0.5908417",
"0.5894899",
"0.58924073",
"0.5889265",
"0.58848596",
"0.58821505",
"0.5881559",
"0.587939",
"0.5876546",
"0.58739364"
] |
0.0
|
-1
|
Find the median of two sorted arrays
|
def find_median(arr1, arr2)
# determine index value of median element
median_index = ((arr1.length + arr2.length) / 2.0).round
stitched = []
# merge in order until length of the merged and sorted array is enough to
# calculate the median
while arr1.length > 0 and arr2.length > 0 and stitched.length < median_index
if arr1[0] <= arr2[0]
stitched.push(arr1.shift)
else
stitched.push(arr2.shift)
end
end
puts stitched
# if the stitched array has an even number of elements, then we need to use the last two
# otherwise just return the last element
if stitched.length.even?
return (stitched[-1] + stitched[-2]) / 2.0
else
return stitched[-1]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def median_sorted_arrays_dc(arr1, arr2)\n size = arr1.size\n return -1 if size <= 0\n return (arr1.first+arr2.first)/2 if size == 1\n return ([arr1.first, arr2.first].max + [arr1[1], arr2[1]].min)/2 if size == 2\n pos_med1 = arr1.size/2\n pos_med2 = arr2.size/2\n # If both are equal even though we form a new array merging those two this would still be median of those two\n if arr1[pos_med1] == arr2[pos_med2]\n return arr1[pos_med1]\n elsif arr1[pos_med1] < arr2[pos_med2] # Median will be in right half of A1 and Left half of A2\n median_sorted_arrays_dc(arr1[pos_med1+1..arr1.size-1], arr2[0..pos_med2-1])\n else # Median will be in left half of A1 and right half of A2\n median_sorted_arrays_dc(arr1[0..pos_med1-1], arr2[pos_med2+1..arr2.size-1])\n end\nend",
"def median_sorted_arrays(array1, array2)\n result = []\n median_pos = (array1.size + array2.size)/2\n until array1.empty? || array2.empty?\n if array1.first < array2.first\n result << array1.first\n array1.shift\n else\n result << array2.first\n array2.shift\n end\n end\n result = result + array1 + array2\n return result[median_pos]\nend",
"def find_median_sorted_arrays(nums1, nums2)\n # Find the left most nums in nums1 and nums2\n total = nums1.length + nums2.length\n half = total/2\n \n short, long = nums1, nums2\n \n if nums1.length > nums2.length\n short = nums2\n long = nums1\n end\n \n left, right = 0, short.length - 1\n \n if nums1.length > 0\n median = (0 + nums1.length) / 2\n nums2_leftmost = half - median\n while nums1[median] > nums2[nums2_leftmost + 1]\n median = (0 + nums1.length) / 2\n nums2_leftmost = left_most_values - median\n break if nums2_leftmost > nums2.length\n end\n end\n \n print median\n print nums2_leftmost\n \nend",
"def multi_array_median(*arrays)\n combined = arrays.reduce(:concat).sort\n combined[combined.length / 2]\nend",
"def middle_way(list_1, list_2)\n meds = []\n med_1 = median(list_1)\n med_2 = median(list_2)\n meds[0] = med_1\n meds[1] = med_2\n return meds\nend",
"def find_median()\n if @lo.size > @hi.size\n @lo.peek\n else\n (@lo.peek + @hi.peek)/2.0\n end\n end",
"def median\n sorted = @array.sort\n middle = ((@array.size + 1.0) / 2) - 1 # subscript of middle element of array, with .5 if there are two middle values\n if middle.floor == middle # middle is an integer\n sorted[middle]\n else\n (sorted[middle.floor] + sorted[middle.ceil]) / 2.0\n end\n end",
"def calculate_median(arr)\n arr.sort[arr.length / 2]\nend",
"def median(array)\n sort_array = array.sort\n length = sort_array.length\n \n return(sort_array[(length-1)/2] + sort_array[length/2])/2.0\nend",
"def median(arr)\n\nend",
"def median(array)\n\tif array.include?(Integer)\n\treturn array.inject{|memo, i| memo + i} / array.size\nelse \n return array.sort_by{|x| x}.mid\nend\nend",
"def median(numbers)\n\trange = numbers.sort!\n\tlength = range.length\n\tif length % 2 == 1\n\t\tmiddle = length/2\n\telsif length % 2 == 0\n\t\tmiddle = (range[(length/2) - 1].to_f + range[(length/2)].to_f)/2.0\n\t\treturn middle\n\tend\n\treturn range[middle]\nend",
"def median (array)\n array.sort!\n mediana = array.length.to_f/2\n mediana = mediana % 1 == 0 ? (array[mediana]+array[mediana-1])/2.0 : array[mediana - 0.5]\n\nend",
"def median(array)\n sorted = array.sort\n\n if array.length % 2 != 0\n array[array.length/2]\n else \n ((array[array.length/2] - array[(array.length/2)-2]).to_f / 2) + array[(array.length/2)-2]\n end\nend",
"def median(array)\n\tsorted = array.sort\n\tlength = array.length\n\tmiddle = sorted[length/2]\n\n\tif length.odd?\n\t\tmiddle\n\telse\n\t\t(middle + (middle - 1))/2.0\n\tend\nend",
"def median(array)\n\tarray.sort!\n\tlen = array.length\n\tlen % 2 == 0 ? ( array[(len-1)/2] + array[(len/2)] ) / 2.0 : array[(len/2)]\n\nend",
"def median(values)\n i = (values.size / 2) - 1\n values.sort[i]\n end",
"def median (array)\n\tordered_list = array.sort\n\tif ordered_list.length % 2 == 1\n\t\treturn ordered_list[ordered_list.length/2]\n\telsif ordered_list.length % 2 == 0\n\t\treturn (ordered_list[ordered_list.length/2] + ordered_list[ordered_list.length/2-1])/2.0\n\tend\n\nend",
"def median(array)\n sorted = array.sort\n return sorted[array.length / 2 - 1] if array.length.odd?\n p = array.length / 2 - 1\n Float(mean([sorted[p], sorted[p + 1]]))\nend",
"def median (an_array)\n an_array.sort!\n nums = an_array.length\n\n if nums % 2 != 0\n return an_array[nums / 2]\n else\n return (an_array[nums/2]+an_array[(nums/2)-1])/2.0\n end\nend",
"def median(array)\n\t@array = array\n\t@sort = @array.sort\n\treturn (@sort[(@array.length - 1)/2] + @sort[@array.length / 2]) / 2.0\nend",
"def median(array)\n sorted = array.sort\n len = sorted.length\n (sorted[(len - 1) / 2] + sorted[len / 2]) / 2.0\n end",
"def median(ary)\n mid = ary.length / 2\n sorted = ary.sort\n ary.length.odd? ? sorted[mid] : 0.5 * (sorted[mid] + sorted[mid - 1])\n end",
"def median(array)\n\tarray.sort!\n\tmidVar = (array.length + 1) / 2\n\tif array.length.odd?\n\t\treturn array[midVar - 1]\n\telse\n\t\treturn (array[midVar - 1] + array[midVar])/2.to_f\n\tend\nend",
"def median (array)\n\tarray.sort!\n\tlen = array.length\n\tif len % 2 == 1\n\t\tarray[len/2.0]\n\telse\n\t\t(array[len/2] + array[(len-1)/2])/2.0\n\tend\nend",
"def median(values)\n values.sort![values.size/2-1]\n end",
"def median(array)\n\tarray.sort!\n\tif array.length % 2 == 1\n\t\treturn array[(array.length-1)/2]\n\telse\n\t\tmed1 = array[array.length/2]\n\t\tmed2 = array[(array.length/2)-1]\n\t\treturn (med1+med2)/2.to_f\n\tend\nend",
"def median(array)\n middle = nil\n array.sort!\n if array.length % 2 == 0\n middle = (array[array.length / 2] + array[array.length / 2 - 1]) / 2.0\n else\n middle = array[(array.length - 1) / 2]\n end\nend",
"def median (array)\n\tarray.sort!\n\tif array.length % 2 == 0\n\t\te_middle = array.length / 2\n\t\tmedian = (array[e_middle].to_f + array[e_middle - 1].to_f) / 2\n\telse\n\t\to_middle = (array.length - 1)/2\n\t\tmedian = array[o_middle]\n\tend\nend",
"def median(array)\n sorted = array.sort\n length = array.length\n if length % 2 ==0\n place1 = length/2\n place2 = (length-2)/2\n sum =(sorted[place1] + sorted[place2])\n median = sum/2.0\n else\n place = (length-1)/2\n median = sorted[place]\n end\n return median\n\nend",
"def median(array)\n\tarray = array.sort\n\tif array.size % 2 != 0\n\t\tarray[((array.size/2))]\n\telse\n\t\t(array[(array.size/2)-1] + array[(array.size/2)]) / 2.0\n\tend\nend",
"def median(input_array)\n\tord_arr = input_array.sort\n\tarr_length = input_array.length\n\tif arr_length%2 == 0\n\t\tmid_sum = ord_arr[arr_length/2]+ord_arr[(arr_length/2)-1]\n\t\tmed = mid_sum/2.0\n\telse\n\t\tmed = ord_arr[(arr_length-1)/2]\n\tend\n\tmed\nend",
"def median(array)\n array.sort!\n length = array.length\n if length % 2 == 1\n # odd length, return the middle number\n return array[length / 2]\n else\n # even number, average the two middle numbers\n item1 = array[length / 2 - 1]\n item2 = array[length / 2]\n return mean([item1, item2])\n end\nend",
"def median\n sorted = self.dup.sort\n\n result = 0\n\n middle = length / 2\n if sorted.length.odd?\n return self.take(middle + 1).last\n else\n return (self.drop(middle).first + self.take(middle).last)/2.0\n end\n end",
"def findMedian(arr)\n sortedArray = arr.sort\n length = sortedArray.length\n sortedArray[length/2]\n\n\nend",
"def median(array)\nplace = array.sort\n #ordena el array de min a max\n\n size = place.length\n # te dice el numero de valores que ahi en el array\n #3\n #6\nmedia_parte1 = place[(size - 1)/2] \n #place[1]\n #5\n #place[2]\n #3\n media_parte2 = place[size / 2]\n # place[1]\n #5\n # place[3] \n #4\n media_parte3 = (media_parte1 + media_parte2) / 2.0\n # sumas el valor ( 5 + 5 ) / 2.0\n #5\n # suma el valor ( 3 + 4) / 2.0\n #3.5\nend",
"def median(array)\n\tarray.sort!\n\tx = ((array.length - 1) / 2) \n\ty = (((array.length - 1)/2)+ 1)\n\tif array.length % 2 == 0\n\t\tmed = med.to_f\n\t\tmed = (array[y].to_f + array[x].to_f)\t/ 2.0\n\telse\n\t\tmed = array[x]\n\tend\n\treturn med\nend",
"def median (array)\n\tarray_sorted = array.sort\n\titems = array_sorted.length\n\tif items%2 == 0\n\t\tsum = array_sorted[items/2] + array_sorted[items/2 - 1]\n\t\treturn (sum.to_f/2)\n\telse\n\t\treturn array_sorted[items/2]\n\tend\nend",
"def median(arr, mean_med)\n\tsorted = arr.sort {|a,b| a <=> b}\n\tlength = sorted.length\n\n\tif length % 2 == 1 #odd\n\t\thalf_length = length/2\n\t\tmedian_position = half_length + 0.5\n\t\tmean_med << [median_position]\n\telse\n\t\thalf_length == length/2 #even\n\t\tlow_position = half_length.to_i - 1\n\t\thigh_postion = half_length.to_i + 1\n\t\tmedian = (high_postion + low_position)/2\n\t\tmean_med << median\n\tend\nend",
"def median_finder(integers)\n if integers.count % 2 == 1\n integers.sort[(integers.count/2)]\n else\n [integers.sort[integers.count/2], \n integers.sort[(integers.count/2)-1]].inject(:+).fdiv(2)\n end\n end",
"def median(array)\n middle = nil # defining the future median\n array.sort! # sorting the array. I used a destructive method for this, so that it goes to the if statement\n if array.length % 2 == 0 # if the array has an even amount, we need the average of the middle 2 elements\n middle = (array[array.length / 2] + array[array.length / 2 - 1]) / 2.0 # refer to the table below for a visual\n else\n middle = array[(array.length - 1) / 2] # if it's odd you just take the midle element\n end # don't forget to close your\nend",
"def median_double(i = 0, j = self.size - 1, n1, n2)\n mi1, mi2 = self.index_of_sorted_median(i, j)\n m1, m2 = self[mi1], self[mi2]\n l = j - i + 1 \n if l.even?\n m1_prev = self.prev(mi1)\n m2_next = self.next(mi2)\n case\n when n2 <= m1\n [[n2, m1_prev].compact.max, m1]\n when m1 <= n1 && n2 <= m2\n [n1, n2]\n when n1 <= m1 && m1 <= n2 && n2 <= m2\n [m1, n2]\n when m1 <= n1 && n1 <= m2 && m2 <= n2\n [n1, m2]\n when n1 <= m1 && m2 <= n2\n [m1, m2]\n when m2 <= n1\n [m2, [n1, m2_next].compact.min]\n end\n else\n m, mi = m1, mi1\n m_prev = self.prev(mi)\n m_next = self.next(mi)\n case\n when n1 <= m && m <= n2\n [m, m]\n when n2 <= m\n [[m_prev, n2].compact.max] * 2\n when m <= n1\n [[m_next, n1].compact.min] * 2\n end\n end.reduce(0, &:+) / 2.0\n end",
"def median\n\t\tsorted = self.sort\n\t\tmedian = 0\n\t\tif self.length % 2 == 0\n\t\t\t# we have an even number, average the two middle\n\t\t\tmedian_point_1 = self.length / 2\n\t\t\tmedian_point_2 = ((self.length + 1) / 2.to_f).round(0)\n\t\t\t# subtract 1 because our arrays are 0-based, not 1-based\n\t\t\tmedian_point_1 -= 1\n\t\t\tmedian_point_2 -= 1\n\t\t\tmedian = (sorted[median_point_1] + sorted[median_point_2]) / 2.to_f\n\t\telse\n\t\t\tmedian = sorted[self.length/2]\n\t\tend\n\t\treturn median\n\tend",
"def median(array)\n\tmedian_even = (array[array.count/2].to_f + array[array.count/2 -1].to_f) / 2\n\tmedian_odd = array[array.count/2]\n\tif array.count % 2 == 0\n\t\tmedian_even.to_f\n\telse \n\t\tmedian_odd\n\tend\nend",
"def find_median()\n mid = @array.length / 2\n return @array.length % 2 == 0 ? (@array[mid-1] + @array[mid]) / 2.0 : @array[mid] / 1.0\n end",
"def median(array)\n array_size = array.size\n midpoint = array_size / 2\n\n if array_size.odd?\n median = array[midpoint]\n else\n median = (array[midpoint] + array[midpoint - 1]) / 2.0\n end\n median\nend",
"def calculate_median(values)\n count = values.count\n list_sort = values.sort\n\n # calculate the median position rounding up \n avg_position = (count / 2.0).ceil\n\n # returns the median value or a calculation between the middle 2\n if count.even?\n nice_calculation_median(list_sort[avg_position] + list_sort[avg_position - 1])\n else\n list_sort[avg_position - 1] \n end\n end",
"def median(array)\n new_array = array.sort\n count = new_array.count\n if count % 2 != 0\n puts \"The Median is: #{new_array[count / 2]}\"\n else\n puts \"The Median is: #{(new_array[count / 2] + new_array[(count / 2) - 1] / 2)}\"\n end\nend",
"def median(already_sorted=false)\n return nil if empty?\n a = already_sorted ? self : sort\n m_pos = size / 2\n size % 2 == 1 ? a[m_pos] : (a[m_pos-1] + a[m_pos]).to_f / 2\n end",
"def median(array)\n # mutate the array until the median is right in the\n # middle\n partition(array)\n # return the middle element of the array,\n # aka the median\n array[array.size / 2]\nend",
"def median(data)\n data.sort!\n\n if(data.length % 2 != 0)\n p data[(data.length/2).to_i]\n else\n p ((data[data.length/2] + data[(data.length/2) - 1]).to_f / 2)\n end\nend",
"def median(already_sorted = false)\n return nil if empty?\n\n ret = already_sorted ? self : sort\n m_pos = size / 2 # no to_f!\n size.odd? ? ret[m_pos] : ret[m_pos - 1..m_pos].mean\n end",
"def median(arr = nil)\n arr ||= scores\n return nil if arr.empty?\n arr.sort!\n center = (count = arr.count) / 2\n count % 2 == 1 ? arr[center] : mean(arr[center-1..center])\n end",
"def median(arr)\n arr.sort!\n if arr.length % 2 == 0\n median = (arr[arr.length / 2] + arr[arr.length / 2 - 1]) / 2.0\n return median\n else\n median = arr[arr.length / 2]\n return median\n end\nend",
"def merge_sort(array)\n# base case of array size 1\n return array if array.size == 1\n \n# first half array\n first_half = array[0..((array.size-1)/ 2)]\n \n# second half array\n second_half = array [(((array.size - 1) / 2) + 1)..array.size - 1]\n \n# idk which array is bigger, just make sure that one gets the median, the other gets below or above it\n \n# get the sorted first half by calling the method on the first half \n first_half = merge_sort(first_half)\n second_half = merge_sort(second_half)\n \n# merge the first & second half\n merge(first_half, second_half)\nend",
"def median\n\t\tif !self.numeric?\n\t\t\treturn false\n\t\tend\n\t\tnums = self.sort\n\t\t\n\t\tif nums.length.odd?\n\t\t\treturn nums[(nums.length/2).to_i]\n\t\tend\n\t\treturn (nums[nums.length/2] + nums[nums.length/2 -1]).to_f/2\n\tend",
"def median\n \n arr = self\n if arr.length <1\n return nil\n else\n sorted_array = median_sort(arr)\n if sorted_array.length.even?\n even_working_index = median_middle(sorted_array)\n # select the value of the 2 index\n median = (sorted_array[even_working_index[0]] + sorted_array[even_working_index[1]]) / 2.0\n # p \"its even\"\n # puts\n # p median\n return median\n \n else\n odd_index = median_middle(sorted_array)\n # p \"odd_index_ median\"\n # puts\n # p sorted_array[odd_index]\n return sorted_array[odd_index]\n \n end\n end\n end",
"def median(sorted)\n return sorted[0] if sorted.size == 1\n (sorted[(sorted.size - 1) / 2] + sorted[sorted.size / 2]) / 2.0\n end",
"def median( grades ) \n grades.delete(nil) \n if grades == [] then\n return 0.0\n end \n grades.sort\n grades[ (grades.size / 2) ]\n end",
"def median\n\t\tif self.size == 0\n \t\t \tnil\n \t\telse\n\t\t\tsorted = self.sort\n\t\t\tif sorted.size % 2 == 0\n\t\t\t\t(sorted[sorted.size / 2] + sorted[(sorted.size / 2) - 1]) / 2.0\n\t\t\telse\n\t\t\t\tsorted[sorted.size / 2]\n\t\t\tend\n\t\tend\n\tend",
"def median\n size==0 ? nil : ((0==self.size%2) ? sort[size/2-1,2].mean : sort[self.size/2].to_f)\n end",
"def median(list)\n sorted = list.sort\n #odd list\n if sorted.size % 2 == 1\n return sorted[sorted.size / 2]\n #even list\n else\n return (sorted[sorted.size / 2] + sorted[sorted.size / 2 - 1]) / 2.0\n end\nend",
"def median\n sorted = frequency.sort\n\n if sorted.length.odd?\n value = sorted[sorted.length/2]\n else\n value = (sorted[(sorted.length / 2) - 1] + sorted[sorted.length / 2]) / 2.0\n end\n end",
"def median\n return nil if self.length == 0 \n sorted = self.sort\n length = self.length\n if length % 2 != 0\n return sorted[length/2]\n else\n return (sorted[length/2] + sorted[(length/2) - 1])/2.0\n end\n end",
"def median(already_sorted = false)\n return nil if empty?\n\n sort! unless already_sorted\n m_pos = size / 2 # no to_f!\n size.odd? ? self[m_pos] : self[m_pos - 1..m_pos].mean\n end",
"def median(*list)\n return nil if list.empty?\n\n elements_count = list.count\n\n mid = elements_count / 2\n sorted_list = list.sort\n\n if elements_count.odd?\n sorted_list[mid]\n else\n (sorted_list[mid - 1] + sorted_list[mid]).to_f / 2.0\n end\n end",
"def get_median\n if @lowerhalf.size >= @higherhalf.size\n return @lowerhalf.max\n else\n return @higherhalf.min\n end\nend",
"def find_k(left_nums, left_start, left_end, right_nums, right_start, right_end, k)\n length_l = left_end - left_start + 1\n length_r = right_end - right_start + 1\n\n # force smaller array to be first\n return find_k(right_nums, right_start, right_end, left_nums, left_start, left_end, k) unless length_l <= length_r\n\n # smaller array is empty, get mean of larger array\n return right_nums[right_start + k - 1] unless length_l > 0\n\n # median is the lessor of the two remaining values\n return [right_nums[right_start], left_nums[left_start]].min unless k > 1\n\n\n # preview possible route for left and right median\n new_left_k = left_start + [length_l, k/2].min - 1\n new_right_k = right_start + [length_r, k/2].min - 1\n\n if left_nums[new_left_k] > right_nums[new_right_k]\n find_k(left_nums, left_start, left_end, right_nums, new_right_k + 1, right_end, k - (new_right_k - right_start + 1))\n else\n find_k(left_nums, new_left_k + 1, left_end, right_nums, right_start, right_end, k - (new_left_k - left_start + 1))\n end\n end",
"def median\n\t\tif self.length > 0\n\t\t\tsorted_values = self.digitize.sort\n\t\t\tlength = sorted_values.length\n\t\t\tif length.odd?\n\t\t\t\tsorted_values[length/2]\n\t\t\telse\n\t\t\t\t( sorted_values[length/2] + sorted_values[-1+length/2] ).to_f / 2\n\t\t\tend\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def find_median()\n l = @nums.length\n if l % 2 == 0\n return (@nums[l/2] + @nums[l/2 - 1])/2.0\n else\n return @nums[l/2]\n end\n end",
"def median_index(arr_size)\n (arr_size-1)/2\nend",
"def find_median(arr)\n mid = arr.length / 2\n\n arr.sort_by { |obj| obj[:rating] }[mid][:name]\nend",
"def getMedian(alist)\n # return median of alist\n if alist == []\n return []\n end\n blist = alist.sort\n length = alist.length\n if length % 2 == 1\n # length of list is odd so return middle element\n return blist[( ((length + 1)/2) -1).to_i]\n else\n # length of list is even so compute midpoint\n v1 = blist[(length / 2).to_i]\n v2 = blist[((length / 2)-1).to_i]\n return (v1 + v2) / 2.0\n end\n end",
"def calculation(nums) \n sum = 0\n max = nums[0]\n\n nums.each do |num| # O(n)\n sum += num\n\n if max < num\n max = num\n end\n end\n\n average = sum / nums.length\n\n sorted_nums = nums.sort # O(n log n)\n if sorted_nums.length % 2 == 0\n index_one = (sorted_nums.length / 2) - 1\n index_two = (sorted_nums.length / 2)\n median = (sorted_nums[index_one] + sorted_nums[index_two]) / 2\n else\n index = ((sorted_nums.length / 2) + 1) - 1\n median = sorted_nums[index]\n end\n\n return {max: max, sum: sum, average: average, median: median}\nend",
"def median_maintain(array)\n max_heap = []\n min_heap = []\n if array[0] > array[1]\n max_heap = [array[1]]\n min_heap = [array[0]]\n else\n max_heap = [array[0]]\n min_heap = [array[1]]\n end\n m = [array[0], max_heap[0]]\n (2..array.count - 1).each do |i|\n if array[i] > max_heap[0]\n min_heap << array[i]\n balance_min(min_heap, min_heap.count - 1)\n if min_heap.count > max_heap.count + 1\n max_heap << min_heap[0]\n extract_min(min_heap)\n balance_max(max_heap, max_heap.count - 1)\n end\n else\n max_heap << array[i]\n balance_max(max_heap, max_heap.count - 1)\n if max_heap.count > min_heap.count + 1\n min_heap << max_heap[0]\n extract_max(max_heap)\n balance_min(min_heap, min_heap.count - 1)\n end\n end\n m << if max_heap.count == min_heap.count\n max_heap[0]\n elsif max_heap.count > min_heap.count\n max_heap[0]\n else\n min_heap[0]\n end\n end\n sum = 0\n (0..m.count - 1).each do |i|\n sum += m[i]\n end\n sum % 10_000\nend",
"def better_than_average(arr, points)\n\n a = arr.count\n b = arr.inject(:+)\n median = b/a\n\n if median < points\n return true\n else\n return false\n end\nend",
"def pivot_on_median_of_three(sort_range, ary)\n fidx, midx, lidx = sort_range.first, sort_range.first + sort_range.count/2, sort_range.last\n midx -= 1 if sort_range.count.even?\n f, m, l = ary[fidx], ary[midx], ary[lidx]\n median = fidx if f < [m,l].max and f > [m,l].min\n median = midx if m < [f,l].max and m > [f,l].min\n median = lidx if l < [m,f].max and l > [m,f].min\n median = midx if median.nil? # fidx, midx, lidx are all the same element\n ary[fidx], ary[median] = ary[median], ary[fidx]\n fidx\nend",
"def test_should_calculate_median\n assert_equal 6, TestSet.new(8, 10, 2, 6, 4).median\n assert_equal 4.5, TestSet.new(10, 0, 1, 9, 8, 1).median\n end",
"def median_ceil\n\t\tif self.size == 0\n \t\t \tnil\n \t\telse\n\t\t\tsorted = self.sort\n\t\t\tif sorted.size % 2 == 0\n\t\t\t\tsorted[sorted.size / 2]\n\t\t\telse\n\t\t\t\tsorted[sorted.size / 2]\n\t\t\tend\n\t\tend\n\tend",
"def median_middle(arr)\n \n # p arr\n # puts\n \n even_arr = []\n \n if arr.length.odd?\n # p \"its odd\"\n # puts\n middle_index = (arr.length / 2)\n # p middle_index\n return middle_index\n else\n # p \"its even\"\n # puts\n middle1= (arr.length/2) - 1\n middle2= (arr.length/2)\n even_arr << middle1\n even_arr << middle2\n # p even_arr\n return even_arr\n \n #formula\n #middle_index = (middle1 + middle2) / 2\n end\n \n \n end",
"def find_median(nums)\n len = nums.length\n if len % 2 == 0\n median = (nums[(len)/2] + nums[(len)/2 - 1]).to_f/2\n else\n median = nums[(len)/2].to_f\n end\n\n return median\nend",
"def get_median\r\n # checks if the length of all_donations is even (if) or odd (else)\r\n if @all_donations.length % 2 == 0 then\r\n # finds the middle index of the array\r\n mid = (@all_donations.length / 2)\r\n # calculates the median value as the average of the 2 middle values\r\n median = ((@all_donations[mid] + @all_donations[mid - 1]) / 2)\r\n else\r\n # finds the middle index of the array\r\n mid = (@all_donations.length / 2)\r\n # calculates median value as the middle value (due to index starting at 0 and truncated decimal after division)\r\n median = @all_donations[mid]\r\n end\r\n # rounds the median value\r\n return median.round\r\n end",
"def median(data)\n data = data.sort\n len = data.length\n\n if len % 2 == 1\n return data[len/2]\n else\n return ((data[(len / 2) - 1] + data[len / 2]).to_f) / 2\n end\n end",
"def median\n\t sorted = @input.sort\n\t len = sorted.length\n\t result = (sorted[(len - 1) / 2] + sorted[len / 2]) / 2.0\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": [num, num]}'}, status: 400\n\tend",
"def gimme(input_array)\n sorted_arr = input_array.sort\n median = (sorted_arr.length / 2)\n middle_element_index = 0\n i = 0\n\n input_array.length.times do\n if sorted_arr[median] == input_array[i]\n middle_element_index = i\n end\n i += 1\n end\n\n return middle_element_index\nend",
"def median_budget(movies)\n movie_budgets = movies.collect {|cost| cost[:budget]}\n movie_budgets.sort!\n if movie_budgets.length % 2 != 0\n movie_budgets[movie_budgets.length / 2]\n else\n ((movie_budgets[(movie_budgets.length / 2) - 1]) + (movie_budgets[(movie_budgets.length / 2)])) / 2\n end\nend",
"def find_median()\n return nil if @list.empty?\n \n if @list.size.odd?\n @list[@list.size / 2].to_f\n else\n (@list[@list.size / 2] + @list[@list.size / 2 - 1]) / 2.0\n end\n end",
"def median_floor\n\t\tif self.size == 0\n \t\t \tnil\n \t\telse\n\t\t\tsorted = self.sort\n\t\t\tif sorted.size % 2 == 0\n\t\t\t\tsorted[(sorted.size / 2) - 1]\n\t\t\telse\n\t\t\t\tsorted[sorted.size / 2]\n\t\t\tend\n\t\tend\n\tend",
"def average_median(array)\n center = array.length / 2\n sum = 0\n\n if array.length.even?\n sum = array[center - 1] + array[center]\n return (sum.to_f / 2)\n else\n new_array = array[(center - 1).. (center + 1)]\n new_array.each do |num|\n sum += num\n end\n return ((sum.to_f / 3) * 100).to_i / 100.0\n end\nend",
"def partition(array, start_index = 0, finish_index = (array.size - 1))\n # if there is no subarray to sort, return\n return if start_index >= finish_index\n\n # choose the pivot to be the last element of the array\n pivot = array[finish_index]\n # left and right are going to be indices,\n # left for the element at the left of the pivot,\n # and right for the element at the right of the\n # pivot by the moment the pivot is placed where it should be\n left, right = nil, nil\n\n # iterate from the start index to the finish index\n (start_index...finish_index).each do |i|\n # if the element is less than the pivot value\n if array[i] < pivot\n # if there is a right index\n if right\n # swap the elements at the right index and the\n # current index\n array[right], array[i] = array[i], array[right]\n # the left index is now the right index\n left = right\n # the right index is the next element after itself\n right += 1\n else\n # if there is no right index, left is going to be the\n # current index\n left = i\n end\n else\n # if the element's value is greater than or equal to\n # the pivot's value\n if !right\n # if there is no right index, the right index is\n # the current index\n right = i\n end\n end\n end\n # if there is a right index, swap the pivot with the element at the\n # right index\n array[finish_index], array[right] = array[right], array[finish_index] if right\n # if the median was found, return\n return if array[0...(array.size / 2)].all? {|n| n < array[array.size / 2]}\n # partition the from the start index to the left index if there is a left\n # index\n partition(array, start_index, left) if left\n # partition from right's next index to the finish index if there is a right\n # index\n partition(array, right + 1, finish_index) if right\nend",
"def median\n percentile(50)\n end",
"def combine(a, b)\n #Do NOT call .sort\n #no .min, use .first\n # create a results array\n result_array = []\n # counters pointing to the index of the smallest elements in each array\n # check that we have elements to compare\n #return false if a.length != b.length\n until a.empty? || b.empty?\n\n a_min_index = a.first\n b_min_index = b.first\n\n if a_min_index < b_min_index\n result_array << a.shift\n\n else\n result_array << b.shift\n end\n\n # push the smaller element onto the result array\n end\n\n result_array += a if b.empty?\n result_array += b if a.empty?\n\n #if one array has more number than the other, i'll need to comtinue comparing those elements within the array\n return result_array\n # if there are elements left over in a, move them to result\n # if there are elements left over in b, move them to result\nend",
"def combine(a, b)\n\t# create a results array\n\t\n\t# counters pointing to the index of the smallest elements in each array\n\n\t# check that we have elements to compare\n\t\t# push the smaller element onto the result array\n\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\n\nend",
"def median_coverage\n if @coverage_profile.nil? or @coverage_profile.empty?\n raise \"coverage_profile is empty, so cannot compute median\"\n end\n \n sorted = @coverage_profile.sort\n if sorted.length % 2 == 1 #if odd\n return sorted[(sorted.length-1)/2].to_f\n else # else must be even\n middle = sorted.length/2\n return (sorted[middle]+sorted[middle-1]).to_f/2\n end\n end",
"def combine(a, b)\n\t# create a results array\n\tresults = []\n\t# counters pointing to the index of the smallest elements in each array\n\tl = 0\n\tr = 0\n\t# check that we have elements to compare\n\t\t# push the smaller element onto the result array\n\tuntil results.length == a.length + b.length\n\t\tif !a[l].nil? && !b[r].nil?\n\t\t\tif a[l] <= b[r]\n\t\t\t\tresults.push(a[l])\n\t\t\t\tl += 1\n\t\t\telse\n\t\t\t\tresults.push(b[r])\n\t\t\t\tr += 1\n\t\t\tend\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\n\t\telsif !a[l].nil?\n\t\t\tresults.push(a[l])\n\t\t\tl += 1\n\t\telse\n\t\t\tresults.push(b[r])\n\t\t\tr += 1\n\t\tend\n\tend\n\treturn results\nend",
"def combine(a, b)\n\tresults = Array.new\n#check to see if there is only one element left\n\n#should this be a case statement?\n\tif a.first >= b.first\n\t\tresults.push(b.first)\n\t\tb.drop(first)\n\telsif b.first >= a.first\n\t\tresults.push(a.first)\n\t\ta.drop(first)\n\telsif b == []\t&& a != []\n\t\tresults.push(a)\n\telsif a == []\t&& b != []\n\t\tresults.push(b)\n\tend\n\n=======\n\t# create a results array\n\t# counters pointing to the index of the smallest elements in each array\n\t# check that we have elements to compare\n\t\t# push the smaller element onto the result array\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\nend",
"def combine(a, b)\n\t# create a results array\n\tresults = Array.new(a.length + b.length)\n\n\t# counters pointing to the index of the smallest elements in each array\n\tindex_a = 0\n\tindex_b = 0\n\tresults_index = 0\n\n\t# counters pointing to the index of the smallest elements in each array\n\t# check that we have elements to compare\n\twhile results_index < results.length\n\t\t# if there are elements left over in b, move them to result\n\t\tif index_a == a.length\n\t\t\tresults[results_index] = b[index_b]\n\t\t\tindex_b += 1\n\t\t# if there are elements left over in a, move them to result\n\t\telsif index_b == b.length\n\t\t\tresults[results_index] = a[index_a]\n\t\t\tindex_a += 1\n\t\t# push the smaller element onto the result array\n\t\telsif a[index_a] <= b[index_b]\n\t\t\tresults[results_index] = a[index_a]\n\t\t\tindex_a += 1\n\t\telse\n\t\t\tresults[results_index] = b[index_b]\n\t\t\tindex_b += 1\n\t\tend\n\t\tresults_index += 1\n\tend\n\treturn results\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\nend",
"def merge(first_half, second_half)\n \n# empty array\n merged_array = []\n \n# while both halves have elements\n while first_half.size > 0 && second_half.size > 0 do\n \n# i think it's going to compare 0 elements\n if first_half [0] <= second_half[0]\n \n# if the first half 0 element is larger, push it onto the merged array\n# To retrieve and at the same time remove the first item, use shift\n merged_array.push(first_half.shift)\n \n elsif second_half[0] < first_half[0]\n merged_array.push(second_half.shift)\n end\n end\n\n#once only one (sorted) array remains, just add on the rest of that array\n#only one of these loops will ever run\n while first_half.size > 0 do \n merged_array.push(first_half.shift)\n end\n while second_half.size > 0 do \n merged_array.push(second_half.shift)\n end\n\n merged_array\nend",
"def find_intersection(first_arr, second_arr)\n first_index_arr = find_intersection_first(first_arr, second_arr)\n second_index_arr = find_intersection_reverse(first_arr, second_arr)\n if scale(first_index_arr) < scale(second_index_arr)\n first_index_arr\n elsif scale(second_index_arr) < scale(first_index_arr)\n second_index_arr\n else\n first_index_arr\n end\n end",
"def function_a(av)\n#code\n\ti = 0\n\tarray = []\n\twhile i < av.size\n\t\tarray << av[i].to_i\n\t\ti += 1\n\tend\n\tpa = array.sort\n\trange = pa[pa.size - 1] - pa[0]\n\tx = 0\n\ti = 0\n\twhile i < pa.size\n\t\tx += pa[i].to_i\n\t\ti += 1\n\tend\n\tif pa.size % 2 == 1\n\t\tmedian = pa[pa.size / 2]\n\telse\n\t\tmedian = (pa[pa.size / 2].to_f + pa[(pa.size - 1) / 2].to_f) / 2\n\tend\n\tmean = (x.to_f / (pa.size).to_f).to_f\n\tmulti = pa.inject(Hash.new(0)) { |x,y| x[y] += 1; x }\n\tmode = pa.max_by { |x| multi[x] }\n\tputs \"Min: \" + pa[0].to_s,\n\t\t\"Max: \" + pa[pa.size - 1].to_s,\n\t\t\"Mean: \" + mean.to_s,\n\t\t\"Median: \" + median.to_s,\n\t\t\"Mode: \" + mode.to_s,\n\t\t\"Range: \" + range.to_s\n\tav.clear\nend"
] |
[
"0.8358604",
"0.83355564",
"0.8266037",
"0.7651489",
"0.70722634",
"0.70464146",
"0.7044583",
"0.7026644",
"0.70022833",
"0.69793415",
"0.697342",
"0.6967107",
"0.69570243",
"0.6911792",
"0.6910163",
"0.69100744",
"0.6909307",
"0.6906097",
"0.69055784",
"0.69042623",
"0.69036555",
"0.68883455",
"0.68843466",
"0.6854248",
"0.6805516",
"0.680293",
"0.67937523",
"0.67827255",
"0.67725116",
"0.6766279",
"0.67552954",
"0.67498285",
"0.67490065",
"0.6744284",
"0.67418015",
"0.67287326",
"0.6710984",
"0.67095107",
"0.67013144",
"0.6687693",
"0.6675334",
"0.6661637",
"0.66376173",
"0.6634454",
"0.6624614",
"0.66075045",
"0.6588122",
"0.6563264",
"0.6560134",
"0.6531789",
"0.64990103",
"0.6492817",
"0.64843816",
"0.6472409",
"0.6447951",
"0.64354926",
"0.6435455",
"0.64091223",
"0.64051557",
"0.6402618",
"0.63998437",
"0.6384713",
"0.6378657",
"0.6356667",
"0.6356502",
"0.63438374",
"0.6328412",
"0.63088804",
"0.6303345",
"0.62978816",
"0.6257448",
"0.62464243",
"0.6238562",
"0.62014335",
"0.6151904",
"0.61299646",
"0.61131114",
"0.6085896",
"0.6080768",
"0.6065114",
"0.6017626",
"0.6012464",
"0.60123235",
"0.5990963",
"0.59675664",
"0.5935853",
"0.5905042",
"0.58950365",
"0.58882904",
"0.58880544",
"0.5715113",
"0.56547266",
"0.559337",
"0.55668",
"0.5532583",
"0.5526271",
"0.55131906",
"0.548056",
"0.54700273",
"0.54419225"
] |
0.8347991
|
1
|
if it is not a mti_class do what you do else let the primary shard do the saving come back and cleanup
|
def create
return super unless mti_class?
shard_wrangler.cascade_save
ActiveRecord::IdentityMap.add(self) if ActiveRecord::IdentityMap.enabled?
@new_record = false
self.id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _sync\n # Reset the stash map to ensure that it's reset before the next\n # transaction is being started.\n @_stash_map = nil\n\n db_obj = {\n 'class_id' => @store.class_map.class_to_id(self.class.to_s),\n 'data' => _serialize\n }\n @store.db.put_object(db_obj, @_id)\n end",
"def method_missing(method, *args, &block)\n @klass.connection().current_shard = @shard\n @klass = @klass.send(method, *args, &block)\n return nil if @klass.nil?\n return @klass if @klass.is_a?(ActiveRecord::Base) or @klass.is_a?(Array) or @klass.is_a?(Fixnum)\n return self\n end",
"def delete\n return super unless mti_class?\n shard_wrangler.class.cascade_delete_all(:id => id)\n if ActiveRecord::IdentityMap.enabled? and persisted?\n ActiveRecord::IdentityMap.remove(self)\n end\n @destroyed = true\n freeze\n end",
"def destroy\n return super unless mti_class?\n shard_wrangler.destroy\n if ActiveRecord::IdentityMap.enabled? and persisted?\n ActiveRecord::IdentityMap.remove(self)\n end\n @destroyed = true\n freeze\n end",
"def save\n self.class.persistable\n DB[self.class.name] ||= {}\n DB[self.class.name][name] = self\n Maglev.commit_transaction\n end",
"def restore(data)\n by_persistence_key = {}\n data.each { |t|\n id = t[:_id]\n if id.index('@')\n # non-singleton\n key = id[0..id.index('@')-1]\n tc = @thingClasses[key]\n if tc\n by_persistence_key[id] = instantiate_class(tc)\n else\n puts \"No thing class #{key}.\"\n end\n elsif id.start_with?(\"player\")\n by_persistence_key[id] = instantiate_player(t[:name])\n else\n # singleton\n by_persistence_key[id] = find_singleton(id)\n puts \"did not load #{id}\" unless by_persistence_key[id]\n end\n }\n data.each { |vs|\n id = vs[:_id]\n t = by_persistence_key[id]\n t.restore(vs, by_persistence_key) if t\n }\n # if we didn't have a record of something, tell it has just been created\n @singletons.each { |s|\n s.on_world_create unless by_persistence_key[s.persistence_key]\n }\n end",
"def no_classification_conflict(uploaded_file, obj, to_save)\n if obj.respond_to?(:stix_id)\n original_id = obj.stix_id.include?(Setting.READ_ONLY_EXT) ? obj.stix_id.slice(0, obj.stix_id.length - Setting.READ_ONLY_EXT.length) : obj.stix_id\n end\n\n if obj.respond_to?(:cybox_object_id)\n original_id = obj.cybox_object_id.include?(Setting.READ_ONLY_EXT) ? obj.cybox_object_id.slice(0, obj.cybox_object_id.length - Setting.READ_ONLY_EXT.length) : obj.cybox_object_id\n end\n\n if obj.respond_to?(:guid) && obj.guid.present?\n original_guid = obj.guid.include?(Setting.READ_ONLY_EXT) ? obj.guid.slice(0, obj.guid.length - Setting.READ_ONLY_EXT.length) : obj.guid\n end\n\n to_save.each do |normal|\n if obj.respond_to?(:stix_id)\n if normal.respond_to?(:remote_object_id) && normal.remote_object_id == obj.stix_id\n if normal.class != StixMarking\n normal.remote_object_id = original_id\n end\n elsif normal.respond_to?(:stix_package_id) && normal.stix_package_id == obj.stix_id\n normal.stix_package_id = original_id\n elsif normal.respond_to?(:stix_indicator_id) && normal.stix_indicator_id == obj.stix_id\n normal.stix_indicator_id = original_id\n elsif normal.respond_to?(:course_of_action_id) && normal.course_of_action_id == obj.stix_id\n normal.course_of_action_id = original_id\n elsif normal.respond_to?(:stix_package_stix_id) && normal.stix_package_stix_id == obj.stix_id\n normal.stix_package_stix_id = original_id\n elsif normal.respond_to?(:stix_course_of_action_id) && normal.stix_course_of_action_id == obj.stix_id\n normal.stix_course_of_action_id = original_id\n elsif normal.respond_to?(:stix_exploit_target_id) && normal.stix_exploit_target_id == obj.stix_id\n normal.stix_exploit_target_id = original_id\n elsif normal.respond_to?(:stix_ttp_id) && normal.stix_ttp_id == obj.stix_id\n normal.stix_ttp_id = original_id\n elsif normal.respond_to?(:stix_attack_pattern_id) && normal.stix_attack_pattern_id == obj.stix_id\n normal.stix_attack_pattern_id = original_id\n end\n end\n \n if obj.respond_to?(:guid)\n if normal.respond_to?(:vulnerability_guid) && normal.vulnerability_guid == obj.guid\n normal.vulnerability_guid = original_guid\n elsif normal.respond_to?(:remote_src_object) && normal.remote_src_object_guid == obj.guid\n normal.remote_src_object_guid = original_guid\n elsif normal.respond_to?(:remote_dest_object) && normal.remote_dest_object_guid == obj.guid\n normal.remote_dest_object_guid = original_guid\n elsif normal.respond_to?(:target_guid) && normal.target_guid == obj.guid\n normal.target_guid = original_guid\n end\n end\n\n if obj.respond_to?(:cybox_object_id)\n if normal.respond_to?(:remote_object_id) && normal.remote_object_id == obj.cybox_object_id\n if normal.class != StixMarking\n normal.remote_object_id = original_id\n end\n elsif normal.respond_to?(:cybox_object_id) && normal.cybox_object_id == obj.cybox_object_id\n normal.cybox_object_id = original_id\n elsif normal.respond_to?(:cybox_file_id) && normal.cybox_file_id == obj.cybox_object_id\n normal.cybox_file_id = original_id\n elsif normal.respond_to?(:uri_object_id) && normal.uri_object_id == obj.cybox_object_id\n normal.uri_object_id = original_id\n elsif normal.respond_to?(:cybox_win_reg_key_id) && normal.cybox_win_reg_key_id == obj.cybox_object_id\n normal.cybox_win_reg_key_id = original_id\n end\n end\n\n if normal.class == StixMarking && normal.remote_object_id == obj.guid\n normal.remote_object_id = original_guid\n # set stix_markings stix_id back to normal as well\n normal.stix_id = normal.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.stix_id.slice(0, normal.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.stix_id\n normal.guid = normal.guid.include?(Setting.READ_ONLY_EXT) ? normal.guid.slice(0, normal.guid.length - Setting.READ_ONLY_EXT.length) : normal.guid\n\n # relink isa markings/assertions/tlp/simple\n if normal.isa_assertion_structure\n normal.isa_assertion_structure.stix_marking_id = normal.stix_id\n\n # reset stix_id/guid to normal\n normal.isa_assertion_structure.stix_id = normal.isa_assertion_structure.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.isa_assertion_structure.stix_id.slice(0, normal.isa_assertion_structure.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.isa_assertion_structure.stix_id\n normal.isa_assertion_structure.guid = normal.isa_assertion_structure.guid.include?(Setting.READ_ONLY_EXT) ? normal.isa_assertion_structure.guid.slice(0, normal.isa_assertion_structure.guid.length - Setting.READ_ONLY_EXT.length) : normal.isa_assertion_structure.guid\n\n # relink further sharing/isa privs\n if normal.isa_assertion_structure.isa_privs\n normal.isa_assertion_structure.isa_privs.each do |ip|\n ip.isa_assertion_structure_guid = normal.isa_assertion_structure.guid\n end\n end\n\n if normal.isa_assertion_structure.further_sharings\n normal.isa_assertion_structure.further_sharings.each do |fs|\n fs.isa_assertion_structure_guid = normal.isa_assertion_structure.guid\n end\n end\n end\n if normal.isa_marking_structure\n normal.isa_marking_structure.stix_marking_id = normal.stix_id\n\n # reset stix_id/guid to normal\n normal.isa_marking_structure.stix_id = normal.isa_marking_structure.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.isa_marking_structure.stix_id.slice(0, normal.isa_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.isa_marking_structure.stix_id\n normal.isa_marking_structure.guid = normal.isa_marking_structure.guid.include?(Setting.READ_ONLY_EXT) ? normal.isa_marking_structure.guid.slice(0, normal.isa_marking_structure.guid.length - Setting.READ_ONLY_EXT.length) : normal.isa_marking_structure.guid\n end\n if normal.tlp_marking_structure\n normal.tlp_marking_structure.stix_marking_id = normal.stix_id\n\n # reset stix_id/guid to normal\n normal.tlp_marking_structure.stix_id = normal.tlp_marking_structure.stix_id.slice(0, normal.tlp_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length)\n normal.tlp_marking_structure.guid = normal.tlp_marking_structure.guid.slice(0, normal.tlp_marking_structure.guid.length - Setting.READ_ONLY_EXT.length)\n normal.tlp_marking_structure.stix_id = normal.tlp_marking_structure.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.tlp_marking_structure.stix_id.slice(0, normal.tlp_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.tlp_marking_structure.stix_id\n normal.tlp_marking_structure.guid = normal.tlp_marking_structure.guid.include?(Setting.READ_ONLY_EXT) ? normal.tlp_marking_structure.guid.slice(0, normal.tlp_marking_structure.guid.length - Setting.READ_ONLY_EXT.length) : normal.tlp_marking_structure.guid\n end\n if normal.ais_consent_marking_structure\n normal.ais_consent_marking_structure.stix_marking_id = normal.stix_id\n\n # reset stix_id/guid to normal\n normal.ais_consent_marking_structure.stix_id = normal.ais_consent_marking_structure.stix_id.slice(0, normal.ais_consent_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length)\n normal.ais_consent_marking_structure.guid = normal.ais_consent_marking_structure.guid.slice(0, normal.ais_consent_marking_structure.guid.length - Setting.READ_ONLY_EXT.length)\n normal.ais_consent_marking_structure.stix_id = normal.ais_consent_marking_structure.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.ais_consent_marking_structure.stix_id.slice(0, normal.ais_consent_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.ais_consent_marking_structure.stix_id\n normal.ais_consent_marking_structure.guid = normal.ais_consent_marking_structure.guid.include?(Setting.READ_ONLY_EXT) ? normal.ais_consent_marking_structure.guid.slice(0, normal.ais_consent_marking_structure.guid.length - Setting.READ_ONLY_EXT.length) : normal.ais_consent_marking_structure.guid\n end\n end\n end\n\n if obj.respond_to?(:stix_id)\n obj.stix_id = original_id\n end\n \n if obj.respond_to?(:cybox_object_id)\n # set all the observables/parameter observables back to normal\n obj_observables = to_save.select {|d| d.respond_to?(:remote_object_id) && (d.remote_object_id == obj.cybox_object_id || d.remote_object_id == obj.cybox_object_id + Setting.READ_ONLY_EXT)}\n # you must get observables before resetting id\n # reset the id\n obj.cybox_object_id = obj.cybox_object_id && obj.cybox_object_id.include?(Setting.READ_ONLY_EXT) ? obj.cybox_object_id.slice(0, obj.cybox_object_id.length - Setting.READ_ONLY_EXT.length) : obj.cybox_object_id\n if obj_observables.present?\n obj_observables.each do |o|\n o.cybox_object_id = o.cybox_object_id && o.cybox_object_id.include?(Setting.READ_ONLY_EXT) ? o.cybox_object_id.slice(0, o.cybox_object_id.length - Setting.READ_ONLY_EXT.length) : o.cybox_object_id\n o.remote_object_id = original_id\n end\n end\n\n old_cybox = to_save.select {|o| o.respond_to?(:cybox_object_id) && o.cybox_object_id == obj.cybox_object_id }\n\n # spoof the swap if needed function so we can use it than set the read only back to true\n old_cybox[0] = IngestUtilities.spoof_swap(uploaded_file, old_cybox[0], old_cybox[0].read_only, uploaded_file.read_only, uploaded_file.overwrite, to_save)\n \n # We need both in them because we have a method that removes the one without an id later.\n if old_cybox[0].id != nil\n unless to_save.include?(old_cybox[0])\n to_save << old_cybox[0]\n end\n end\n\n to_save = self.destroy_old_objs(old_cybox[0], to_save)\n end\n\n if obj.respond_to?(:guid) && obj.guid.present?\n obj.guid = original_guid\n end\n\n to_save = self.destroy_old_objs(obj, to_save)\n\n to_save\n end",
"def restore\n restore_class = self.trashable_type.constantize\n \n # Check if we have a type field, if yes, assume single table inheritance and restore the actual class instead of the stored base class\n sti_type = self.trashable_attributes[restore_class.inheritance_column]\n if sti_type\n begin\n restore_class = self.trashable_type.send(:type_name_with_module, sti_type).constantize\n rescue NameError\n # Seems our assumption was wrong and we have no STI\n end\n end\n \n attrs, association_attrs = attributes_and_associations(restore_class, self.trashable_attributes)\n \n record = restore_class.new\n attrs.each_pair do |key, value|\n record.send(\"#{key}=\", value)\n end\n \n association_attrs.each_pair do |association, attribute_values|\n restore_association(record, association, attribute_values)\n end\n \n return record\n end",
"def save(obj)\n if obj.is_a? Wunderlist::List\n return save_list obj\n elsif obj.is_a? Wunderlist::Task\n return save_task obj\n end\n end",
"def _save\n raise NotImplementedError, 'override #_save in a subclass'\n end",
"def serialize\n begin \n ActiveRecord::Base.transaction do \n o = \"#{@obj.class.name.downcase}_id\".to_sym\n if r = IptRecord.find(:first, :conditions => {o => @obj.id }) \n r.destroy \n end\n if i = self.ipt_record\n i.save!\n else\n return false\n end\n end\n rescue\n return false \n end \n true\n end",
"def save_subclass\n subclass.save if subclass_loaded? && subclass.changed?\n end",
"def update_subclass\n return true if @updating_base\n\n begin\n @updating_base = true\n base_save_result = yield\n\n subclass_save_result = true\n subclass_save_result = save_subclass unless base_save_result == false\n\n base_save_result && subclass_save_result\n ensure\n @updating_base = false\n end\n end",
"def post_process_model(model)\n model.mark_synced!\n end",
"def save\n if (not @queued_for_delete.empty?) and @queued_for_write.empty?\n instance_write(:meta, ActiveSupport::Base64.encode64(Marshal.dump({}))) if instance.respond_to?(:\"#{name}_meta=\")\n end\n original_save\n end",
"def silent_save\n if self.class.find(self.id)\n update\n else\n insert\n end\n end",
"def store?; end",
"def persist; end",
"def persist; end",
"def persist; end",
"def make_store_unknown\n self.store_id = nil\n save!\n end",
"def hook_model_klass\n fail 'child class to return a model klass here'\n end",
"def flush_instance\n raise NotImplementedError, 'flush_instance needs to be implemented by child providers'\n end",
"def save\n #see if PID is not yet specified in DC. Note that according the rest of the code, the PID is put in DC when the object is first saved. \n #That means the below expression becomes true only if this is the object is saved first time.\n update_dc_id = get_dc.identifier == \"\"\n \n #Save the object. This generates the PID if this is a new object.\n status = super\n \n dc = get_dc\n if update_dc_id && status\n \n dc.identifier = self.pid\n \n #We need to set up the following field at some point.\n dc.creator = \"TODO\" if dc.creator == \"\"\n dc.created = \"TODO\" if dc.created == \"\"\n \n #Since the DC is updated, let's save the object again.\n status = super \n end\n \n #Return the save status.\n return status\n end",
"def transient?; end",
"def crazy_model_classes\n [:Task, :Subtask, :TaskConnection, :Photo]\nend",
"def chunk_type\n\t\traise Wayground::AbstractClassUsed\n\tend",
"def store(param)\n if (param.is_a? Stakeholder) ^ (param.is_a? User) # Make sure that it's ONLY a user (not stakeholder) \n storeUser(param) \n elsif param.is_a? Task \n storeTask(param) \n elsif param.is_a? Stakeholder \n storeStakeholder(param) \n elsif param.is_a? Project \n storeProject(param)\n else \n puts \"I don't know how to store those objects. [\" + param.class.to_s + \"]\" end\n end",
"def save!\n fail NotImplementedError, \"subclasses must implement this\"\n end",
"def save(*args, &block)\n super\n # begin\n # require 'restclient'\n # server[\"/instances/#{instance_id}\"].put(to_json)\n # rescue Exception => e\n # Metavirt::Log.error \"cloudkit fail:\\n\\t#{e.inspect}\"\n # end\n self\n end",
"def _insert_dataset\n use_server(model.instance_insert_dataset)\n end",
"def save\n if @system_data and (something = @system_data[:client]) and something.respond_to?(:attributes)\n changes = 0\n something.attributes.each do |k, v|\n if self.send(k) != v\n something.send(k + '=', self.send(k))\n changes += 1\n end\n end\n something.save if changes > 0\n else\n raise TaskMapper::Exception.new(\"#{self.class.name}::#{this_method} method must be implemented by the provider\")\n end\n end",
"def persisted?; end",
"def persisted?; end",
"def convert_to(klass)\n #if !self.instance_of?(klass)\n adapted_object = self.adapt_to(klass)\n\n adapted_object.relationships.each_statement do |statement|\n if statement.predicate == \"info:fedora/fedora-system:def/model#hasModel\"\n adapted_object.remove_relationship(:has_model, statement.object)\n #puts statement.object\n end\n end\n\n adapted_object.assert_content_model\n adapted_object.save\n adapted_object\n #end\n\n end",
"def obj_change(obj,klass)\n #raise_if_obj_is_not obj , klass\n session do \n # raise_if_transaction_running\n cmd = klass.to_s.split(\"::\").last.downcase\n transaction do\n self.send(\"#{cmd}_delete\", obj)\n self.send(\"#{cmd}_create\", obj)\n end\n obj_pull obj, klass\n end\n end",
"def save(processed_map=ObjectMap.new) # use that in Reform::AR.\n processed_map[self] = true\n\n pre_save = self.class.pre_save_representer.new(self)\n pre_save.to_hash(:include => pre_save.twin_names, :processed_map => processed_map) # #save on nested Twins.\n\n\n\n # what we do right now\n # call save on all nested twins - how does that work with dependencies (eg Album needs Song id)?\n # extract all ORM attributes\n # write to model\n\n sync_attrs = self.class.save_representer.new(self).to_hash\n # puts \"sync> #{sync_attrs.inspect}\"\n # this is ORM-specific:\n model.update_attributes(sync_attrs) # this also does `album: #<Album>`\n\n # FIXME: sync again, here, or just id?\n self.id = model.id\n end",
"def save!\n no_recursion do\n _sq_around_original_save do\n super if defined?(super)\n end\n\n save_queue.save!\n end\n end",
"def save\n #you're looking to see if theres been anything inserted or updated and\n #based on that you decide how to store the instance\n if persisted?\n update\n #if instance exists ... data inserted will need to 'update'\n else\n insert\n #if instance does not already exist data inserted will have be 'insert'\n end\n end",
"def backup\n BACKUP_MODELS.each do |obj|\n puts \"Preparing to back up #{obj}\"\n self.send(obj.to_sym)\n end \n end",
"def save!\n raise Cooler::InvalidObject unless save\n end",
"def model_class=(_arg0); end",
"def save_timetable_class_timings\n batches = Batch.active.all(:conditions=>[\"batches.start_date <= ? and batches.end_date >= ?\", self.end_date,self.start_date])\n batches.each do |batch|\n if time_table_class_timings.find_all_by_batch_id(batch.id).blank?\n ttct=time_table_class_timings.build(:batch_id => batch.id)\n batch.batch_class_timing_sets.each do |cts|\n ttct.time_table_class_timing_sets.build(:batch_id=>batch.id,:class_timing_set_id=>cts.class_timing_set_id,:weekday_id=>cts.weekday_id)\n end\n end\n end\n end",
"def save\n raise NotImplementedError\n end",
"def safe_reify\n reify\n rescue ActiveRecord::SubclassNotFound\n raise unless monkey_patch_safe_reify?\n\n # https://github.com/paper-trail-gem/paper_trail/blob/1fe26c9e445b0bcb2f7c20a5791ec01003632517/lib/paper_trail/reifier.rb#L132\n def self.object_deserialized # rubocop:disable Lint/NestedMethodDefinition\n super.dup.tap do |hsh|\n hsh['type'] = item_type\n end\n end\n\n retry\n end",
"def pass_through_persist\n super\n end",
"def unmodify_nilclass; end",
"def run\n\t\tsuper\n\n\t begin\n\t\t\tif @object.kind_of?(Device)\n\t\t\t\tif @object.name\n\t\t\t\t\tbegin\n\t\t\t\t\t\tresolved_address = Resolv.new.getaddress(@object.name)\n\t\t\t\t\t\t@object.name = resolved_address\n\t\t\t\t\trescue Exception => e\n\t\t\t\t\t puts e\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\traise \"Error, object has no name to look up! Try a reverse lookup!\"\n\t\t\t\tend\n\n\t\t\t\t## Attach Mail Servers?\n\n\t\t\t\t## Other Records?\n\t\t\t\t\n\t\t\telsif @object.kind_of?(Domain)\n\t\t\t\tbegin\n\t\t\t\t\tif @object.name\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\tresolved_address = Resolv.getaddress(@object.name)\n\t\t\t\t\t\t\th = create_object Device, { :ip_address => resolved_address }\n\t\t\t\t\t\t\th.domains << @object\n\t\t\t\t\t\trescue Exception => e\n\t\t\t\t\t\t puts e\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\traise \"Error, object has no name to look up! Try a reverse lookup!\"\n\t\t\t\t\tend\n\t\t\t\trescue \n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\t\n\t\t\tend\n\t\t\t\n\t\trescue Exception => e\n\t\t\tputs e.to_s\n\t\tend\n\t\t\n\t\n\t\t\n\t\t@object.save!\n nil\n\tend",
"def save(*args, &block)\n _superclass_instance_for_rw = superclass_instance_for_rw\n _subclass_instance_for_rw = subclass_instance_for_rw\n ActiveRecord::Base.transaction do\n _superclass_instance_for_rw.send(:create_or_update)\n _subclass_instance_for_rw.send(\"#{foreign_key_name}=\", _superclass_instance_for_rw.id)\n _subclass_instance_for_rw.send(:create_or_update)\n end\n self.id = _subclass_instance_for_rw.id\n _superclass_instance_for_rw.id.present? and _subclass_instance_for_rw.id.present?\n rescue ActiveRecord::RecordInvalid\n false\n end",
"def destroy_old_objs(obj, to_save)\n if obj.respond_to?(:stix_id) && !obj.stix_id.nil?\n obj_to_destroy = obj.class.find_by_stix_id(obj.stix_id)\n if obj_to_destroy.present?\n # Get rid of old indicator things\n obj_to_destroy.stix_markings.destroy_all\n if obj.class == Indicator\n obj_to_destroy.observables.destroy_all\n obj_to_destroy.indicators_course_of_actions.destroy_all\n obj_to_destroy.confidences.destroy_all\n obj_to_destroy.indicator_ttps.destroy_all\n obj_to_destroy.sightings.destroy_all\n # get rid of old stix package things\n elsif obj.class == StixPackage\n obj_to_destroy.indicators_packages.destroy_all\n obj_to_destroy.exploit_target_packages.destroy_all\n obj_to_destroy.packages_course_of_actions.destroy_all\n obj_to_destroy.contributing_sources.destroy_all\n obj_to_destroy.ttp_packages.destroy_all\n # get rid of old COA things\n elsif obj.class == CourseOfAction\n obj_to_destroy.parameter_observables.destroy_all\n # Exploit Targets \n elsif obj.class == ExploitTarget\n obj_to_destroy.exploit_target_vulnerabilities.destroy_all\n obj_to_destroy.exploit_target_course_of_actions.destroy_all\n # Vulnerabilities dont need anything because we just destroy stix markings\n elsif obj.class == Vulnerability\n elsif obj.class == Ttp\n obj_to_destroy.ttp_attack_patterns.destroy_all\n obj_to_destroy.ttp_exploit_targets.destroy_all\n # Attack Patterns dont need anything because we just destroy stix markings\n elsif obj.class == AttackPattern\n end\n end\n # Get rid of old cybox object things\n elsif obj.respond_to?(:cybox_object_id) && !obj.cybox_object_id.nil?\n obj_to_destroy = obj.class.find_by_cybox_object_id(obj.cybox_object_id)\n if obj_to_destroy.present?\n obj_to_destroy.stix_markings.destroy_all\n end\n end\n\n if obj_to_destroy.present? && obj.id != obj_to_destroy.id\n to_save -= [obj_to_destroy]\n obj_to_destroy.destroy\n end\n\n to_save\n end",
"def save\n requires :ctid\n raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?\n meta_hash = {}\n create_options = {\n 'ctid' => ctid,\n 'ostemplate' => ostemplate,\n 'layout' => layout ,\n 'hostname' => hostname,\n 'name' => name,\n 'ipadd' => ipadd,\n 'diskspace' => diskspace,\n 'private' => private,\n 'root' => root,\n 'local_uid' => local_uid,\n 'local_gid' => local_gid\n }\n data = service.create_server(create_options)\n reload\n end",
"def save_timetable_classtimings_on_split(current_timetable)\n batches = Batch.active.all(:conditions=>[\"batches.start_date <= ? and batches.end_date >= ?\", self.end_date,self.start_date]).collect(&:id)\n current_time_table_class_timings=current_timetable.time_table_class_timings\n current_time_table_class_timings.each do |class_timings|\n current_timetable_class_timing_sets=class_timings.time_table_class_timing_sets\n if batches.include? class_timings.batch_id\n ttct=self.time_table_class_timings.build(:batch_id => class_timings.batch_id)\n current_timetable_class_timing_sets.each do |ttcts|\n ttct.time_table_class_timing_sets.build(:batch_id=>class_timings.batch_id,:class_timing_set_id=>ttcts.class_timing_set_id,:weekday_id=>ttcts.weekday_id)\n end\n end\n end\n end",
"def save\n ActiveRecord::Base.transaction do\n @transaction_class = @module.constantize.const_get(@source_type.capitalize)\n raise \"source type unknown ! '#{@source_type}' \" unless @transaction_class\n @result = @transaction_class.import(@transactions)\n @result[:filtered] = @read_size - @transactions.size\n end\n end",
"def save!\r\n throw \"Update of Tamino XML database failed.\" unless save\r\n end",
"def save\n \n transaction do |transaction|\n \n check_content_type! if self.content_type # Update the content type\n check_categories! if self.categories and not self.categories.empty? # Update the categories\n \n begin \n super # Invokes the super class \n rescue DataMapper::SaveFailureError => error\n p \"Error saving content #{error} #{self.errors.inspect}\"\n raise error \n end\n\n transaction.commit\n\n end\n\n end",
"def move_object(tdataset,identifier)\r\n\tobject_id = nil\r\n\tobject = nil\r\n\tif (find_attribute(identifier).nil?)\r\n\t if (find_fact(identifier).nil?)\r\n\t fail \"Cannot find object id (Most likily you provided wrong identifier)\"\r\n\t else \r\n\t object_id = find_fact(identifier)\r\n\t object = @fact[object_id]\r\n\t end\r\n\telse\r\n\t object_id = find_attribute(identifier)\r\n\t object = @att[object_id]\r\n\tend\r\n\t\r\n\tobject.move(\r\n\t @dataset,\r\n\t GoodData::MdObject.new((GoodData.get find_dataset(tdataset).uri)['dataSet']),\r\n\t @pid\r\n\t)\r\n \r\n end",
"def _insert_dataset\n use_server(model.instance_dataset)\n end",
"def _insert_dataset\n use_server(model.instance_dataset)\n end",
"def create_slave_object\n raise Exception.new(\"Cannot create slave object unless current object is Master\") unless master?\n raise Exception.new(\"Slave object already exists\") if other_object\n raise Exception.new(\"Cannot create slave object until current object is valid\") unless valid? && persisted?\n\n Rollbar.warning \"Sidekiq not ready\" unless Report.sidekiq_ready?\n MultitenantProxyWorker.perform_async(Customer.tenant_name, self.id)\n end",
"def persist\n !!self.class.store.add?(self)\n end",
"def each_model(options = {}, &block)\n WingedCouch::Model.subclasses.each do |klass|\n if options[:raise_exceptions] and not klass.database.exist?\n raise %Q{Database for model #{klass.name} doesn't exist, run rake winged_couch:db:create}\n end\n block.call(klass)\n end\n end",
"def check_model=(klass)\n ActiveSupport::Deprecation.warn(\"HasHeartbeat: check_model method is no longer supported and will be removed in the next version. Use check_db! instead.\")\n @check_model = klass\n check_db!(true)\n end",
"def save\n super save\n end",
"def persist\n \n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save_logic( defer=false, mask_exception = true )\n ensure_id\n self[:_attachments] = attachments.pack unless attachments.empty?\n if defer\n database.add_to_bulk_cache( self )\n else\n # clear any bulk saving left over ...\n database.bulk_save if database.bulk_cache.size > 0\n if mask_exception\n save_now\n else\n save_now( false )\n end \n end \n end",
"def save\n raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?\n copy = self.dup\n copy.pre_save\n\n data = if bare_metal?\n service.create_bare_metal_server(copy.attributes).body\n else\n service.create_vm(copy.attributes).body.first\n end\n\n data.delete(\"bare_metal\")\n merge_attributes(data)\n true\n end",
"def transfer_and_cleanup\n transfer_and_cleanup_with_block do |type|\n if type == :cover_concept\n self.update_column(:cover_concept_image_processed, true)\n end\n\n if type == :stock_cover_image\n self.update_column(:stock_cover_image_processed, true)\n end\n end\n end",
"def migrate_model(pg_model, mongo_model, transform = nil)\n attributes = pg_model.attribute_names\n ActiveRecord::Base.transaction do\n mongo_model.collection.find.batch_size(100).each do |obj|\n pg_attrs = obj.slice(*attributes)\n\n # If a model specific transform is required, do it here\n pg_attrs = transform.call(pg_attrs) if transform.present?\n\n pg_model.create! pg_attrs\n end\n\n if pg_model.count != mongo_model.count\n raise \"PG and Mongo counts are in disagreement; aborting\"\n end\n end\n\n puts \"#{pg_model.count} migrated to pg\"\nend",
"def storage_class\n raise NotImplementedError\n end",
"def post_process_insert\n self.new_record = false\n flag_descendants_persisted\n true\n end",
"def persist!\n return if klass.nil?\n return unless klass.new.respond_to?(:nickname)\n\n persisted_roles = klass.all.inject({}) {|hash, record| hash[record.name.to_sym] = record; hash}\n\n [global_roles, object_roles.values].flatten.map do |role_name|\n if persisted_roles.delete(role_name).nil?\n klass.create(:name => role_name.to_s, :nickname => nicknames[role_name].to_s)\n end\n end\n\n # if we have persisted roles left we delete them\n persisted_roles.values.map(&:destroy)\n end",
"def unload_extra\n log \"Unloading extra baggage\" , Logger::Ultimate\n @mutex.synchronize do\n @ghash.delete_if do |goid, obj|\n if obj.busy?\n log \"#{obj} busy\" , Logger::Ultimate\n false\n elsif obj.is_a? Player or obj.is_a? Mobile\n false\n elsif obj.container.nil? or not self.loaded? obj.container\n puts \"Checking #{obj}\" , Logger::Ultimate\n if obj.can? :inventory\n if obj.inventory.has_any? Player or obj.inventory.has_any? Mobile\n log \"It contains a player or mobile:\" , Logger::Ultimate\n log obj.inventory.find_all('class', Player) , Logger::Ultimate\n log obj.inventory.find_all('class', Mobile) , Logger::Ultimate\n false\n else\n @storage.store_object(obj)\n true\n end\n else\n log \"Saving #{obj}\" , Logger::Ultimate\n @storage.store_object(obj)\n log \"Dropping #{obj}\\nContainer is #{obj.container}\\nNo Inventory\" , Logger::Ultimate\n log \"Saving #{obj}\" , Logger::Ultimate\n true\n end\n else\n puts \"#{obj} isn't a player or a mobile or busy and it has a container\" , Logger::Ultimate\n false\n end\n end\n end\n log \"Baggage unloaded\", Logger::Ultimate\n end",
"def save\n raise NotImplementedError\n end",
"def run\n super\n\n x = Ear::Client::Corpwatch::CorpwatchService.new\n corps = x.search @object.name\n\n # Attach to the first object\n @object.physical_locations << create_object(PhysicalLocation, {\n :address => corps.first.address, \n :state => corps.first.state, \n :country => corps.first.country })\n\n # Save off our raw data\n #@task_run.save_raw_result corps.join(\" \")\n\nend",
"def get_object\n class_name.create_from_database(id)\n end",
"def process(entity)\n success, errors = collection.insert(entity)\n\n persist_entity(entity) if success\n\n result.errors[entity_name] = errors unless success\n\n entity\n end",
"def shard; end",
"def persist_model(model)\n joblib.dump(model, 'model.pkl')\n model = joblib.load('model.pkl')\n return model\nend",
"def save\n self.class.mapper.put(self)\n end",
"def run\n attributes = @adapter.persistence_attributes(self, @attributes)\n\n parents = @adapter.process_belongs_to(self, attributes)\n persisted = persist_object(@meta[:method], attributes)\n @resource.decorate_record(persisted)\n assign_temp_id(persisted, @meta[:temp_id])\n\n associate_parents(persisted, parents)\n\n children = @adapter.process_has_many(self, persisted)\n\n associate_children(persisted, children) unless @meta[:method] == :destroy\n\n post_process(persisted, parents)\n post_process(persisted, children)\n after_graph_persist = -> { @resource.after_graph_persist(persisted, metadata) }\n add_hook(after_graph_persist, :after_graph_persist)\n before_commit = -> { @resource.before_commit(persisted, metadata) }\n add_hook(before_commit, :before_commit)\n after_commit = -> { @resource.after_commit(persisted, metadata) }\n add_hook(after_commit, :after_commit)\n persisted\n end",
"def preprocess_and_save\n process_attrs_before_write(self)\n return self.save()\n end",
"def preprocess_and_save\n process_attrs_before_write(self)\n return self.save()\n end",
"def save!(*args)\n if self.new_record? and UserAction.queue_actions?\n # Remove attached object if it's a new record, it won't marshal correctly\n self.attachable = nil #if !self.attachable.blank? and self.attachable.new_record?\n # Add to in-memory cache\n Cache.arr_push('user_actions', Marshal.dump(self))\n # Trigger in-memory cache to write to disk\n Resque.enqueue(UserAction) if Cache.arr_count('user_actions') > 500\n true\n else\n super\n end\n end",
"def storage_instance; end",
"def save(table = nil)\n # Converts object to hash\n hash = {}\n instance_variables.map { |q| hash[q.to_s.gsub('@', '')] = instance_variable_get(q) }\n\n dataset = select_dataset(table)\n hash['body'] = hash['body'].to_s if hash['body']\n\n if instance_variables.include?(:@id) && id.is_a?(Integer)\n # Object has a id and thereby is only updated\n dataset.where(id: id).update(hash)\n else\n # Object is inserted into database\n DB.transaction do\n hash.delete('id')\n dataset.insert(hash)\n # Retrives the new id\n if self.class.columns.include?(:id)\n id = dataset.limit(1).order(:id).reverse\n instance_variable_set(:@id, id.first[:id])\n end\n end\n end\n end",
"def storage_instance=(_arg0); end",
"def db_instance_class\n data.db_instance_class\n end",
"def save_object\n end",
"def attach(klass)\n # don't attach to non-AR backed models\n # it is the user's responsibility to trigger `Model#netsuite_push` when ActiveRecord isn't used\n return if !defined?(::ActiveRecord) || !klass.ancestors.include?(::ActiveRecord::Base)\n\n if klass.include?(SubListSync)\n klass.after_save { SyncTrigger.sublist_trigger(self) }\n klass.after_destroy { SyncTrigger.sublist_trigger(self) }\n elsif klass.include?(RecordSync)\n\n # during the initial pull we don't want to push changes up\n klass.before_save do\n @netsuite_sync_record_import = self.new_record? && self.netsuite_id.present?\n\n if @netsuite_sync_record_import\n # pull the record down if it has't been pulled yet\n # this is useful when this is triggered by a save on a parent record which has this\n # record as a related record\n\n if !self.netsuite_pulled? && !self.netsuite_async_jobs?\n SyncTrigger.record_pull_trigger(self)\n end\n end\n\n # if false record will not save\n true\n end\n\n klass.after_save do\n # this conditional is implemented as a save hook\n # because the coordination class doesn't know about model persistence state\n\n if @netsuite_sync_record_import\n if !self.netsuite_pulled? && self.netsuite_async_jobs?\n SyncTrigger.record_pull_trigger(self)\n end\n else\n SyncTrigger.record_push_trigger(self)\n end\n\n @netsuite_sync_record_import = false\n end\n end\n\n # TODO think on NetSuiteRails::ListSync\n end",
"def save_instance(instance)\n begin\n @logger.info(\"Saving instance #{instance.name}...\")\n tenant = @identity.create_tenant(instance.tenant_name)\n instance.tenant_id = tenant.id\n instance.account_meta_key = generate_password\n\n cf_service_admin_user = @identity.find_user_by_name(@fog_options[:storage][:hp_access_key])\n @identity.assign_role_to_user_for_tenant(@fog_options[:swift_operator_role_id], cf_service_admin_user, tenant)\n @identity.assign_role_to_user_for_tenant(@fog_options[:admin_reseller_role_id], cf_service_admin_user, tenant)\n\n set_meta_headers_for(instance)\n\n # Don't eat up error messages and provide a backtrace (workaround for flaws in the base class).\n rescue StandardError => e\n @logger.error \"An error occured: #{e.class.name}: #{e.message}\\n#{e.backtrace}\"\n raise e\n end\n\n raise SwiftError.new(SwiftError::SWIFT_SAVE_INSTANCE_FAILED, instance.inspect) unless instance.save\n instance\n end",
"def single_object_db; end",
"def object_class\n @object_class\n end",
"def check_base_and_sync\n self.sanitize_text\n\n if self.is_maverick?\n Rails.logger.info(\"Updating maverick: #{self.id}\")\n self.attributes = self.base_card.attributes.reject{|k,v| [\"id\",\"house\",\"parent_id\",\"uuid\",\"created_at\",\"house_id\",\"is_maverick\"].include?(k)}\n end\n end"
] |
[
"0.5826379",
"0.5673144",
"0.5557971",
"0.55197066",
"0.5501623",
"0.54532266",
"0.54152966",
"0.53763133",
"0.53615886",
"0.53386056",
"0.53035116",
"0.52685183",
"0.52661794",
"0.5264755",
"0.5241011",
"0.52393705",
"0.52325785",
"0.5213133",
"0.5213133",
"0.5213133",
"0.5202687",
"0.5182643",
"0.5176655",
"0.5144267",
"0.5128322",
"0.51265436",
"0.5105147",
"0.51002836",
"0.5082982",
"0.5069945",
"0.5058859",
"0.50546294",
"0.5045046",
"0.5045046",
"0.5035941",
"0.50342375",
"0.50148773",
"0.5012834",
"0.50032496",
"0.4985446",
"0.4985317",
"0.49632245",
"0.49621195",
"0.49608085",
"0.4957115",
"0.49545202",
"0.49544778",
"0.49526027",
"0.49485174",
"0.49476495",
"0.49455887",
"0.4941804",
"0.49275687",
"0.4920134",
"0.49175894",
"0.49134892",
"0.49051386",
"0.49051386",
"0.48967355",
"0.4890929",
"0.48891222",
"0.4886592",
"0.4875218",
"0.48716754",
"0.486953",
"0.486953",
"0.486953",
"0.486953",
"0.486953",
"0.486953",
"0.486953",
"0.48663935",
"0.48564363",
"0.48473406",
"0.48471645",
"0.48464727",
"0.4841801",
"0.48405296",
"0.48360404",
"0.48315006",
"0.4829747",
"0.48286125",
"0.4823435",
"0.4813867",
"0.4810492",
"0.4807666",
"0.48043928",
"0.48028573",
"0.4801792",
"0.47993866",
"0.47973382",
"0.47935387",
"0.47926414",
"0.4791243",
"0.4788717",
"0.4785536",
"0.47839433",
"0.47815973",
"0.47799096",
"0.47784021"
] |
0.6373751
|
0
|
if it is not a mti_class do what you do else let the primary shard do the destruction come back and cleanup
|
def destroy
return super unless mti_class?
shard_wrangler.destroy
if ActiveRecord::IdentityMap.enabled? and persisted?
ActiveRecord::IdentityMap.remove(self)
end
@destroyed = true
freeze
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n return super unless mti_class?\n shard_wrangler.class.cascade_delete_all(:id => id)\n if ActiveRecord::IdentityMap.enabled? and persisted?\n ActiveRecord::IdentityMap.remove(self)\n end\n @destroyed = true\n freeze\n end",
"def finalize()\n # below function is not yet fully functional\n unlock_all_instances()\n end",
"def terminate_instance_if_load_is_low \n if contract?\n PoolParty.message \"Cloud to shrink\"\n shrink_by(1)\n end\n end",
"def _destroy(*)\n fail NotImplementedError\n end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup\n # override and do something appropriate\n end",
"def teardown\n #implement in subclass;\n end",
"def flush_instance\n raise NotImplementedError, 'flush_instance needs to be implemented by child providers'\n end",
"def create\n return super unless mti_class?\n shard_wrangler.cascade_save\n ActiveRecord::IdentityMap.add(self) if ActiveRecord::IdentityMap.enabled?\n @new_record = false\n self.id\n end",
"def method_missing(method, *args, &block)\n @klass.connection().current_shard = @shard\n @klass = @klass.send(method, *args, &block)\n return nil if @klass.nil?\n return @klass if @klass.is_a?(ActiveRecord::Base) or @klass.is_a?(Array) or @klass.is_a?(Fixnum)\n return self\n end",
"def cleanup\n delete!\n return true\n rescue PoolNode::Conflict\n # still in use\n return false\n end",
"def destroy_class ( klass )\n klass = klass.name.to_s if klass.kind_of? Class\n Object.class_exec { remove_const klass } if Object.const_defined? klass\nend",
"def destroy_class ( klass )\n klass = klass.name.to_s if klass.kind_of? Class\n Object.class_exec { remove_const klass } if Object.const_defined? klass\nend",
"def class_delete class_name\n\t\t\t\t@monitor.synchronize do\n\t\t\t\t\tproviders.each{|p| p.class_delete class_name}\n\t\t\t\tend\n\t\t\tend",
"def destroy_children()\n # self.children.each do |c|\n # class_const = Service.class_map[c.service_id]\n # raise NoClassError.new(\"Pas de classe rattachée au service=#{c.service_id}\") if class_const.nil?\n # child = class_const[c.id]\n # child.destroy()\n # end\n end",
"def destroy(obj)\n if obj.is_a? Wunderlist::List\n return destroy_list obj\n elsif obj.is_a? Wunderlist::Task\n return destroy_task obj\n end\n end",
"def clean(classn)\n if classn.is_a?(Array)\n classn.each do |realclassn|\n self.clean(realclassn)\n end\n\n return nil\n end\n\n if @args[:cache] == :weak\n @objects[classn].clean\n elsif @args[:cache] == :none\n return false\n else\n return false if !@objects.key?(classn)\n @objects[classn] = {}\n GC.start\n\n @objects.keys.each do |classn|\n data = @objects[classn]\n classobj = @args[:module].const_get(classn)\n ObjectSpace.each_object(classobj) do |obj|\n begin\n data[obj.id.to_i] = obj\n rescue => e\n if e.message == \"No data on object.\"\n #Object has been unset - skip it.\n next\n end\n\n raise e\n end\n end\n end\n end\n end",
"def cleanup!; end",
"def cleanup!; end",
"def teardown\n with_vsphere_connection do |dc|\n nodes.each do |k,v|\n storage = RSpec.configuration.rs_storage[:nodes][k]\n\n if storage.nil?\n log.info \"No entry for node #{k}, no teardown necessary\"\n next\n end\n\n ssh = storage[:ssh]\n unless ssh.nil? or ssh.closed?\n ssh.close\n end\n\n if destroy\n log.info \"Destroying instance #{k}\"\n vm_name = storage[:vm]\n if vm_name == nil\n log.error \"No vm object for #{k}\"\n next\n end\n\n # Traverse folders to find target folder for new vm's\n vm_folder = dc.vmFolder.traverse(vmconf[:dest_dir], RbVmomi::VIM::Folder)\n raise \"VirtualMachine folder #{vmconf[:dest_dir]} not found\" if vm_folder.nil?\n vm = vm_folder.find(vm_name, RbVmomi::VIM::VirtualMachine)\n raise \"VirtualMachine #{vm_name} not found in #{vmconf[:dest_dir]}\" if vm.nil?\n\n begin\n vm.PowerOffVM_Task.wait_for_completion\n rescue RbVmomi::Fault => e\n log.error \"Fault attempting to power off node #{k}, #{e.message}\"\n ensure\n begin\n vm.Destroy_Task.wait_for_completion\n rescue RbVmomi::Fault => e\n log.error \"Fault attempting to destroy node #{k}, #{e.message}\"\n end\n end\n else\n next\n end\n end\n end\n\n nil\n end",
"def cleanup!\n check_if_finished\n raise \"#{self.class}: instance not prepared before doing any move\" unless @prepared\n raise \"#{self.class}: not all data was iterated over\" unless @finished\n\n case @strategy\n when 'incremental'\n # notinh we need to do\n\n when 'rotate'\n postgres.execute(\"DROP TABLE #{@tmp_table_name}\")\n\n end\n end",
"def clean_up_spanner_objects\n puts \"Cleaning up instances and databases after spanner tests.\"\n $spanner.instances.all.select { |i| i.instance_id.start_with? $spanner_prefix }.each do |instance|\n instance.databases.all.each &:drop\n instance.delete\n end\nrescue => e\n puts \"Error while cleaning up instances and databases after spanner tests.\\n\\n#{e}\"\nend",
"def tear_down; end",
"def nuke\n unless @instance.nil?\n @instance.stop\n @instance = nil\n end\n end",
"def unload_extra\n log \"Unloading extra baggage\" , Logger::Ultimate\n @mutex.synchronize do\n @ghash.delete_if do |goid, obj|\n if obj.busy?\n log \"#{obj} busy\" , Logger::Ultimate\n false\n elsif obj.is_a? Player or obj.is_a? Mobile\n false\n elsif obj.container.nil? or not self.loaded? obj.container\n puts \"Checking #{obj}\" , Logger::Ultimate\n if obj.can? :inventory\n if obj.inventory.has_any? Player or obj.inventory.has_any? Mobile\n log \"It contains a player or mobile:\" , Logger::Ultimate\n log obj.inventory.find_all('class', Player) , Logger::Ultimate\n log obj.inventory.find_all('class', Mobile) , Logger::Ultimate\n false\n else\n @storage.store_object(obj)\n true\n end\n else\n log \"Saving #{obj}\" , Logger::Ultimate\n @storage.store_object(obj)\n log \"Dropping #{obj}\\nContainer is #{obj.container}\\nNo Inventory\" , Logger::Ultimate\n log \"Saving #{obj}\" , Logger::Ultimate\n true\n end\n else\n puts \"#{obj} isn't a player or a mobile or busy and it has a container\" , Logger::Ultimate\n false\n end\n end\n end\n log \"Baggage unloaded\", Logger::Ultimate\n end",
"def delete\n super do\n @members.each do |member|\n Strand.redis.hdel LOOKUP, member.typed_id\n end\n Strand.redis.hdel TOPICS, @id\n end\n end",
"def delete\n super do\n @strands.each do |strand|\n Cluster.redis.hdel LOOKUP, strand.id\n end\n Cluster.redis.hdel TOPICS, @id\n end\n end",
"def unmodify_nilclass; end",
"def cleanup\n super\n end",
"def cleaning(&block)\n Sidekiq::TransactionGuard.testing { super(&block) }\n end",
"def destroy(force = T.unsafe(nil)); end",
"def obj_purge(obj,klass)\n obj_manipulate obj,klass do |man|\n man.in_session do \n parents = find_by_member(obj.name, :find_mode => :exact, :transaction => true)\n transaction do\n parents.each do |par|\n obj_remove par, par.class, obj\n end\n obj_delete obj, obj.class\n end\n end\n end\n end",
"def teardown\n response = Vanagon::Utilities.http_request(\n \"#{@pooler}/vm/#{@target}\",\n \"DELETE\",\n nil,\n { 'X-AUTH-TOKEN' => @token }\n )\n if response and response[\"ok\"]\n Vanagon::Driver.logger.info \"#{@target} has been destroyed\"\n $stderr.puts \"#{@target} has been destroyed\"\n else\n Vanagon::Driver.logger.info \"#{@target} could not be destroyed\"\n warn \"#{@target} could not be destroyed\"\n end\n rescue Vanagon::Error => e\n Vanagon::Driver.logger.info \"#{@target} could not be destroyed (#{e.message})\"\n warn \"#{@target} could not be destroyed (#{e.message})\"\n end",
"def cleanup\n super\n end",
"def destroy\n if self.class.cfg_name == \"server\"\n begin\n ip = canonicalIP\n MU::Master.removeIPFromSSHKnownHosts(ip) if ip\n if @deploy and @deploy.deployment and\n @deploy.deployment['servers'] and @config['name']\n me = @deploy.deployment['servers'][@config['name']][@mu_name]\n if me\n [\"private_ip_address\", \"public_ip_address\"].each { |field|\n if me[field]\n MU::Master.removeIPFromSSHKnownHosts(me[field])\n end\n }\n if me[\"private_ip_list\"]\n me[\"private_ip_list\"].each { |private_ip|\n MU::Master.removeIPFromSSHKnownHosts(private_ip)\n }\n end\n end\n end\n rescue MU::MuError => e\n MU.log e.message, MU::WARN\n end\n end\n if !@cloudobj.nil? and !@cloudobj.groomer.nil?\n @cloudobj.groomer.cleanup\n elsif !@groomer.nil?\n @groomer.cleanup\n end\n if !@deploy.nil?\n if !@cloudobj.nil? and !@config.nil? and !@cloudobj.mu_name.nil?\n @deploy.notify(self.class.cfg_plural, @config['name'], nil, mu_name: @cloudobj.mu_name, remove: true, triggering_node: @cloudobj, delayed_save: @delayed_save)\n elsif !@mu_name.nil?\n @deploy.notify(self.class.cfg_plural, @config['name'], nil, mu_name: @mu_name, remove: true, triggering_node: self, delayed_save: @delayed_save)\n end\n @deploy.removeKitten(self)\n end\n # Make sure that if notify gets called again it won't go returning a\n # bunch of now-bogus metadata.\n @destroyed = true\n if !@cloudobj.nil?\n def @cloudobj.notify\n {}\n end\n else\n def notify\n {}\n end\n end\n end",
"def teardown_cleanup\n [reader, writer].each do |r_con|\n if(r_con && r_con.alive?)\n begin\n r_con.terminate\n rescue Celluloid::Task::TerminatedError\n warn 'Terminated task error when cleaning NSQ connections. Moving on.'\n end\n end\n end\n super\n end",
"def delete_object(druid)\n storage_object = find_storage_object(druid)\n object_pathname = storage_object.object_pathname\n delete_storage(object_pathname)\n\n # TODO: remove any replicas from the replica-cache.\n\n end",
"def teardown\n Process.kill('KILL',@pid)\n end",
"def tear_down\n self.instance.tear_down unless self.instance.nil?\n self.instance = nil\n end",
"def teardown\n @mem.mem_clear\n end",
"def thread_cleanup(th)\n tc = tconf(th)\n tc.connections.each { |conn| close_conn(conn) }\n tc.connections.clear\n tc.stack_size = 0\n tc.dbc = nil\n\n true\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def terminate\n ActiveRecord::Base.transaction do\n begin\n # Remove MissionBased Classes\n # note that we don't need to remove OptionNodes directly since OptionSet takes care of that\n # the order of deletion is also important to avoid foreign key constraints\n relationships_to_delete = [Setting, Report::Report, Condition, QingGroup, Questioning,\n Question, OptionSet, Option, Response,\n Form, Broadcast, Assignment, Sms::Message]\n relationships_to_delete.each{|r| r.mission_pre_delete(self)}\n\n self.reload\n check_associations\n self.delete\n rescue Exception => e\n Rails.logger.error \"We had to rescue from the delete for mission: #{self.id}-#{self.name}. #{e}\"\n raise e\n end\n end\n end",
"def teardown; end",
"def teardown; end",
"def destroy\n if !@cloudobj.nil? and !@cloudobj.groomer.nil?\n @cloudobj.groomer.cleanup\n elsif !@groomer.nil?\n @groomer.cleanup\n end\n if !@deploy.nil?\n if !@cloudobj.nil? and !@config.nil? and !@cloudobj.mu_name.nil?\n @deploy.notify(self.class.cfg_plural, @config['name'], nil, mu_name: @cloudobj.mu_name, remove: true, triggering_node: @cloudobj, delayed_save: @delayed_save)\n elsif !@mu_name.nil?\n @deploy.notify(self.class.cfg_plural, @config['name'], nil, mu_name: @mu_name, remove: true, triggering_node: self, delayed_save: @delayed_save)\n end\n @deploy.removeKitten(self)\n end\n # Make sure that if notify gets called again it won't go returning a\n # bunch of now-bogus metadata.\n @destroyed = true\n if !@cloudobj.nil?\n def @cloudobj.notify\n {}\n end\n else\n def notify\n {}\n end\n end\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def teardown\n evicting_thread.kill\n end",
"def chunk_type\n\t\traise Wayground::AbstractClassUsed\n\tend",
"def destroy\n raise NotImplementedError\n end",
"def cleanup\r\n end",
"def destroy\n object_data.each {|o| ObjectDatum.find_by_guid(o.guid).destroy if o && ObjectDatum.find_by_guid(o.guid)}\n super\n end",
"def desist\n self.class.delete self\n end",
"def shutdown\n transition :shutdown\n kill_actors\n close_comm\n NodeCache.delete @id\n MailboxManager.delete Thread.mailbox\n instance_variables.each { |iv| remove_instance_variable iv }\n end",
"def remove_class(name = T.unsafe(nil)); end",
"def remove_class(name = T.unsafe(nil)); end",
"def destroy_database\n unless defined?(ORD) == 'constant' \n Object.send :const_set, :ORD, ActiveOrient::OrientDB.new( preallocate: false)\n end \n ORD.delete_database database: ActiveOrient.database\n ActiveOrient::Model.allocated_classes = {}\n Object.send :remove_const, :ORD \n Object.send( :remove_const, :DB ) if defined?(DB) == 'constant'\n\nend",
"def destroy_database\n unless defined?(ORD) == 'constant' \n Object.send :const_set, :ORD, ActiveOrient::OrientDB.new( preallocate: false)\n end \n ORD.delete_database database: ActiveOrient.database\n ActiveOrient::Model.allocated_classes = {}\n Object.send :remove_const, :ORD \n Object.send( :remove_const, :DB ) if defined?(DB) == 'constant'\n\nend",
"def restore(data)\n by_persistence_key = {}\n data.each { |t|\n id = t[:_id]\n if id.index('@')\n # non-singleton\n key = id[0..id.index('@')-1]\n tc = @thingClasses[key]\n if tc\n by_persistence_key[id] = instantiate_class(tc)\n else\n puts \"No thing class #{key}.\"\n end\n elsif id.start_with?(\"player\")\n by_persistence_key[id] = instantiate_player(t[:name])\n else\n # singleton\n by_persistence_key[id] = find_singleton(id)\n puts \"did not load #{id}\" unless by_persistence_key[id]\n end\n }\n data.each { |vs|\n id = vs[:_id]\n t = by_persistence_key[id]\n t.restore(vs, by_persistence_key) if t\n }\n # if we didn't have a record of something, tell it has just been created\n @singletons.each { |s|\n s.on_world_create unless by_persistence_key[s.persistence_key]\n }\n end",
"def after_teardown; end",
"def cleanup\n\tend",
"def cleanup\n\tend",
"def teardown\r\n end",
"def before_teardown; end",
"def teardown\n # if necessary\n end",
"def on_cleanup(unit); end",
"def destroy\n puts(\"Tacos are indestructible\")\n end",
"def scrooge_dump_unflag_this\n Thread.current[:scrooge_dumping_objects].delete(object_id)\n end",
"def delete_class o_class\n cl = classname(o_class)\n logger.progname = 'RestDelete#DeleteClass'\n if @classes.include? cl\n begin\n \t response = @res[\"/class/#{@database}/#{cl}\"].delete\n if response.code == 204\n \t logger.info{\"Class #{cl} deleted.\"}\n @classes.delete(cl)\n end\n rescue RestClient::InternalServerError => e\n \t if get_database_classes(requery: true).include?(cl)\n \t logger.error{\"Class #{cl} still present.\"}\n \t logger.error{e.inspect}\n \t false\n \t else\n logger.error{e.inspect}\n \t true\n \t end\n rescue Exception => e\n logger.error{e.message}\n logger.error{e.inspect}\n end\n else\n cl.nil? ? logger.info{\"Class #{o_class} not present.\"} : logger.info{\"Class #{cl} not present.\"}\n end\n end",
"def destroy!; end",
"def thread_cleanup\n # do nothing, i think?\n end",
"def cleanup\n true\nend",
"def destroy\n fail ESP::NotImplementedError\n end",
"def destroy\n fail ESP::NotImplementedError\n end",
"def destroy\n fail ESP::NotImplementedError\n end",
"def destroy\n fail ESP::NotImplementedError\n end",
"def destroy\n fail ESP::NotImplementedError\n end",
"def destroy\n fail ESP::NotImplementedError\n end",
"def destroy\n fail ESP::NotImplementedError\n end",
"def destroy\n fail ESP::NotImplementedError\n end",
"def cleanup\n true\n end",
"def terminate\n @thread.raise Zoidberg::DeadException.new('Instance in terminated state', object_id)\n end",
"def cleanup\n end",
"def cleanup\n end",
"def shutdown\n @container = nil\n end",
"def destroy\n raise NotImplementedError\n end",
"def destroy_eventually\n block = block_given? ? Proc.new : nil\n _self = self\n Parse::Stack::Async.run do\n begin\n result = true\n _self.destroy\n rescue => e\n result = false\n puts \"[DestroyEventually] Failed for object #{_self.parse_class}##{_self.id}: #{e}\"\n ensure\n block.call(result) if block\n block = nil\n _self = nil\n end # begin\n end # do\n end",
"def shutdown\n super\n end",
"def shard; end",
"def define_after_destroy_callback(klass)\n # Clean up *all* leftover translations of this model, only once.\n b = self\n translation_classes = [class_name, *Mobility::Backends::Sequel::KeyValue::Translation.descendants].uniq\n klass.define_method :after_destroy do\n super()\n\n @mobility_after_destroy_translation_classes = [] unless defined?(@mobility_after_destroy_translation_classes)\n (translation_classes - @mobility_after_destroy_translation_classes).each do |translation_class|\n translation_class.where(:\"#{b.belongs_to}_id\" => id, :\"#{b.belongs_to}_type\" => self.class.name).destroy\n end\n @mobility_after_destroy_translation_classes += translation_classes\n end\n end",
"def destroy\n @classroom.destroy\n end",
"def teardown\n\t\t# Do nothing\n\tend"
] |
[
"0.62744975",
"0.55911255",
"0.55807793",
"0.55019563",
"0.5481457",
"0.5481457",
"0.5481457",
"0.5481457",
"0.5479273",
"0.5475279",
"0.5421617",
"0.53866553",
"0.536539",
"0.5353782",
"0.5343694",
"0.5343694",
"0.53373057",
"0.5336828",
"0.5321232",
"0.53058505",
"0.53016067",
"0.53016067",
"0.5299249",
"0.5293203",
"0.5252213",
"0.5241717",
"0.5226233",
"0.5219457",
"0.5219233",
"0.52178335",
"0.5216727",
"0.521247",
"0.5209075",
"0.5198232",
"0.5197839",
"0.51947623",
"0.518904",
"0.5177836",
"0.51777166",
"0.517183",
"0.51702154",
"0.51659995",
"0.51575184",
"0.5155245",
"0.5150376",
"0.5150376",
"0.5150376",
"0.5146712",
"0.5133272",
"0.5133272",
"0.5125015",
"0.511392",
"0.511392",
"0.511392",
"0.511392",
"0.5112203",
"0.50980264",
"0.50648737",
"0.5062344",
"0.50588524",
"0.50580853",
"0.5053076",
"0.5049249",
"0.5049249",
"0.50472075",
"0.50472075",
"0.5041389",
"0.5039221",
"0.503572",
"0.503572",
"0.5030467",
"0.5024291",
"0.50223744",
"0.50122744",
"0.5010968",
"0.50085235",
"0.500045",
"0.4996988",
"0.49960092",
"0.49952936",
"0.49949732",
"0.49949732",
"0.49949732",
"0.49949732",
"0.49949732",
"0.49949732",
"0.49949732",
"0.49949732",
"0.49936205",
"0.49932685",
"0.49904668",
"0.49904668",
"0.49892667",
"0.49881968",
"0.49845606",
"0.49835986",
"0.49775964",
"0.49742275",
"0.49690226",
"0.4957403"
] |
0.6620269
|
0
|
if it is not a mti_class do what you do else let the primary shard do the deletion come back and cleanup
|
def delete
return super unless mti_class?
shard_wrangler.class.cascade_delete_all(:id => id)
if ActiveRecord::IdentityMap.enabled? and persisted?
ActiveRecord::IdentityMap.remove(self)
end
@destroyed = true
freeze
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n return super unless mti_class?\n shard_wrangler.destroy\n if ActiveRecord::IdentityMap.enabled? and persisted?\n ActiveRecord::IdentityMap.remove(self)\n end\n @destroyed = true\n freeze\n end",
"def delete_class o_class\n cl = classname(o_class)\n logger.progname = 'RestDelete#DeleteClass'\n if @classes.include? cl\n begin\n \t response = @res[\"/class/#{@database}/#{cl}\"].delete\n if response.code == 204\n \t logger.info{\"Class #{cl} deleted.\"}\n @classes.delete(cl)\n end\n rescue RestClient::InternalServerError => e\n \t if get_database_classes(requery: true).include?(cl)\n \t logger.error{\"Class #{cl} still present.\"}\n \t logger.error{e.inspect}\n \t false\n \t else\n logger.error{e.inspect}\n \t true\n \t end\n rescue Exception => e\n logger.error{e.message}\n logger.error{e.inspect}\n end\n else\n cl.nil? ? logger.info{\"Class #{o_class} not present.\"} : logger.info{\"Class #{cl} not present.\"}\n end\n end",
"def delete\n super do\n @members.each do |member|\n Strand.redis.hdel LOOKUP, member.typed_id\n end\n Strand.redis.hdel TOPICS, @id\n end\n end",
"def delete_object(druid)\n storage_object = find_storage_object(druid)\n object_pathname = storage_object.object_pathname\n delete_storage(object_pathname)\n\n # TODO: remove any replicas from the replica-cache.\n\n end",
"def delete\n super do\n @strands.each do |strand|\n Cluster.redis.hdel LOOKUP, strand.id\n end\n Cluster.redis.hdel TOPICS, @id\n end\n end",
"def _delete_without_checking\n if sql = (m = model).fast_instance_delete_sql\n sql = sql.dup\n ds = use_server(m.dataset)\n ds.literal_append(sql, pk)\n ds.with_sql_delete(sql)\n else\n _delete_dataset.delete \n end\n end",
"def _delete_without_checking\n if sql = (m = model).fast_instance_delete_sql\n sql = sql.dup\n ds = use_server(m.dataset)\n ds.literal_append(sql, pk)\n ds.with_sql_delete(sql)\n else\n _delete_dataset.delete \n end\n end",
"def class_delete class_name\n\t\t\t\t@monitor.synchronize do\n\t\t\t\t\tproviders.each{|p| p.class_delete class_name}\n\t\t\t\tend\n\t\t\tend",
"def cleanup\n delete!\n return true\n rescue PoolNode::Conflict\n # still in use\n return false\n end",
"def obj_purge(obj,klass)\n obj_manipulate obj,klass do |man|\n man.in_session do \n parents = find_by_member(obj.name, :find_mode => :exact, :transaction => true)\n transaction do\n parents.each do |par|\n obj_remove par, par.class, obj\n end\n obj_delete obj, obj.class\n end\n end\n end\n end",
"def _destroy(*)\n fail NotImplementedError\n end",
"def after_soft_delete; end",
"def delete(object); end",
"def terminate\n ActiveRecord::Base.transaction do\n begin\n # Remove MissionBased Classes\n # note that we don't need to remove OptionNodes directly since OptionSet takes care of that\n # the order of deletion is also important to avoid foreign key constraints\n relationships_to_delete = [Setting, Report::Report, Condition, QingGroup, Questioning,\n Question, OptionSet, Option, Response,\n Form, Broadcast, Assignment, Sms::Message]\n relationships_to_delete.each{|r| r.mission_pre_delete(self)}\n\n self.reload\n check_associations\n self.delete\n rescue Exception => e\n Rails.logger.error \"We had to rescue from the delete for mission: #{self.id}-#{self.name}. #{e}\"\n raise e\n end\n end\n end",
"def destroy\n self.class.where(:id => self.id).update_all(:is_mirrored => false) if self.is_mirrored?\n super\n end",
"def execute_delete!( activerecord_class )\n collector = @row_collectors[ activerecord_class.table_name ]\n # ASSERT: the only case in which we don't have a collector defined for the specified class\n # should be for the deletion against Swimmer:\n dup_rows = collector ? collector.duplicate_rows : [ @slave_swimmer ]\n\n process_text_log << \"Deleting #{ activerecord_class.name } #{ dup_rows.size } duplicates...\\r\\n\"\n sql_diff_text_log << \"\\r\\n-- Deletes for #{ activerecord_class.name }:\\r\\n\"\n is_ok = true\n begin\n dup_rows.each do |row|\n row.destroy # Build-up SQL-diff:\n sql_diff_text_log << to_sql_delete( row, false ) # no additional comment\n end\n rescue\n process_text_log << \"\\r\\n*** Swimmer Merge: exception caught!\\r\\n\"\n process_text_log << \"*** Phase '#{ activerecord_class.name } DELETE': #{ $!.to_s }\\r\\n\" if $!\n is_ok = false\n end\n is_ok\n end",
"def delete()\n super(VIRTUAL_CLUSTER_METHODS[:delete])\n end",
"def delete_instance(opts)\n opts = check_params(opts,[:class_instance_keys])\n super(opts)\n end",
"def delete\n raise NotImplementedError\n end",
"def delete\n raise NotImplementedError\n end",
"def delete_class(domain, klass)\n ! @backend.delete_class(:domain => domain, :class => klass).nil?\n end",
"def delete\n \n end",
"def delete_from_disk; end",
"def delete\n raise NotImplementedError\n end",
"def delete(obj) ; end",
"def terminate_instance_if_load_is_low \n if contract?\n PoolParty.message \"Cloud to shrink\"\n shrink_by(1)\n end\n end",
"def delete_object(args)\n class_name = args[0]\n next_method_to_call = args[1]\n delete_loc = user_choice_of_object_in_class(class_name)\n try_to_update_database{\n if class_name.delete_record(delete_loc.id)\n puts \"Deleted.\"\n else\n puts \"Not deleted. This object id exists in another table.\"\n end\n }\n call_method(next_method_to_call)\n end",
"def undelete!\n new_type = changes.delete(\"type\")\n new_id = changes.delete(\"id\")\n new_object = change_loggable_type.constantize.new(changes)\n new_object.update_attribute(:id, new_id)\n if new_object.valid?\n new_object.save!\n self.restored_at = Time.now\n self.restored_user_id = Thread.current['user'].try(:id)\n self.save!\n end\n new_object\n end",
"def >> todel\n# puts \"type: #{todel.class}\"\n case todel\n when Array\n# puts \"deleting array #{todel}\"\n todel.each do |ta| \n r = del_single ta\n raise \"This type is not recongnised.\" if r ==false\n end\n else\n r=del_single todel\n raise \"This type is not recongnised.\" if r==false\n end\n self\n end",
"def deindex_instance(instance) #:nodoc:\n last_irns = nil\n last_irvs = instance\n ([instance.class]+instance.class.supertypes_transitive).each do |klass|\n if instance.is_a?(Entity) and last_irns != (n = klass.identifying_role_names)\n # Build new identifying_role_values only when the identifying_role_names change:\n last_irvs = instance.identifying_role_values(klass)\n last_irns = n\n end\n deleted = instances[klass].delete(last_irvs)\n # The RBTree class sometimes returns a different object than what was deleted! Check non-nil:\n raise \"Internal error: deindex #{instance.class} as #{klass} failed\" if deleted == nil\n end\n end",
"def destroy(obj)\n if obj.is_a? Wunderlist::List\n return destroy_list obj\n elsif obj.is_a? Wunderlist::Task\n return destroy_task obj\n end\n end",
"def clean_up_spanner_objects\n puts \"Cleaning up instances and databases after spanner tests.\"\n $spanner.instances.all.select { |i| i.instance_id.start_with? $spanner_prefix }.each do |instance|\n instance.databases.all.each &:drop\n instance.delete\n end\nrescue => e\n puts \"Error while cleaning up instances and databases after spanner tests.\\n\\n#{e}\"\nend",
"def _delete_without_checking\n # SEQUEL5: Remove\n if use_prepared_statements_for?(:delete)\n _set_prepared_statement_server(model.send(:prepared_delete)).call(pk_hash)\n else\n super\n end\n end",
"def delete\n self.class.redis_objects.each do |key, obj|\n obj = self.send(key.to_sym)\n if obj.class == Redis::Set || obj.class == Redis::HashKey || obj.class == Redis::List\n delete_key(key)\n else\n obj.delete\n end\n end\n end",
"def inactive_cleanup\n # Finds referenced micropost from user's map and deletes itself\n user = User.find_by(:id => self.user_id)\n user.current_tasks_map = user.current_tasks_map.delete_if {|h| h[\"micropost id\"] == self.id}\n user.save\n\n # Finds and removes all associated Delayed Jobs still lurking in the system\n garbage_jobs = Delayed::Job.where(:owner_type => \"Micropost\", \n :owner_id => self.id\n )\n garbage_jobs.each do |job|\n job.delete\n end\n end",
"def rm(target)\n target.active_record_instance.destroy\n end",
"def cleanup!\n check_if_finished\n raise \"#{self.class}: instance not prepared before doing any move\" unless @prepared\n raise \"#{self.class}: not all data was iterated over\" unless @finished\n\n case @strategy\n when 'incremental'\n # notinh we need to do\n\n when 'rotate'\n postgres.execute(\"DROP TABLE #{@tmp_table_name}\")\n\n end\n end",
"def delete_operations; end",
"def cleaning(&block)\n Sidekiq::TransactionGuard.testing { super(&block) }\n end",
"def check_before_destroy\n\n #check that there aren't documents of the type\n if Content.all({:limit => 1, :offset => 0}).length > 0\n throw :halt\n end\n\n end",
"def create\n return super unless mti_class?\n shard_wrangler.cascade_save\n ActiveRecord::IdentityMap.add(self) if ActiveRecord::IdentityMap.enabled?\n @new_record = false\n self.id\n end",
"def delete\n raise NotImplementedError\n end",
"def delete_job\n raise NotImplementedError\n end",
"def destroy\n self.run_hook :before_destroy\n result = Driver.client[self.class.coll_name].find({'_id' => self._id}).delete_one\n self.run_hook :after_destroy\n\n result ? true : false\n end",
"def destroy\n raise NotImplementedError\n end",
"def delete\n self.class.delete(self.to_id)\n end",
"def delete_topic\n raise NotImplementedError.new\n end",
"def unstash(object)\n true if stashed_items.where(:stashable_id => object.id, :stashable_type => object.class.to_s).first.try(:destroy)\n end",
"def resource_delete klass, resource_name\n\t\t\t\t@monitor.synchronize do\n\t\t\t\t\tproviders.each do |p|\n\t\t\t\t\t\tnext unless p.class_exist?(klass.name)\n\t\t\t\t\t\tp.resource_delete klass.name, resource_name\t\t\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def destroy_children()\n # self.children.each do |c|\n # class_const = Service.class_map[c.service_id]\n # raise NoClassError.new(\"Pas de classe rattachée au service=#{c.service_id}\") if class_const.nil?\n # child = class_const[c.id]\n # child.destroy()\n # end\n end",
"def destroy\n raise NotImplementedError\n end",
"def delete_blocked\n end",
"def delete_snat\n super\n end",
"def destroy\n object_data.each {|o| ObjectDatum.find_by_guid(o.guid).destroy if o && ObjectDatum.find_by_guid(o.guid)}\n super\n end",
"def destroy\n result = nil\n obj = self.inst_strip_braces(self.object)\n if obj\n # first delete the record from viewable list\n result = Rhom::RhomDbAdapter::delete_from_table(Rhom::TABLE_NAME,\n {\"object\"=>obj})\n # now add delete operation\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"update_type\"=>'delete'})\n end\n result\n end",
"def remove(type); end",
"def destroy_old_objs(obj, to_save)\n if obj.respond_to?(:stix_id) && !obj.stix_id.nil?\n obj_to_destroy = obj.class.find_by_stix_id(obj.stix_id)\n if obj_to_destroy.present?\n # Get rid of old indicator things\n obj_to_destroy.stix_markings.destroy_all\n if obj.class == Indicator\n obj_to_destroy.observables.destroy_all\n obj_to_destroy.indicators_course_of_actions.destroy_all\n obj_to_destroy.confidences.destroy_all\n obj_to_destroy.indicator_ttps.destroy_all\n obj_to_destroy.sightings.destroy_all\n # get rid of old stix package things\n elsif obj.class == StixPackage\n obj_to_destroy.indicators_packages.destroy_all\n obj_to_destroy.exploit_target_packages.destroy_all\n obj_to_destroy.packages_course_of_actions.destroy_all\n obj_to_destroy.contributing_sources.destroy_all\n obj_to_destroy.ttp_packages.destroy_all\n # get rid of old COA things\n elsif obj.class == CourseOfAction\n obj_to_destroy.parameter_observables.destroy_all\n # Exploit Targets \n elsif obj.class == ExploitTarget\n obj_to_destroy.exploit_target_vulnerabilities.destroy_all\n obj_to_destroy.exploit_target_course_of_actions.destroy_all\n # Vulnerabilities dont need anything because we just destroy stix markings\n elsif obj.class == Vulnerability\n elsif obj.class == Ttp\n obj_to_destroy.ttp_attack_patterns.destroy_all\n obj_to_destroy.ttp_exploit_targets.destroy_all\n # Attack Patterns dont need anything because we just destroy stix markings\n elsif obj.class == AttackPattern\n end\n end\n # Get rid of old cybox object things\n elsif obj.respond_to?(:cybox_object_id) && !obj.cybox_object_id.nil?\n obj_to_destroy = obj.class.find_by_cybox_object_id(obj.cybox_object_id)\n if obj_to_destroy.present?\n obj_to_destroy.stix_markings.destroy_all\n end\n end\n\n if obj_to_destroy.present? && obj.id != obj_to_destroy.id\n to_save -= [obj_to_destroy]\n obj_to_destroy.destroy\n end\n\n to_save\n end",
"def undelete\n ActiveRecord::Base.transaction do\n @unit.exhume!\n end\n rescue => e\n flash['error'] = \"#{e}\"\n else\n RefreshOpensearchJob.perform_later\n toast!(title: \"Unit undeleted\",\n message: \"The unit \\\"#{@unit.title}\\\" has been undeleted.\")\n ensure\n redirect_to @unit\n end",
"def method_missing(method, *args, &block)\n @klass.connection().current_shard = @shard\n @klass = @klass.send(method, *args, &block)\n return nil if @klass.nil?\n return @klass if @klass.is_a?(ActiveRecord::Base) or @klass.is_a?(Array) or @klass.is_a?(Fixnum)\n return self\n end",
"def _delete\n marked_for_destruction?\n end",
"def delete_data_with_storage_name?\n type == :retired\n end",
"def remove; end",
"def remove; end",
"def remove; end",
"def remove; end",
"def destroy\n @low_type.destroy\n end",
"def destroy\n if self.class.cfg_name == \"server\"\n begin\n ip = canonicalIP\n MU::Master.removeIPFromSSHKnownHosts(ip) if ip\n if @deploy and @deploy.deployment and\n @deploy.deployment['servers'] and @config['name']\n me = @deploy.deployment['servers'][@config['name']][@mu_name]\n if me\n [\"private_ip_address\", \"public_ip_address\"].each { |field|\n if me[field]\n MU::Master.removeIPFromSSHKnownHosts(me[field])\n end\n }\n if me[\"private_ip_list\"]\n me[\"private_ip_list\"].each { |private_ip|\n MU::Master.removeIPFromSSHKnownHosts(private_ip)\n }\n end\n end\n end\n rescue MU::MuError => e\n MU.log e.message, MU::WARN\n end\n end\n if !@cloudobj.nil? and !@cloudobj.groomer.nil?\n @cloudobj.groomer.cleanup\n elsif !@groomer.nil?\n @groomer.cleanup\n end\n if !@deploy.nil?\n if !@cloudobj.nil? and !@config.nil? and !@cloudobj.mu_name.nil?\n @deploy.notify(self.class.cfg_plural, @config['name'], nil, mu_name: @cloudobj.mu_name, remove: true, triggering_node: @cloudobj, delayed_save: @delayed_save)\n elsif !@mu_name.nil?\n @deploy.notify(self.class.cfg_plural, @config['name'], nil, mu_name: @mu_name, remove: true, triggering_node: self, delayed_save: @delayed_save)\n end\n @deploy.removeKitten(self)\n end\n # Make sure that if notify gets called again it won't go returning a\n # bunch of now-bogus metadata.\n @destroyed = true\n if !@cloudobj.nil?\n def @cloudobj.notify\n {}\n end\n else\n def notify\n {}\n end\n end\n end",
"def destroy; delete end",
"def obj_change(obj,klass)\n #raise_if_obj_is_not obj , klass\n session do \n # raise_if_transaction_running\n cmd = klass.to_s.split(\"::\").last.downcase\n transaction do\n self.send(\"#{cmd}_delete\", obj)\n self.send(\"#{cmd}_create\", obj)\n end\n obj_pull obj, klass\n end\n end",
"def unload_extra\n log \"Unloading extra baggage\" , Logger::Ultimate\n @mutex.synchronize do\n @ghash.delete_if do |goid, obj|\n if obj.busy?\n log \"#{obj} busy\" , Logger::Ultimate\n false\n elsif obj.is_a? Player or obj.is_a? Mobile\n false\n elsif obj.container.nil? or not self.loaded? obj.container\n puts \"Checking #{obj}\" , Logger::Ultimate\n if obj.can? :inventory\n if obj.inventory.has_any? Player or obj.inventory.has_any? Mobile\n log \"It contains a player or mobile:\" , Logger::Ultimate\n log obj.inventory.find_all('class', Player) , Logger::Ultimate\n log obj.inventory.find_all('class', Mobile) , Logger::Ultimate\n false\n else\n @storage.store_object(obj)\n true\n end\n else\n log \"Saving #{obj}\" , Logger::Ultimate\n @storage.store_object(obj)\n log \"Dropping #{obj}\\nContainer is #{obj.container}\\nNo Inventory\" , Logger::Ultimate\n log \"Saving #{obj}\" , Logger::Ultimate\n true\n end\n else\n puts \"#{obj} isn't a player or a mobile or busy and it has a container\" , Logger::Ultimate\n false\n end\n end\n end\n log \"Baggage unloaded\", Logger::Ultimate\n end",
"def store_delete\n Store.remove(\n object: 'Ticket::Article',\n o_id: id,\n )\n Store.remove(\n object: 'Ticket::Article::Mail',\n o_id: id,\n )\n end",
"def cleanup\n # override and do something appropriate\n end",
"def delete\n # Figure out the table's name from the object we're calling the method on.\n table_name = self.class.to_s.pluralize.underscore\n CONNECTION.execute(\"DELETE FROM #{table_name} WHERE id = #{@id};\") # need to see if this one will work, if not look up.\n end",
"def destroy\n self.class.delete(id)\n end",
"def before_destroy; raise ActiveRecord::ReadOnlyRecord; end",
"def ensure_deletion_fixes \n # TO DO\n end",
"def destroy_and_delete_associations\n unless service.account.provider_can_use?(:api_as_product)\n reflection = BackgroundDeletion::Reflection.new(:backend_apis)\n ReflectionDestroyer.new(service, reflection, caller_worker_hierarchy).destroy_later\n end\n\n super\n end",
"def destroy!; end",
"def logical_delete\n if is_main?\n resource.status = 'DELETED'\n resource.save\n else\n destroy\n end\n end",
"def internal_delete_object\n if self.transaction_activity.is_confirmed?\n self.errors.add(:generic_errors, \"Transaction sudah di konfirmasi\")\n return self \n end\n \n self.destroy \n end",
"def destroy \n\t\traise 'This feature is not supported'\n\tend",
"def delete\n \n end",
"def delete_instance node_name_or_instance\n @@instances.delete_if do |node|\n (node_name_or_instance.is_a?(Symbol) && node.node_name == node_name_or_instance) ||\n (node_name_or_instance.is_a?(String) && node.node_name == node_name_or_instance) ||\n (node_name_or_instance.is_a?(Base) && node == node_name_or_instance)\n end\n end",
"def delete_stemcell(stemcell_cid)\n @telemetry_manager.monitor('initialize') do\n _init_azure\n end\n with_thread_name(\"delete_stemcell(#{stemcell_cid})\") do\n @telemetry_manager.monitor('delete_stemcell', id: stemcell_cid) do\n if is_light_stemcell_cid?(stemcell_cid)\n @light_stemcell_manager.delete_stemcell(stemcell_cid)\n elsif @use_managed_disks\n @stemcell_manager2.delete_stemcell(stemcell_cid)\n else\n @stemcell_manager.delete_stemcell(stemcell_cid)\n end\n end\n end\n end",
"def destroy_item(klass, name, type_name)\n object = klass.load(name)\n object.destroy\n ui.warn(\"Deleted #{type_name} #{name}\")\n rescue Net::HTTPServerException => e\n error_message = \"#{e.message}. Could not find a #{type_name} named #{name} to delete!\"\n ui.warn(error_message)\n raise CloudExceptions::ServerDeleteError, error_message\n end",
"def destroy\n # Delete all associated records first\n MysqlAdapter.delete \"DELETE FROM #{Record.table_name} WHERE domain_id = #{id}\"\n\n # Then proceed with deletion\n super\n rescue Mysql::Error\n false\n end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def delete!(object)\n raise NotImplementedError\n end",
"def delete\n self.users.each do |id|\n user = User.find_by_id(id)\n next if user.nil?\n user.databases.delete(self._id)\n user.working_db_id = nil if user.working_db == self\n user.save\n end\n super\n end",
"def m_delete\n a = source \"a\"\n sink a.delete(\"b\") # $ hasTaintFlow=a\n sink a.delete_prefix(\"b\") # $ hasTaintFlow=a\n sink a.delete_suffix(\"b\") # $ hasTaintFlow=a\nend",
"def desist\n self.class.delete self\n end"
] |
[
"0.6335179",
"0.5841632",
"0.5833209",
"0.57810926",
"0.5780316",
"0.5668683",
"0.5668683",
"0.56190246",
"0.56106365",
"0.5601296",
"0.5518485",
"0.5473844",
"0.5435063",
"0.5433932",
"0.539326",
"0.5380965",
"0.53754777",
"0.5354353",
"0.5353075",
"0.5353075",
"0.5317528",
"0.53086805",
"0.52834433",
"0.52737504",
"0.5272846",
"0.5264677",
"0.52624273",
"0.5256765",
"0.52477974",
"0.5243505",
"0.52428627",
"0.5237362",
"0.5232227",
"0.52296627",
"0.52281684",
"0.52267545",
"0.5208071",
"0.52020687",
"0.51982355",
"0.5194055",
"0.51814586",
"0.517642",
"0.5174483",
"0.5170239",
"0.51656926",
"0.51654583",
"0.5161802",
"0.5159391",
"0.51556534",
"0.51435584",
"0.5143161",
"0.51378584",
"0.51370627",
"0.5134922",
"0.51193947",
"0.5116782",
"0.51150775",
"0.5114044",
"0.5113803",
"0.5105576",
"0.51037353",
"0.50884014",
"0.50884014",
"0.50884014",
"0.50884014",
"0.5084405",
"0.5082412",
"0.5078524",
"0.50769573",
"0.50768614",
"0.50730085",
"0.5072177",
"0.50695896",
"0.5063014",
"0.50553983",
"0.50517887",
"0.50513446",
"0.5049035",
"0.50470865",
"0.5044885",
"0.5034542",
"0.50340873",
"0.5032846",
"0.50317967",
"0.50252545",
"0.502319",
"0.5019633",
"0.5019633",
"0.5019633",
"0.5019633",
"0.5019633",
"0.5019633",
"0.5019633",
"0.5019633",
"0.5019633",
"0.5019633",
"0.5015463",
"0.5014613",
"0.5013188",
"0.5012647"
] |
0.66031605
|
0
|
multi array ops on ruby arrays with same sizes
|
def multi_array_op(func, *args)
elem = args[0]
if elem.is_a?(Array)
elem.each_with_index.collect do |_item, index|
indexed_args = args.collect { |a| a = a.is_a?(Array) ? a : [a]; a[index] }
multi_array_op(func, *indexed_args)
end
else
func.call(*args)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def double_array(array)\n array + array\nend",
"def double_array(array)\n array*2\nend",
"def mutliplied(array)\nend",
"def double_array(array)\n array.concat(array)\nend",
"def cross_array(*enumerables)\n # return to_a.product(*enumerables.map{|e| e.to_a})\n enumerables.unshift self\n result = [[]]\n while !enumerables.empty?\n t, result = result, []\n b, *enumerables = enumerables\n t.each do |a|\n b.each do |n|\n result << a + [n]\n end\n end\n end\n result\n end",
"def poorly_written_ruby(*arrays)\n \n # create an empty combined array\n combined_array = []\n \n # for each array in the arrays object, add it to the combined array\n arrays.each do |array|\n combined_array += array\n end\n\n return combined_array\nend",
"def vcat(*narrays) ; cat(1, *narrays) end",
"def process_2arrays(array_1, array_2)\n shared = array_1 & array_2\n shared_count = shared.count\n\n array_1_unshared = array_1 - shared\n array_2_unshared = array_2 - shared\n\n count_1 = array_1_unshared.count\n count_2 = array_2_unshared.count\n unshared = array_1_unshared + array_2_unshared\n unshared_count = unshared.count\n\n [].push(shared_count, unshared_count, count_1, count_2)\nend",
"def combined_array(multid_array)\n new_array = Array.new(multid_array.first.count) { |x| Array.new }\n\n multid_array.each do |array|\n array.each_index do |index|\n new_array[index] = new_array[index] + array[index]\n end\n end\n\n return new_array\n end",
"def union(*arrays)\n arrays.flatten\nend",
"def double_array(array)\n # your code here\nend",
"def array_element_mult(array_a, array_b)\n array_a.zip(array_b).map {|x,y| x*y}\n end",
"def merge_arrays( base_array, new_array )\n\t\tmerged_array = []\n\t\tif base_array != nil\n\t\t\tb_dot_n = scalar_product( base_array, new_array )\n\t\t\tcoef = b_dot_n > 0 ? 1 : -1\t\t# choose coefficient that produces most constructive vector sum\n\t\t\tbase_array.each_with_index { |base_item, index| merged_array.push( base_item + coef * new_array[index] ) }\n\t\tend\n\t\treturn merged_array\n\tend",
"def double_array(array)\n\tn = [1, 2, 3]\n\tn * 2\nend",
"def union(*arr)\n final =[] #setting up an array to populate\n #--- Iterate through outer and inner arrays to shovel in single elements\n arr.each do |inner_array|\n inner_array.each do |elem|\n final << elem\n end\n end\n #--- Return a single array with elements\n return final\n end",
"def array(op, len, work) # DK:P297\n\t\t\t\twarn \"array is not implemented\"\n\t\t\tend",
"def double_array(array)\n output_array = []\n\n array.each do |thing|\n output_array << thing * 2\n end\n\n return output_array\nend",
"def multiply_list(array1, array2)\n array1.zip(array2).map { |subarr| subarr.reduce(:*) }\nend",
"def array_of_array_multi(array)\n # YOUR CODE HERE\n multiArr = array.map{ |arr| arr.map{ |num| num * num } }\n p multiArr\n p array\n # array\nend",
"def reduce_to_all_true(source_array)\nend",
"def multiply_list(arr, arr1)\n arr.zip(arr1).map {|a, b| a.send(:*, b)}\nend",
"def multi_dimensional_sum(array)\n array.flatten\nend",
"def multiply_list(arr1, arr2)\n arr1.zip(arr2).map { |pair| pair.reduce(:*) }.flatten\nend",
"def multiply_list(arr1, arr2)\n [arr1, arr2].transpose.map do |pair|\n pair.reduce(:*)\n end\nend",
"def array_concat(array_1, array_2)\n\tmethod = 4\n\tcase method\n\twhen 1\n\t\tarray_1 + array_2 # The easiest way\n\twhen 2\n\t\tarray_1.concat(array_2) # Another easy way\n\twhen 3 # a long way\n\t\tarray_new = []\n \t\tarray_1.each {|element| array_new[array_new.size] = element}\n \t\tarray_2.each {|element| array_new[array_new.size] = element}\n \t\treturn array_new\n \twhen 4 # Showing an array as a range in a for loop\n \t\tindex = 0\n \t\tarray_new = []\n \t\tfor element in array_1\n \t\t\tarray_new[index] = element\n \t\t\tindex += 1\n \t\tend\n \t\tfor element in array_2\n \t\t\tarray_new[index] = element\n \t\t\tindex += 1\n \t\tend\n \t\treturn array_new\n \tend\nend",
"def converted_arrays; end",
"def union(*arrays)\n arrays.inject { |all_elements, arr| all_elements + arr }\nend",
"def double_all array\n array.map { |i| i*2 }\nend",
"def array_concat(array_1, array_2)\n\n\n newArray = Array.new\n counter = 0\n\n (array_1.length).times do |x|\n newArray[counter] = array_1[x]\n counter = counter + 1\n end\n\n (array_2.length).times do |y|\n newArray[counter] = array_2[y]\n counter = counter + 1\n end\n\n newArray\nend",
"def merge_arrays (first, second)\n\nlarge_array = []\n\n 11.times do |i|\n smaller_array = []\n smaller_array << first[i]\n smaller_array << second[i]\n large_array << smaller_array\n end\n return large_array\n\nend",
"def together_slice(*args)\n if_not_contain_array_rails_type_error\n reduce([]) { |ret, list|ret << list.slice(*args) }\n end",
"def productify(array)\n\nend",
"def union(*arr)\n arr.inject {|acc, array| acc + array}\nend",
"def alternate\n return [] if size.zero?\n return [[self[0]]] if size == 1 \n populate_alternate_arrays\n end",
"def union(*array)\n array.flatten\nend",
"def scalarize_single_valued_arrays()\n return self.map do |k,v|\n v = case\n when v.is_a?(::Array) && v.length == 1 then\n v.first\n when v.is_a?(::Hash) then\n v.scalarize_single_valued_arrays\n else\n v\n end\n [k,v]\n end.to_mash\n end",
"def union(*arrys)\n\n united = []\n \n # For each argument passed, push it into a new flattened array\n # that is one dimensional. Making use of implied returns.\n arrys.each {|arg| united.push(arg) }.flatten\n\nend",
"def products_of_all_other_nums(array)\n\n\tresult = Array.new() { [] }",
"def union(*arrays)\n arrays.flatten.inject([]) { |acc, element| acc << element }\nend",
"def multiply_list(arr1, arr2)\n # arr = []\n # arr1.each_with_index { |elem, i| arr << elem * arr2[i] }\n # arr\n arr1.zip(arr2).map { |sub_arr| sub_arr.reduce(:*) }\nend",
"def double_array(arr)\n doubled_arr = arr.map do | element| \n element *2 \n end\n doubled_arr\nend",
"def sum_array(a1,a2)\n\t\ta3_0 = a1[0] + a2[0]\n\t\ta3_1 = a1[1] + a2[1]\n\t\treturn [a3_0, a3_1]\n end",
"def arr_product(arr)\n product = arr.reduce(:*)\n arr.map { |el| product / el }\nend",
"def multiply_list(arr1, arr2)\n # mult_arr = Array.new(arr1.size)\n # mult_arr.map.with_index { |_, i| arr1[i] * arr2[i] }\n\n # one-liner using Array#zip:\n arr1.zip(arr2).map { |arr| arr.reduce(:*) }\nend",
"def product_array(pixel_array_1,pixel_array_2)\n \tpixel_array_sq_img1x2 = []\n \tpixel_array_1.each_with_index do |array_pixel,i|\n \t\tnew_array = []\n \t\tarray_pixel.each_with_index do |number,j|\n \t\t\tnew_array[j] = pixel_array_1[i][j] * pixel_array_2[i][j]\n \t\t\t#pixel_array_sq_img1x2[i][j] = \n \t\tend\n \t\tpixel_array_sq_img1x2[i] = new_array\n \tend\n\n \treturn pixel_array_sq_img1x2\n end",
"def multiply_list(arr1, arr2)\n new_arr = []\n arr1.size.times do |ind|\n new_arr << arr1[ind] * arr2[ind]\n end\n new_arr\nend",
"def array_align (arr, *data)\n arr.zip(*data)\nend",
"def square_each_w_obj(array)\n array.each_with_object([]) { |elem, new_arr| new_arr << elem ** 2 }\nend",
"def array_concat(array_1, array_2)\n array_2.each do |x|\n array_1[array_1.length] = x\n end\n return array_1\nend",
"def multiply_list(arr1, arr2)\n arr1.zip(arr2).map { |arr| arr.inject(:*) }\nend",
"def multiply_list(arr1, arr2)\n arr1.zip(arr2).map{|sub_arr| sub_arr.inject(:*)}\nend",
"def array_addition_calc(array1, array2)\n array1.zip(array2).map &:sum \nend",
"def product_method(array)\n array.reduce(:*)\nend",
"def union(*arrays)\n arrays # () => []\nend",
"def union(*array)\n array.inject { |acc, arr| acc + arr } #accumulator + array\nend",
"def vstack(arrays)\n arys = arrays.map do |a|\n _atleast_2d(cast(a))\n end\n concatenate(arys,axis:0)\n end",
"def array_concat(array_1, array_2)\n # Your code here\n # Initial solution\n=begin\n array_3 = []\n array_1.each do |n| \n array_3.push n\n end\n array_2.each do |m|\n array_3.push m\n end\n return array_3\nend\n=end\n # Refactored solution\n return array_1.concat array_2\nend",
"def array_mix(ary, line=[], rslt=[])\n ary[0].to_a.each_with_index do |v,i|\n array_mix(ary[1,ary.size], (line + [v]), rslt)\n rslt << (line + [v]) if ary.size == 1\n end\n return rslt\n end",
"def array_concat(array_1, array_2)\n\treturn (array_1 << array_2).flatten\nend",
"def array_concat(array_1, array_2)\n array_1.push(*array_2) \nend",
"def array_concat(array_1, array_2)\n\tarray_1 += array_2\nend",
"def array_product_bruteforce(a)\r\n\tprod = Array.new(a.size)\r\n\ti = 0\r\n\r\n\twhile i < a.size\r\n\t\tc = a[0..a.size]\r\n\t\tc.delete_at(i)\r\n\t\tprod[i] = c.inject(:*)\r\n\t\ti += 1\r\n\tend\r\n\treturn prod\r\nend",
"def array_concat(array_1, array_2)\n z = array_1 + array_2\nend",
"def array_concat(array_1, array_2)\n array_1+array_2\nend",
"def multiply_list(arr1, arr2)\n results = []\n arr1.each_with_index do |item, index|\n results << item * arr2[index]\n end\n results\nend",
"def array_concat(array_1, array_2)\n concat_arrays = []\n array_1.each do |x|\n \tconcat_arrays << x\n end\n array_2.each do |x|\n \tconcat_arrays << x\n end\n concat_arrays\nend",
"def sum_arr(arr_1, arr_2)\n [arr_1,arr_2].transpose.map { |el| el.reduce(&:+) }\nend",
"def cross(array2)\n self.inject([]){ |array, first| array2.inject(array) {|array, second| array << [first, second]} } \n end",
"def multiply_list(arr1, arr2)\n result = []\n\n arr1.each_with_index { |_, index| result << (arr1[index] * arr2[index]) }\n\n result\nend",
"def array_concat (*args)\n\t\tfull = Array.new\n\t\targs.each { |item|\n\t\t\tfull << item\n\t\t}\n\n\t\tfull.flatten!\n\t\tfull\n\tend",
"def array_concat(array_1, array_2) \nreturn array_1.concat array_2\nend",
"def array_concat(array_1, array_2)\n cnct_array = array_1\n for i in 0...array_2.length\n cnct_array[cnct_array.length+i] = array_2[i]\n end\n return cnct_array\nend",
"def array_concat(my_array1, my_array2)\n my_array1 + my_array2\nend",
"def array_concat(array_1, array_2)\n newarray = Array.new\n for i in 0..(array_1.length-1)\n newarray[i] = array_1[i]\n end\n for j in 0..(array_2.length-1)\n newarray[array_1.length+j] = array_2[j]\n end\n return newarray\nend",
"def combine(*args)\n if args.all? {|x| x.is_a? Array}\n para = args.shift\n args.each do |x|\n para = para.product(x)\n end\n para.map {|x| x.flatten(1)}\n else\n raise ArgumentError, 'All arguments must be Array'\n end\n end",
"def product(*args)\n args.map! { |x| Rubinius::Type.coerce_to(x, Array, :to_ary) }\n\n # Check the result size will fit in an Array.\n sum = args.inject(size) { |n, x| n * x.size }\n\n if sum > Fixnum::MAX\n raise RangeError, \"product result is too large\"\n end\n\n # TODO rewrite this to not use a tree of Proc objects.\n\n # to get the results in the same order as in MRI, vary the last argument first\n args.reverse!\n\n result = []\n args.push self\n\n outer_lambda = args.inject(result.method(:push)) do |trigger, values|\n lambda do |partial|\n values.each do |val|\n trigger.call(partial.dup << val)\n end\n end\n end\n\n outer_lambda.call([])\n\n result\n end",
"def array_concat(array_1, array_2)\n array_1 + array_2\nend",
"def paralell_array(*enums)\n zip(*enums)\n end",
"def index_arr_multiple_add(arr, index)\n # add any two elements to the arr at the index\n return arr.push(index,arr)\n return arr.push(index,arr)\nend",
"def array_concat(array_1, array_2)\n # Your code here\n array_3=[]\n array_1.each{|element| array_3<<element}\n array_2.each{|element| array_3<<element}\n return array_3\nend",
"def Array(p0) end",
"def multi_dimensional_sum(array)\n array.flatten.sum\nend",
"def multi_dimensional_sum(array)\n array.flatten.sum\nend",
"def hcat(*narrays) ; cat(0, *narrays) end",
"def multiply_list(array_1, array_2)\n result = []\n array_1.size.times do |index|\n result << array_1[index] * array_2[index]\n end\n result\nend",
"def array_concat(array_1, array_2)\n # create new holder of correct length\n ret = []\n # iterate over first array\n array_1.each do |entry|\n #copy contents into holder\n \tret << entry\n end\n # iterate over second array, append to end\n array_2.each do |entry|\n \tret << entry\n end\n return ret\nend",
"def interleave(*arrays)\n return [] if arrays.empty?\n inter_array = []\n\n arrays.max_by(&:length).size.times do |index|\n arrays.each { |array| inter_array << array[index] }\n end\n\n inter_array\nend",
"def hstack(arrays)\n klass = (self==NArray) ? NArray.array_type(arrays) : self\n nd = 0\n arys = arrays.map do |a|\n a = klass.cast(a)\n nd = a.ndim if a.ndim > nd\n a\n end\n dim = (nd >= 2) ? 1 : 0\n concatenate(arys,axis:dim)\n end",
"def zip(*arr)\n (0...arr[0].length).map do |i|\n arr.map {|arr| arr[i]}\n end\nend",
"def multiply_by(array)\n return array.map { |el| el * 3}\nend",
"def array_array(rn, cn, iv = 1)\n Array.new(rn) { Array.new(cn, iv) }\nend",
"def magic_array(arr)\n arr.flatten.sort.uniq.map{|x| x*2}\nend",
"def double_array(input_array)\n \n double_array = []\n \n input_array.each do |number|\n double_array << number *= 2\n end\n return double_array\n\nend",
"def s_unfold(arrays)\n arrays.reduce([]) { |memo, obj|\n memo.concat(obj.is_a?(Array) ? p_unfold(obj) : [[obj]])\n }\n end",
"def array_concat(array_1, array_2)\n\tnew_arr = array_1 + array_2\nend",
"def multi_dimensional_sum(arr)\n arr.flatten.sum\nend",
"def multiply_list(array_1, array_2)\n results = []\n array_1.each_with_index {|num,idx| results << (num * array_2[idx])}\n results\nend",
"def array_subsets(arr)\n return [[]] if arr.empty?\n partial_subset = array_subsets(arr[0..-2])\n addition = partial_subset.map {|ele| ele + [arr[-1]]}\n partial_subset + addition\nend",
"def multi_dimensional_sum(arr)\n return arr.flatten.sum\nend",
"def square_array(array)\n array.map! { |ele| ele ** 2 }\nend"
] |
[
"0.68821985",
"0.66907203",
"0.6639874",
"0.6609849",
"0.6472788",
"0.64336085",
"0.6425901",
"0.6424392",
"0.6404394",
"0.6332263",
"0.63119227",
"0.62647986",
"0.6223592",
"0.6214414",
"0.62041587",
"0.62035066",
"0.6198502",
"0.619283",
"0.6170268",
"0.6161464",
"0.61444324",
"0.6142285",
"0.6135361",
"0.61280483",
"0.612405",
"0.61239505",
"0.6113425",
"0.61034065",
"0.609742",
"0.6077619",
"0.60592306",
"0.6052505",
"0.60362357",
"0.6030554",
"0.6022867",
"0.60196245",
"0.60161203",
"0.6007504",
"0.6005535",
"0.6005358",
"0.5987867",
"0.59798497",
"0.5975021",
"0.5965358",
"0.59434474",
"0.5941769",
"0.5940821",
"0.5919648",
"0.59139013",
"0.5910002",
"0.590333",
"0.5901118",
"0.5900937",
"0.58965415",
"0.58826846",
"0.5877545",
"0.58771837",
"0.5859612",
"0.58592266",
"0.5857199",
"0.58498615",
"0.5848883",
"0.58480024",
"0.58418477",
"0.5834657",
"0.5830739",
"0.5823598",
"0.5813647",
"0.5804388",
"0.57938594",
"0.57923585",
"0.57890993",
"0.57858604",
"0.57854384",
"0.5785236",
"0.57844096",
"0.578115",
"0.57637036",
"0.5763486",
"0.57600826",
"0.57596475",
"0.57591045",
"0.57591045",
"0.5754969",
"0.5754897",
"0.57548213",
"0.5754809",
"0.57521397",
"0.5751407",
"0.5750798",
"0.5748395",
"0.5744466",
"0.57422423",
"0.5742121",
"0.57405597",
"0.57380587",
"0.5737503",
"0.57354516",
"0.5734649",
"0.5727403"
] |
0.69382524
|
0
|
handle 3 tensor math operations
|
def call_3way_vector_op(v_a, v_b, v_c, child_context, &block)
return yield(v_a, v_b, v_c) unless v_a.is_a?(Array)
v_a.each_with_index.collect do |v1, index|
v2 = v_b[index]
v3 = v_c.is_a?(Array) ? v_c[index] : v_c
if v1.is_a?(Array)
call_3way_vector_op(v1, v2, v3, child_context, &block)
else
yield(v1, v2, v3)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def transmogrifier(num1, num2, num3)\n\t(num1 * num2) ** num3\nend",
"def transmogrifier num1,num2,num3\n\t(num1 * num2) ** num3\nend",
"def transmogrifier (num1,num2,num3)\n (num1 * num2)**num3\nend",
"def transmogrifier(num1, num2, num3)\n transmogrified = ((num1*num2) * num3)\n return transmogrified \nend",
"def transmogrifier (a,b,c)\n (a*b)^c\n end",
"def transmogrifier(num1, num2, num3)\n return (num1*num2)**num3\nend",
"def operation(num)\n\treturn num*num, num**3\nend",
"def transmogrifier(num1,num2,num3)\n\tp (num1*num2)**num3\nend",
"def transmogrifier (num1, num2, num3)\n result = (num1 * num2) **num3\n p result\nend",
"def transmogrifier (a, b, c)\n ((a * b) ** c)\nend",
"def transmogrifier (num1, num2, num3)\n result = (num1 * num2) ** num3\n puts result\nend",
"def add_three n1, n2, n3\n return n1 + n2 + n3\nend",
"def transmogrifier(a, b, c)\n p (a * b) ** c\nend",
"def multiply_vec3!(rhs)\n multiply_vec3 rhs, rhs\n end",
"def m3; 3 end",
"def test(i,j,k)\nreturn @A[i]*$x + @B[j]*$y + @C[k]*$z\nend",
"def multiply_sum_by_3rd_argument\n\n end",
"def operation(x)\n Math.sqrt(x.abs) + 5 * x ** 3\nend",
"def volume_calculations_cube(a)\n return a ** 3\nend",
"def mult(array)\n array.map { |arr|\n xt = mat[0][0] * arr.x + mat[0][1] * arr.y + mat[0][2] * arr.z + mat[0][3] * 1\n yt = mat[1][0] * arr.x + mat[1][1] * arr.y + mat[1][2] * arr.z + mat[1][3] * 1\n zt = mat[2][0] * arr.x + mat[2][1] * arr.y + mat[2][2] * arr.z + mat[2][3] * 1\n Vec3D.new(xt, yt, zt)\n }\n end",
"def compute(*inputs)\n if inputs.length != number_of_inputs\n raise WrongNumberOfInputsError, \"Expected #{number_of_inputs} inputs, got #{inputs.length}\"\n end\n\n # Stash these in instance variables so we can use them for training later\n @medin = []\n @medout = []\n\n outputs = []\n\n number_of_medial_neurons.times do |i|\n @medin[i] = 0\n number_of_inputs.times do |j|\n @medin[i] += @synone[j][i] * inputs[j]\n end\n @medout[i] = Math.tanh(@medin[i])\n end\n\n number_of_outputs.times do |i|\n outputs[i] = 0\n number_of_medial_neurons.times do |j|\n outputs[i] += @syntwo[j][i] * @medout[j]\n end\n end\n\n outputs\n end",
"def transform! *ms\n m = [*ms].flatten.reverse.inject(:*)\n @vbuffer.each_triple_with_index do |t,i|\n q = m * NMatrix[[t[0]],[t[1]],[t[2]],[1]]\n @vbuffer[i] = [q[0]/q[3], q[1]/q[3], q[2]/q[3]]\n end\n self\n end",
"def tensor_product_of_two_matrices(mat1, mat2)\n\n\tresult_rows = []\n\tmat1.values.each { |mat1_row| \n\t\tmat2.values.each { |mat2_row| \n\t\t\t\n\t\t\tresult_row = []\n\t\t\tmat1_row.each { |mat1_elem|\n\n\t\t\t\tmat2_row.each { |mat2_elem|\n\t\t\t\t\tcase [mat1_elem, mat2_elem]\n\t\t\t\t\tin [Term, Term]\n\t\t\t\t\t\tproduct = multiply_two_terms(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Term, TermList]\n\t\t\t\t\t\tproduct = multiply_term_and_term_list(mat1_elem, mat2_elem)\n\t\t\t\t\tin [TermList, Term]\n\t\t\t\t\t\tproduct = multiply_term_and_term_list(mat2_elem, mat1_elem)\n\t\t\t\t\tin [TermList, TermList]\n\t\t\t\t\t\tproduct = multiply_term_list_and_term_list(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Fraction, Term]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Fraction, TermList]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term_list(mat1_elem, mat2_elem)\n\t\t\t\t\tin [Term, Fraction]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term(mat2_elem, mat1_elem)\n\t\t\t\t\tin [TermList, Fraction]\n\t\t\t\t\t\tproduct = multiply_fraction_and_term_list(mat2_elem, mat1_elem)\n\t\t\t\t\tin [Fraction, Fraction]\n\t\t\t\t\t\tproduct = multiply_fraction_and_fraction(mat1_elem, mat2_elem)\n\t\t\t\t\telse\n\t\t\t\t\t\tthrow_error(\"Matrix tensor products with matrices that don't contain only Terms, TermLists, and Fractions.\", mat1, []) # TODO: Add stack trace (make a global)\n\t\t\t\t\tend\n\n\t\t\t\t\tresult_row.append(product)\n\t\t\t\t}\n\t\t\t}\n\t\t\tresult_rows.append(result_row)\n\t\t}\n\t}\n\treturn Matrix.new(mat1.line, mat2.col, result_rows)\nend",
"def transmorgifier (num1,num2,num3)\n (num1*num2).pow(num3)\nend",
"def transmogrifier(a, b, c)\n # (a * b).pow(c)\n (a * b) ** c\nend",
"def add_3(x, y, z)\n x + y + z\n end",
"def add_three num1,num2,num3\n num1+num2+num3\nend",
"def sum3(x, y, z)\n x + y + z\nend",
"def mult_inputs\n array_element_mult(@input_weights, @input_layer.neuron).inject(1) {|product,n| product*n}\n end",
"def always_three (numberi)\n \n (((((numberi+5)*2)-4)/2)-numberi)\n \nend",
"def arthamatic_operation(number)\n\tnumber + 3\nend",
"def add_three num1,num2,num3\n\tnum1 + num2 + num3\nend",
"def Vector3dTripleProduct(arg0, arg1, arg2)\n ret = _invoke(1610744159, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def add_three num1, num2, num3\n\tnum1 + num2 + num3\nend",
"def add_three num1, num2, num3\n num1 + num2 + num3\nend",
"def operations; end",
"def operations; end",
"def add_3(x, y, z)\nend",
"def triple_add(a, b, c)\n puts \"ADDING #{a} + #{b} + #{c}\"\n return a + b + c\nend",
"def predict(input)\n l_size = input.shape[0]\n az = Numo::DFloat.zeros(l_size,@nhidden)\n ar = Numo::DFloat.zeros(l_size,@nhidden)\n ahhat = Numo::DFloat.zeros(l_size,@nhidden)\n\tah = Numo::DFloat.zeros(l_size,@nhidden)\n\t\t\n a1 = tanh((input.dot @w1) + @b1)\n pp \"a1 is ============\"\n pp a1\n pp a1[1,0...a1.shape[1]]\n\t \n # (array slice view) http://ruby-numo.github.io/narray/narray/Numo/DFloat.html#[]-instance_method\t \n x = (Numo::DFloat.zeros(@nhidden)).concatenate(a1[1,0...a1.shape[1]])\n az[1,0...az.shape[1]] = sigm((x.dot @wz) + @bz)\n ar[1,0...ar.shape[1]] = sigm((x.dot @wr) + @br)\n ahhat[1,0...ahhat.shape[1]] = tanh((x.dot @wh) + @bh)\n\tah[1,0...ah.shape[1]] = az[1,0...az.shape[1]]*ahhat[1,0...ahhat.shape[1]]\n\n # for i in range(1,l_size):\n (1...l_size).each do |i|\n x = ah[i-1,0...ah.shape[1]].concatenate(a1[i,0...a1.shape[1]])\n az[i,0...az.shape[1]] = sigm((x.dot @wz) + @bz)\n ar[i,0...ar.shape[1]] = sigm((x.dot @wr) + @br)\n x = (ar[i,0...ar.shape[1]]*ah[i-1,0...ah.shape[1]]).concatenate(a1[i,0...a1.shape[1]])\n ahhat[i,0...ahhat.shape[1]] = tanh((x.dot @wh) + @bh)\n ah[i,0...ah.shape[1]] = (1-az[i,0...az.shape[1]])*ah[i-1,0...az.shape[1]] + az[i,0...az.shape[1]]*ahhat[i,0...ahhat.shape[1]]\n end\n \n a2 = tanh((ah.dot @w2) + @b2)\n\treturn a1,az,ar,ahhat,ah,a2\n end",
"def add_three num1, num2, num3\n\tnum1 + num2 + num3\n\nend",
"def test(i,j,k)\nreturn A[i]*6 + B[j]*9 + C[k]*20\nend",
"def _reduce_693(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def matz; end",
"def add_three(num1, num2, num3)\n\tnum1 + num2 + num3\nend",
"def always_three_method(number)\n\t(((number+5)*2 -4)/2 - number)\nend",
"def volume(x, y, z)\r\n x * y * z\r\nend",
"def volume_of_cube(dimension)\n return dimension**3\nend",
"def operation meth, n_operator_sticks, operator, x\n\tToothNumber.new @value.send(meth, x.value),\n\t \t @num + x.num + n_operator_sticks,\n\t\t\t@pic + operator + x.pic\n end",
"def mul\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n\n\n value = nil\n\n\n a = nil\n b = nil\n\n\n begin\n # at line 14:21: a= single ( MUL b= single | DIV b= single )*\n @state.following.push( TOKENS_FOLLOWING_single_IN_mul_88 )\n a = single\n @state.following.pop\n # at line 14:29: ( MUL b= single | DIV b= single )*\n while true # decision 2\n alt_2 = 3\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == MUL )\n alt_2 = 1\n elsif ( look_2_0 == DIV )\n alt_2 = 2\n\n end\n case alt_2\n when 1\n # at line 15:5: MUL b= single\n match( MUL, TOKENS_FOLLOWING_MUL_IN_mul_95 )\n @state.following.push( TOKENS_FOLLOWING_single_IN_mul_99 )\n b = single\n @state.following.pop\n\n # --> action\n a *= b \n # <-- action\n\n\n when 2\n # at line 16:5: DIV b= single\n match( DIV, TOKENS_FOLLOWING_DIV_IN_mul_107 )\n @state.following.push( TOKENS_FOLLOWING_single_IN_mul_111 )\n b = single\n @state.following.pop\n\n # --> action\n a /= b \n # <-- action\n\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n\n\n # --> action\n value = a \n # <-- action\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n\n end\n\n return value\n end",
"def cube(number)\n return number ** 3\nend",
"def avg_3(x, y, z)\nend",
"def do_something (arg1, arg2, arg3)\n\n\targ1^arg2^arg3\nend",
"def op; end",
"def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend",
"def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend",
"def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend",
"def cops; end",
"def cops; end",
"def cops; end",
"def always_three(num)\n (((num + 5) * 2 - 4) / 2 - num)\nend",
"def volume(x, y, z)\n x * y * z\nend",
"def run(inputs, outputs, targets)\n \tinputNames = Tensorflow::String_Vector.new\n \tinputValues = Tensorflow::Tensor_Vector.new\n if inputs != nil\n \t inputs.each do |key, value|\n \t\t inputValues.push(value)\n \t\t inputNames.push(key)\n \t end\n end\n\n \toutputNames = Tensorflow::String_Vector.new\n \toutputs.each do |name|\n \t\toutputNames.push(name)\n \tend\n\n \ttargetNames = Tensorflow::String_Vector.new\n if targets != nil\n \t targets.each do |name|\n \t\t targetNames.push(name)\n \t end\n end\n\n \toutputValues = Tensorflow::Tensor_Vector.new\n \tstatus = Tensorflow::TF_NewStatus()\n\t Tensorflow::TF_Run_wrapper(self.session , inputNames, inputValues, outputNames, outputValues, targetNames, self.status)\n raise (\"Incorrect specifications passed.\") if Tensorflow::TF_GetCode(status) != Tensorflow::TF_OK\n output_array = []\n (0..outputValues.size - 1).each do |i|\n size = Tensorflow::tensor_size(outputValues[i])\n type = Tensorflow::TF_TensorType(outputValues[i])\n\n case type\n when Tensorflow::TF_DOUBLE\n c_array = Tensorflow::Double.new(size)\n Tensorflow::double_reader(outputValues[i], c_array, size)\n when Tensorflow::TF_INT64\n c_array = Tensorflow::Long_long.new(size)\n Tensorflow::long_long_reader(outputValues[i], c_array, size)\n when Tensorflow::TF_INT32\n c_array = Tensorflow::Int.new(size)\n Tensorflow::int_reader(outputValues[i], c_array, size)\n when Tensorflow::TF_COMPLEX128\n c_array = Tensorflow::complex_reader(outputValues[i])\n else\n raise \"Data type not supported.\"\n end\n\n num_dimensions = Tensorflow::TF_NumDims(outputValues[i])\n out_dimension = []\n (0..num_dimensions - 1).each do |j|\n out_dimension.push(Tensorflow::TF_Dim(outputValues[i], j))\n end\n output = []\n (0..size - 1).each do |j|\n output.push(c_array[j])\n end\n out_dimension.reverse!\n (0..out_dimension.length - 2).each do |k|\n total_dim = output.length\n dim_array = []\n temp_array = []\n (0..total_dim - 1).each do |ind|\n temp_array.push(output[ind])\n dim_array.push(temp_array) if (temp_array.length == out_dimension[k])\n temp_array = [] if (temp_array.length == out_dimension[k])\n end\n output = dim_array\n end\n output_array.push(output)\n end\n output_array\n end",
"def add_three(num1, num2, num3)\n result = num1 + num2 + num3\n return result\nend",
"def Vector3dFromMatrix3dTransposeTimesVector3d(arg0, arg1)\n ret = _invoke(1610744214, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def _reduce_585(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def _reduce_593(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def _reduce_597(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def Multiply(x)\n (x * 3)\nend",
"def Vector3dFromTransform3dTransposeTimesVector3d(arg0, arg1)\n ret = _invoke(1610744220, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def operation; end",
"def r\n return (x**2.0 + y**2.0 + z**2.0)**0.5\n end",
"def multiply!(rhs)\n case rhs\n when ::Snow::Vec3 then multiply(rhs, rhs)\n else multiply(rhs, self)\n end\n end",
"def multiplicationby3(a)\n return a*3\nend",
"def _reduce_696(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def add_three(num1, num2, num3)\nreturn num1 + num2 + num3\nend",
"def cube(number)\n\n number * number * number\n\nend",
"def multiplier(grid,r,c,dir)\n '''\n grid = array of arrays >> 20 arrays, 20 elements each, 400 element grid\n r, c = integers representing row and column indecies 0 <= r,c < 20\n dir = string for direction on the grid to travel to gather terms for product\n '''\n first_term = grid[r][c]\n\n case dir\n\n when \"U\"\n return (first_term * grid[r-1][c] * grid[r-2][c] * grid[r-3][c])\n when \"UR\"\n return (first_term * grid[r-1][c+1] * grid[r-2][c+2] * grid[r-3][c+3])\n when \"R\"\n return (first_term * grid[r][c+1] * grid[r][c+2] * grid[r][c+3])\n when \"DR\"\n return (first_term * grid[r+1][c+1] * grid[r+2][c+2] * grid[r+3][c+3])\n when \"D\"\n return (first_term * grid[r+1][c] * grid[r+2][c] * grid[r+3][c])\n when \"DL\"\n return (first_term * grid[r+1][c-1] * grid[r+2][c-2] * grid[r+3][c-3])\n when \"L\"\n return (first_term * grid[r][c-1] * grid[r][c-2] * grid[r][c-3])\n when \"UL\"\n return (first_term * grid[r-1][c-1] * grid[r-2][c-1] * grid[r-3][c-1])\n\n end\n\nend",
"def _reduce_724(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def ops!\n @ops\n end",
"def cube(num)\n return num **3\nend",
"def cube(num)\n return num ** 3\nend",
"def cube(num)\n return num ** 3\nend",
"def evaluate\n @output_value = Math.tanh(@input_value - @bias)\n #p \"output value #{@output_value}\"\n @forward_nodes.each do |node, weight|\n #p \"weight #{weight} old input #{node.input_value}\"\n node.input_value += @output_value * weight\n #p \"new input #{node.input_value}\"\n end\n @input_value = 0\n end",
"def add_three(num1,num2,num3)\n answer = num1+num2+num3\n return answer\nend",
"def _reduce_590(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def cube (n)\ncube_result = n**3\nreturn cube_result\nend",
"def Vector3dFromTransform3dTransposeTimesXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744222, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def unit_vector\n\t\tlen = self.r\n\t\traise Vector::ZeroOperation if (len == 0)\n\t\tself * (1/len)\n\t\t# Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n\tend",
"def set3(x, y, z, n)\r\n\t\t\tif x<@dims && y<@dims && z<@dims\r\n\t\t\t\t@data[(@dims*x)+(@dims*x*y)+z]\r\n\t\t\telse\r\n\t\t\t\tfail \"Unable to store more than dimensions.\"\r\n\t\t\tend\r\n\t\tend",
"def pitagoric_triplet?(a,b,c)\n (a**2 + b**2) == c**2\nend",
"def cube(input)\n output = input * input\n return output\nend",
"def get(param, with_tangent = false)\n\t\tif(empty?)\n\t\t return nil\n\t\tend\n result = super\n p = Eigen::Vector3.new(*result[0, 3])\n if with_tangent\n t = Eigen::Vector3.new(*result[3, 3])\n return p, t\n else\n return p\n end\n end",
"def Vector3dFromMatrix3dTransposeTimesXYZ(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744216, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def _reduce_585(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend",
"def cube(number)\n output = number **3\n return output\nend",
"def Transform3dFromSquaredTransform3d(arg0, arg1, arg2)\n ret = _invoke(1610743944, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_I4, VT_I4])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def cube(number)\n return number**3\nend",
"def multiply_machine(number_1, number_2, number_3)\n output = number_1 * number_2 * number_3\n return output\nend",
"def _reduce_711(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend",
"def acceleration(state_object, t)\n k = 10\n b = 1\n (- k * state_object.x) - (b * state_object.v)\nend"
] |
[
"0.6035634",
"0.5901361",
"0.58505476",
"0.58209014",
"0.5779332",
"0.57538015",
"0.5657838",
"0.5625845",
"0.5610086",
"0.55967724",
"0.5596765",
"0.54679465",
"0.5433536",
"0.54202074",
"0.5405133",
"0.5399429",
"0.538885",
"0.52724767",
"0.52546",
"0.5216338",
"0.51268774",
"0.5114827",
"0.5112881",
"0.51089036",
"0.50683314",
"0.50586784",
"0.5053381",
"0.50527936",
"0.50393414",
"0.50278074",
"0.5021973",
"0.49960285",
"0.49754372",
"0.497513",
"0.49722493",
"0.4969775",
"0.4969775",
"0.496022",
"0.49591416",
"0.49561822",
"0.4935251",
"0.49242187",
"0.49217683",
"0.49193054",
"0.49085197",
"0.4901257",
"0.48855183",
"0.48835436",
"0.48829615",
"0.4881648",
"0.48691586",
"0.48676363",
"0.48623565",
"0.48609158",
"0.4859906",
"0.4859906",
"0.4859906",
"0.48426375",
"0.48426375",
"0.48426375",
"0.48275694",
"0.48092884",
"0.48024788",
"0.4800351",
"0.47994334",
"0.4798698",
"0.47838944",
"0.477499",
"0.47748968",
"0.47685313",
"0.47677454",
"0.47626024",
"0.47604397",
"0.47544196",
"0.47525847",
"0.47508386",
"0.47448692",
"0.47424757",
"0.47421128",
"0.47398475",
"0.4739831",
"0.47391543",
"0.47391543",
"0.4739144",
"0.47344473",
"0.47326094",
"0.4729014",
"0.47214264",
"0.47161227",
"0.47125235",
"0.47124693",
"0.47102934",
"0.47098482",
"0.47026822",
"0.4702183",
"0.46948949",
"0.4688651",
"0.46881828",
"0.46732977",
"0.46688882",
"0.46652114"
] |
0.0
|
-1
|
SF OpenData don't have rating for food trucks. We give random ratings for display purposes.
|
def rating
rand(40..140).to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_random_rating\n ratings = [\n ['Low Unsatisfactory', 2], \n ['High Unsatisfactory', 3], \n ['Low Satisfactory', 10], \n ['Mid Satisfactory', 15], \n ['High Satisfactory', 20], \n ['Low Advanced', 25], \n ['High Advanced', 25]\n ]\n wChooseUsingRand(@rand, ratings)\n end",
"def rating\n if in_the_future\n return nil\n else\n #TODO replace this with actual rating\n return rand(1..5)\n end\n end",
"def rating\n 0\n end",
"def set_rating\n food_reviews = self.food_reviews\n if self.has_rating\n totrating = 0\n food_reviews.each do |food_review|\n totrating = totrating + food_review.rating\n end\n avg_rating = totrating.to_f/food_reviews.length\n @food_rating = avg_rating.round(2)\n return\n end\n @food_rating = 0.0\n end",
"def rating\n rating_calculator.rate(raters)\n end",
"def market_price_for_drug\n rand(500) + 10\n end",
"def num_ratings \n 5\n end",
"def pull_food_from_db\n PlaylistFood.order(\"random()\").first\n end",
"def rating #Getter\n @rating\n end",
"def randomRarity\n\t\tr = Random.rand\n\t\tfor rarity in RARITIES\n\t\t\tif r < DISTRIBUTION[rarity]\n\t\t\t\treturn rarity\n\t\t\tend\n\t\tend \n\tend",
"def force_rating\n rating = 0\n # Force rating is 1 if either of the 3 specializations is a force tree.\n if self.specialization_1\n tree = TalentTree.find(self.specialization_1)\n if tree.force_tree\n rating = 1\n end\n end\n if self.specialization_2\n tree = TalentTree.find(self.specialization_2)\n if tree.force_tree\n rating = 1\n end\n end\n if self.specialization_3\n tree = TalentTree.find(self.specialization_3)\n if tree.force_tree\n rating = 1\n end\n end\n\n # Add one rank for each Force Rating talent.\n CharacterExperienceCost.where(:character_id => self.id, :resource_type => 'talent').each do |talent|\n if talent.resource_id && talent.resource_id > 0 && Talent.find(talent.resource_id).name == \"Force Rating\"\n rating += 1\n end\n end\n\n rating\n end",
"def min_rating\n 0\n end",
"def rating\n cached_rating\n end",
"def rating\n if self.rating_sum > 0 && self.rating_count > 0\n (self.rating_sum / self.rating_count).round(2)\n end\n end",
"def least_favorite_recipe\n recipes_sorted_by_rating[0]\n end",
"def rating\n average_rating = (trips.collect {|trip| trip.rating.to_f}.sum)/trips.length\n ## Code below functions the same as the code in line 28\n ## Was unsure which design was preferred, so left both in\n # total_rating = 0.0\n # trips.each do |trip|\n # total_rating += trip.rating\n # end\n # average_rating = total_rating/trips.length\n return average_rating.round(1)\n end",
"def rating\n @rating\n end",
"def rating\n return nil unless ratings.length > 0\n (ratings.average(:value) / 0.25).round * 0.25\n end",
"def rating\n r = Rating.create_from_database(rating_id.to_i)\n r.rating\n end",
"def rating\n return @rating\n end",
"def rate_recipe(rating, recipe)\n recipe.ratings << Rating.create(user: self, recipe: recipe, star_rating: rating)\n end",
"def rating\r\n\t\t@rating\r\n\tend",
"def calculate_average_rating\n weighted_drinks_ratings.sum.to_f / weighted_drinks_ratings.count\n end",
"def set_relevancy!\n # calculate total of ratings\n ratings = rating.count_attributes\n ratings.each do |key,value|\n ratings[key] = value * SolutionRelevancy.send(\"rating_value_#{key}\")\n end\n total = ratings.values.inject(0) { |sum, count| sum + count }\n \n # calculate total of views\n total += views * SolutionRelevancy.view_value\n \n # calculate updates\n total += updates * SolutionRelevancy.update_value\n \n # total # of items that are included in the updates\n num_of_items = total_votes + views + updates\n\n # set the relevancy\n settings.update_attribute('relevancy',num_of_items > 0 ? total/num_of_items : AppConstants::DEFAULT_SOLUTION_RELEVANCY) \n end",
"def sample_agilities(fighter)\n sum = fighter.stats[:agility] + stats[:agility]\n Random.rand(sum) < stats[:agility]\n end",
"def rating\n return 0 if total_votes == 0\n (100 * self.yeses) / total_votes\n end",
"def random_weighted_eligibility_trait\n {\n eligible: 20,\n ineligible: 4,\n no_qts: 2,\n active_flags: 2,\n different_trn: 1,\n previous_induction: 1,\n previous_participation: 1,\n secondary_profile: 2,\n exempt_from_induction: 2,\n }\n .map\n .with_object([]) { |(trait, weighting), a| weighting.times { a << trait } }\n .sample\nend",
"def rating\n return @rating if @rating\n result = PublicEarth::Db::Collection.one.rating(self.id)\n @rating = { :average_rating => result['average_rating'].to_f, :rating_count => result['rating_count'].to_i } rescue nil\n end",
"def rating\n response[\"rating\"]\n end",
"def rating\n if average_rating?\n # Integerize it for now -- no fractional average ratings\n (the_ratings = ratings.average(:rating)) ? the_ratings.round : 0.0\n else\n self.old_rating.nil? ? nil : self.old_rating.rating\n end\n end",
"def get_ratings\n return @trips.inject(0) do |sum, trip|\n trip.is_in_progress? ? sum + 0 : sum + trip.rating\n end\n end",
"def show\n @recommendedstickers = Sticker.find(Sticker.pluck(:id).sample)\n end",
"def rating\n rating_id.get_object.name\n end",
"def rating; \"Д/379 (stub)\"; end",
"def get_rating\n more_than_five_late_deliveries ? 2 : 1\nend",
"def list_ratings\n final_result = []\n # grab all of the rating attributes and counts and turn them into an array\n rating_results = rating.count_attributes.to_a\n \n # order the rating counts and attributes\n ordered_results = []\n ['one', 'two', 'three', 'four'].each do |order|\n rating_results.each do |result|\n if order == result[0]\n ordered_results << result\n end\n end\n end\n \n # add in the friendly name\n for i in 0...ordered_results.length\n final_result << [AppConstants::FRIENDLY_RATING_NAMES[i],ordered_results[i][0],(ordered_results[i][1].to_f/total_votes.to_f)*100]\n end\n \n final_result\n end",
"def overall_rating\n\t\ttotal_score = 0\n\t\ttotal_score += self.setting \n\t\ttotal_score += self.hotness\n\t\ttotal_score += self.originality\n\t\ttotal_score += self.style\n\t\ttotal_score += self.attitude\n\t\treturn total_score / 5\n\tend",
"def update_ratings\n tournament.rater.update_ratings(self)\n end",
"def beer_rating\n # if all three public rating sources are nil, provide a \"zero\" rating for this beer\n if beer_rating_one.blank? && beer_rating_two.blank? && beer_rating_three.blank?\n (3.25*2).round(2)\n # else, combine the public ratings according to algorithm below\n else \n # determine if a large number of people have provided ratings on this beer\n if number_ratings_one \n first_ratings = number_ratings_one\n else\n first_ratings = 0\n end\n if number_ratings_two \n second_ratings = number_ratings_two\n else\n second_ratings = 0\n end\n if number_ratings_three\n third_ratings = number_ratings_three\n else\n third_ratings = 0\n end\n # calculate total number of ratings \n number_of_ratings = (first_ratings + second_ratings + third_ratings)\n # if a significant number (>500) have rated this beer, don't discount the rating\n if number_of_ratings >= 500\n if beer_rating_one && beer_rating_two && beer_rating_three\n (((((beer_rating_one * number_ratings_one) + (beer_rating_two * number_ratings_two) + (beer_rating_three * number_ratings_three)) / (number_of_ratings))*1)*2).round(2)\n elsif beer_rating_one && beer_rating_two\n (((((beer_rating_one * number_ratings_one) + (beer_rating_two * number_ratings_two)) / (number_ratings_one + number_ratings_two))*1)*2).round(2)\n elsif beer_rating_one && beer_rating_three\n (((((beer_rating_one * number_ratings_one) + (beer_rating_three * number_ratings_three)) / (number_ratings_one + number_ratings_three))*1)*2).round(2)\n elsif beer_rating_two && beer_rating_three\n (((((beer_rating_two * number_ratings_two) + (beer_rating_three * number_ratings_three)) / (number_ratings_two + number_ratings_three))*1)*2).round(2)\n elsif beer_rating_one\n ((((beer_rating_one * number_ratings_one) / (number_ratings_one))*1)*2).round(2)\n elsif beer_rating_two\n ((((beer_rating_two * number_ratings_two) / (number_ratings_two))*1)*2).round(2)\n else\n ((((beer_rating_three * number_ratings_three) / (number_ratings_three))*1)*2).round(2)\n end\n else\n # if a non-significant number (<500) have rated this beer, discount the rating by 10%\n if beer_rating_one && beer_rating_two && beer_rating_three\n (((((beer_rating_one * number_ratings_one) + (beer_rating_two * number_ratings_two) + (beer_rating_three * number_ratings_three)) / (number_of_ratings))*0.9)*2).round(2)\n elsif beer_rating_one && beer_rating_two\n (((((beer_rating_one * number_ratings_one) + (beer_rating_two * number_ratings_two)) / (number_ratings_one + number_ratings_two))*0.9)*2).round(2)\n elsif beer_rating_one && beer_rating_three\n (((((beer_rating_one * number_ratings_one) + (beer_rating_three * number_ratings_three)) / (number_ratings_one + number_ratings_three))*0.9)*2).round(2)\n elsif beer_rating_two && beer_rating_three\n (((((beer_rating_two * number_ratings_two) + (beer_rating_three * number_ratings_three)) / (number_ratings_two + number_ratings_three))*0.9)*2).round(2)\n elsif beer_rating_one\n ((((beer_rating_one * number_ratings_one) / (number_ratings_one))*0.9)*2).round(2)\n elsif beer_rating_two\n ((((beer_rating_two * number_ratings_two) / (number_ratings_two))*0.9)*2).round(2)\n else\n ((((beer_rating_three * number_ratings_three) / (number_ratings_three))*0.9)*2).round(2)\n end\n end\n end\n end",
"def swagger \n critiq_rating + like_rating\n end",
"def recommend_new_songs\nselected =Song.all.select do |song|\n song.genre == self.favorite_genre\nend\nselected.sample(5)\n\n end",
"def rating\n average = 0.0\n ratings.each { |r|\n average = average + r.rating\n }\n if ratings.size != 0\n average = average / ratings.size\n end\n average\n end",
"def max_rating\n 10\n end",
"def rating(m)\n return @rating_list[m].rating unless @rating_list[m] == nil\n return 0\n end",
"def add_rating(rating)\n if @count < TRAINING_SET_SIZE\n add_movie(rating)\n add_user(rating)\n @count += 1\n else\n @test_set << rating\n end\n end",
"def get_rating\n @number_of_late_deliveries > 5 ? 2 : 1\nend",
"def rating\n r = 0\n if self[:power_rating]\n r = self[:power_rating].to_f\n else\n r = PHASES.inject(0) {|sum, ph| sum += (self[\"power#{ph}_rating\".to_sym] || 0).to_f}\n end\n raise \"Can't find a rating for #{self[:name]}\" if r == 0\n r\n end",
"def counting_recommendation\n count = @shoe.count\n if count <= 1\n @cold\n elsif count <= 10\n @warm\n else\n @hot\n end\n end",
"def fav_recipes\n self.reload.ratings.select {|rating| rating.fav}\n end",
"def boost\n 1.0 #self.rating / 2.0\n end",
"def corrected_rating\n [(weighted_rating + 2) * 1.6666666666666667, 5.0].min\n end",
"def set_rating\n all_ratings = []\n self.reviews.each { |review| all_ratings << review.overall_rating }\n self.rating = all_ratings.reduce(:+) / (all_ratings.length * 1.0)\n self.save\n end",
"def calculate_rating!\n now = Time.now.to_i\n \n sums = []\n \n properties = {}\n properties[:followers] = self.store.followers.map(&:created_at) unless store.nil?\n properties[:favorites] = self.favorites.map(&:created_at)\n properties[:orders] = self.orders.map(&:created_at)\n properties.each do |k, v|\n weight = self.properties_rating_weight[k]\n raise(ArgumentError) unless v.is_a?(Array)\n raise(ArgumentError) if weight.nil?\n \n timed = properties[k].map do |created_at|\n # (difference in hours / 1 month) * maximum weight for freshness\n distance = [ now - created_at.to_i, 1 ].max\n quotient = distance / self.rating_time_scale\n quotient * self.now_rating_weight\n end\n \n # (sum of freshness points) * weight for a given property\n sums << timed.sum * weight\n end\n\n self.update_attribute(:rated_at, Time.now)\n self.update_attribute(:rating, sums.sum)\n true\n end",
"def restaurantify(data)\n restaurants = []\n data.each do |restaurant|\n restaurants << Restaurant.new(name: restaurant[:name], rating: restaurant[:rating], total_stock_limit: restaurant[:total_stock_limit],\n stock: create_meal_type_hash(restaurant[:total_stock_limit], restaurant[:stock_data] ) )\n end\n # order by rating decending\n restaurants.sort!{ |a,b| a.rating <=> b.rating }.reverse\n end",
"def rating\n review.rating if review\n end",
"def grocery_item_guess(list)\n list.sample\nend",
"def average_restaurant_rating\n ratings = []\n DishPost.all.map do |post|\n if post.restaurant_id == self.id\n ratings << post.rating\n end\n end\n ratings.inject{ |sum, a| sum + a}.to_f / ratings.size.to_f\n end",
"def rating\n Rating.average(:rating, :conditions => [\"sight_id = ?\", self.id])\n end",
"def show\n @fooddrinks = Fooddrink.all\n Fooddrink.update_avg_qty(@fooddrink)\n @recommends = Fooddrink.where(user_id: @fooddrink.user_id).where.not(id: @fooddrink.id).order(created_at: :desc)\n end",
"def raters\n self.ratings.includes(:rater).all.collect{|r| r.rater}\n end",
"def throwing_total\n self.rating_1 +\n self.rating_2 +\n self.rating_3 +\n self.rating_4 +\n self.rating_5\n end",
"def hitting_total\n self.rating_19 +\n self.rating_20 +\n self.rating_21 +\n self.rating_22 +\n self.rating_23 +\n self.rating_24 +\n self.rating_25 +\n self.rating_26 +\n self.rating_27\n end",
"def rating\n return votes.average(:rate) if(votes.size > 0) # example of duck typing here -- very convinient \n \"Not Rated\" \n end",
"def rate(rating)\n @nb_ratings += 1\n @sum_ratings += rating\n @average_rating = @sum_ratings / @nb_ratings\n end",
"def get_sample\n reviews = Review.where(destination_id: self.id)\n sample = reviews[rand(reviews.length)]\n return sample\n end",
"def set_hotness!\n preferred_weight = self.preferred ? PREFERRED_MAGNITUDE : 0\n vote_weight = vote_tally + preferred_weight\n\n newness = self.created_at.to_f || Time.now.to_f\n sign = vote_weight < 0 ? -1 : 1\n upvote_magnitude = [ vote_weight.abs, 1.1 ].max\n order = Math.log upvote_magnitude, 10\n\n self.hotness = sign * order + newness / 45000\n end",
"def rating\n @ole.Rating\n end",
"def suggested(n = 4)\n # TODO : Commented out because this request is extremely slow and makes page render twice.\n # return(Spree::Product.random_marketplace(n)) if self.get_type.nil?\n # \n # kolors = self.colors_hash\n # color1, color2 = kolors[:primary], kolors[:secondary]\n # \n # ret = []\n # ret.concat(color1.products.presentable.randomize.limit(n * 5)) unless color1.nil?\n # ret.concat(color2.products.presentable.randomize.limit(n * 5)) unless color2.nil?\n # ret = ret.sort_by { rand }\n # ret.concat(Spree::Product.random_marketplace(n))\n # ret.reject! {|product| product.get_type == self.get_type }\n # ret.delete(self)\n # ret.uniq!\n # ret.first(n)\n \n Spree::Product.active.with_image.randomize.limit(n)\n end",
"def ai_rating\n if (skill?)\n GTBS.get_skill_rating(self.item.id)\n else\n return 1\n end\n end",
"def rating_convert\n self.rating.each do |trip|\n trip.rating = * 0.01 * ('%.2f' % trip.rating)\n return trip.rating\n end\n end",
"def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end",
"def get_random_like(client)\n likes = client.favorites(self.get_uid_int, options = {count: 5})\n like = likes.sample\n end",
"def average_rating()\n total_ratings = 0\n total_trips = 0\n average_rating = 0\n #self.trips = Trip.where(driver_id:self.id)\n self.trips.each do |trip|\n # if trip cost is not nil, the trip is complete\n if trip.cost != nil \n total_ratings += trip.rating\n total_trips += 1\n end\n end\n if total_trips > 0 \n average_rating = total_ratings.to_f / total_trips\n end\n return average_rating\n end",
"def create_recommendation\n # once you have the forecast, ask each Weather object for the appropriate\n # clothing and accessories, store the result in @recommendation. You might\n # want to implement the two methods below to help you kee this method\n # smaller...\n end",
"def player_ratings\n Player.ratings(galaxy_id, Player.where(alliance_id: id))\n end",
"def personalized_recommendations(customer_id)\n item = DirectedEdge::Item.new(@database, \"customer#{customer_id}\")\n item.recommended(['product']).map { |product| product.sub('product', '').to_i }\n end",
"def mutate\n @dog_count = rand(2) == 0 ? 1 + rand(6) : dog_count\n @cat_count = rand(2) == 0 ? 1 + rand(85) : cat_count\n @mouse_count = rand(2) == 0 ? 1 + rand(336) : mouse_count\n end",
"def create_ratyrate\n\t\tself.rate(self.rating, self.user, \"rating\", false)\n\tend",
"def average_rating\n average = 0\n count = 0 \n self.trips.each do |trip|\n average += trip.rating.to_i\n count += 1\n end\n return average / count\n end",
"def user_drink_rating(drink_id)\n @user_drink_rating = UserBeerRating.where(user_id: self.id, beer_id: drink_id)\n if !@user_drink_rating.blank?\n @user_average_rating = (@user_drink_rating.average(:user_beer_rating).to_f).round(1)\n if @user_average_rating >= 10.0\n @final_rating = 10\n else\n @final_rating = @user_average_rating\n end\n else\n @final_rating = nil\n end\n @final_rating\n end",
"def rating\n (get_upvotes.size + 2)/(get_downvotes.size + 2)\n end",
"def humanized_rating\n\t\tRATINGS.invert[self.rating]\n\tend",
"def index\n @recipes = Recipe.all\n @tags = Tag.all\n @ratings = Rating.all\n @recipes = Recipe.order(sort_column + \" \" + sort_direction)\n @top = []\n @recipes.each do |recipe|\n if recipe.average_rating.blank?\n norating = []\n norating << recipe\n @top = norating.sample\n @top.save\n end\n end\n end",
"def average_rating\n if driven_trips.length == 0\n return 0\n else\n completed_trips = driven_trips.reject {|trip| trip.rating.nil?}.map{|item| item.rating}\n return completed_trips.sum.to_f / completed_trips.length\n end\n end",
"def rating_factor\n\t\tcase reviews.length\n\t\t\twhen 0..5\n\t\t\t\t0.35\n\t\t\twhen 6..10\n\t\t\t\t0.50\n\t\t\twhen 11..20\n\t\t\t\t0.75\n\t\t\twhen 21..40\n\t\t\t\t0.90\n\t\t\telse\n\t\t\t\t1\n\t\tend\n\tend",
"def rating_of(category, item)\n ratings_of = ratings.select{ |r| r.beer.send(category) == item }\n ratings_of.map(&:score).inject(&:+) / ratings_of.count.to_f\n end",
"def top_three_recipes\n self.recipes.sort_by {|info| info.rating}.pop(3)\n end",
"def pizza_size \n\tsize = [\"small\", \"medium\", \"large\", \"super\", \"giganto\"].sample # .sample randomizing all the sizes\nend",
"def ratings\n ChgkRating::Collections::TeamRatings.new team: self\n end",
"def review(rating)\n user = User.new\n user.read_creddentials\n user.login\n response = user.review rating\n if response\n puts 'Last food reviewed!'\n else\n puts 'Nothing to review'\n end\n end",
"def generate_random_trade_items(bonus_rate = 0, categories = [])\n rate = ShopsSettings::TRADE_REFLOW_RATE + bonus_rate\n items = []\n trade_flow.each { |ary|\n next if ary[1] == 1 and !categories.include?(:items)\n next if ary[1] == 2 and !categories.include?(:weapons)\n next if ary[1] == 3 and !categories.include?(:armors)\n if rand(100) <= rate\n arx = [ary[0], ary[1], 1]\n items.push(arx)\n ary[2] -= 1\n trade_flow.delete(ary) if ary[2] <= 0\n end\n }\n items\n end",
"def random_item(category)\n if category == 'best-bets'\n # Sample a random Best Bet type from a static list\n ['webofscience', 'googlescholar', 'ieee', 'pubmed', 'morningstar', 'wgsn', 'standards', 'dissertation', 'refworks', 'ibis', 'proquest',\n 'psychinfo', 'sciencemagazine', 'sciencedirect', 'petition', 'compendex', 'jstor', 'software', 'naturejournal'].sample\n elsif category == 'doi-trap'\n # Sample a random DOI from a static list\n ['10.1080/10510974.2013.797483', '10.1111/j.1468-2958.1996.tb00379.x', 'http://dx.doi.org/10.1063/1.2741534', 'DOI: 10.1007/BF02887151',\n '10.1039/C4RA16247A', '10.1002/sce.3730670213', 'DOI: 10.1007/s40596-014-0241-5', '10.1080/15348423.2012.697437',\n 'http://dx.doi.org/10.3168/jds.S0022-0302(86)80552-5', 'DOI: 10.1023/A:1005204727421', '10.1039/C3TA00019B', 'doi:10.1038/leu.2016.163',\n 'DOI: 10.1007/s10853-013-7374-x', 'doi: 10.1016/0167-2738(91)90233-2', 'doi: 10.1179/000705992798268927', '10.1038/nphys3794',\n 'doi: 10.1149/1.1393288', '10.1080/1554480X.2014.926052', '10.1002/adma.201506234', '10.1080/00958972.2016.1176158'].sample\n elsif category == 'result-types'\n # Use a defined searcher for found types\n (QuickSearch::Engine::APP_CONFIG['searchers']).sample.dasherize\n elsif category == 'more-options'\n # Use a result number for more-options\n ['result-1', 'result-2', 'result-3', 'result-4'].sample\n elsif category == 'spelling-suggestion'\n # Use a fake string\n 'spelling suggestion ' + (rand*200).to_i.to_s\n else\n # Use one of the typical options for a searcher click (or anything else we haven't handled above)\n ['heading', 'result-1', 'result-2', 'result-3', 'see-all-results', 'no-results', 'error'].sample\n end \nend",
"def rating_count\n search_by_itemprop('ratingCount').to_i\n end",
"def all_ratings_calculated_ratio\n\t\tif number_of_ratings > 0\n\t\t\tratio = mean_calculated_ratio\n\t\telse\n\t\t\tratio = chapter.mean_calculated_ratio\n\t\tend\n\t\treturn ratio\n\tend",
"def populate_items\n return if @items.size >= 15\n\n type = rand\n if type < 0.010\n @items.push(Goody.new(:apple))\n elsif type < 0.040\n @items.push(Goody.new(:merde))\n end\n end",
"def pick_food()\n if block_given?\n # Can be used to simulate experiences?\n yield @qvalues\n else\n # Default food behavior\n r = rand()\n\n # NOTE: N% of the time pick randomly (after exploration)\n if r < @epsilon or @days_lived < @exploration\n WELLS.keys.sample\n else\n @qvalues.max_by { |k, v| v }[0]\n end\n end\n end",
"def blank_rating\n self.rating ||= 0\n end",
"def round_rating(target = :overall_quality)\n rating = send(target)\n if rating #&& rating\n ((rating * 2 + 0.5).floor / 2.0)\n end\n end",
"def rater_rated(rateable)\n rate = Rating.find_by_rateable_id_and_rater_id_and_rateable_type(rateable, self, rateable.class.name)\n rate.rating if rate\n end",
"def item_average_rating\n item_rating / count_properties_names rescue 0\n end"
] |
[
"0.7331151",
"0.6829501",
"0.6675677",
"0.661202",
"0.6558206",
"0.64459854",
"0.6426603",
"0.62336653",
"0.6217112",
"0.6152719",
"0.6148448",
"0.6116917",
"0.6105556",
"0.6097569",
"0.60747373",
"0.6062242",
"0.6044514",
"0.6039364",
"0.603809",
"0.60060555",
"0.5965579",
"0.5954584",
"0.59529984",
"0.59471285",
"0.5930858",
"0.5924589",
"0.5922599",
"0.586926",
"0.5868543",
"0.58617604",
"0.58497465",
"0.5848965",
"0.5841503",
"0.58392966",
"0.5835361",
"0.58250624",
"0.5822913",
"0.5820984",
"0.5813696",
"0.5805721",
"0.58004767",
"0.5791055",
"0.5772951",
"0.57680196",
"0.5745643",
"0.57402027",
"0.573175",
"0.57316697",
"0.57298416",
"0.5727969",
"0.5724714",
"0.5722793",
"0.57210004",
"0.5718696",
"0.5714465",
"0.5712722",
"0.5709769",
"0.56860614",
"0.5684762",
"0.56830937",
"0.5679201",
"0.5674964",
"0.56734836",
"0.56723434",
"0.56664455",
"0.56569237",
"0.5650394",
"0.56495076",
"0.56482387",
"0.5645841",
"0.5638766",
"0.56380326",
"0.56365347",
"0.56269646",
"0.5622626",
"0.5622512",
"0.56207204",
"0.5619287",
"0.56001425",
"0.5597138",
"0.55932873",
"0.55926937",
"0.55879",
"0.5577375",
"0.55750734",
"0.5572656",
"0.55725527",
"0.55547744",
"0.55539864",
"0.5537827",
"0.5534224",
"0.5532404",
"0.5530755",
"0.55295646",
"0.55261254",
"0.5506552",
"0.5504246",
"0.5501708",
"0.5500101",
"0.5499725"
] |
0.7123666
|
1
|
Used for home page upload
|
def create
@receipt = current_user.receipts.build receipt_params
if @receipt.save
render json: {
receiptId: @receipt.id
}, status: 200
else
render json: {
error: @receipt.errors.full_messages.first,
}, status: 400
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def adm_upload_selected\n if params[:upload].nil?\n flash.now[:error]='Es wäre schon gut, vor dem Upload eine Datei auszuwählen'\n else\n fpath=params[:upload].tempfile\n fbasename=File.basename(params[:upload].original_filename)\n # tempf=File.open(fpath,'r:BOM|UTF-8')\n FileUtils.cp fpath, AMP_DIR+'/'+fbasename # Throws exception if it fails\n # tempf.close\n File.unlink(fpath) # Throws exception if it fails\n # Put information on it into DB.\n # Only adds to DB if not exists yet, otherwise old entry is kept\n added_info=Userpage.new_page_with_default(fbasename)\n if added_info.kind_of?(Array)\n if added_info.length == 0\n flash.now[:info]=\"Neue Version von #{fbasename} gespeichert.\"\n else\n flash.now[:error]=\"Fehler beim Speichern in die Datenbank: \"+added_info.to_sentence\n end\n else\n flash.now[:info]=\"Datei #{fbasename} gespeichert.\"\n end\n end\n prepare_admin_home_data\n render admin_pages_home_path\n end",
"def upload\r\n \r\n end",
"def upload\n end",
"def upload\n end",
"def upload_simple\r\n \r\n end",
"def file_uploads; end",
"def upload_process\n # アップロードファイルを取得\n file = params[:upfile]\n\n # ファイルのベース名(パスを除いた部分)を取得\n name = file.original_filename\n\n # 許可する拡張子を定義\n permits = ['.jpg', '.jpeg', '.gif', '.png']\n\n # 配列 permits にアップロードファイルの拡張子に合致するものがあるか\n if ! permits.include?(File.extname(name).downcase)\n render :text => \"アップロードできるのは画像ファイルのみ( \" + permits.join(', ') + \" )です。\"\n elsif file.size > 1.megabyte\n render :text => 'ファイルサイズは1MBまでです。'\n else\n # utf8 to sjis\n name = name.kconv(Kconv::SJIS, Kconv::UTF8)\n\n # /public/doc フォルダ配下にアップロードファイルを保存\n File.open(\"public/docs/#{name}\", 'wb') { |f| f.write(file.read) }\n render :text => \"#{name.toutf8}をアップロードしました。\"\n end\n end",
"def uploading_pictures\n end",
"def upload\n @active_link = \"upload\"\n @post = generate_post(session_obj, {:is_upload=>true})\n render :new\n end",
"def upload_file\n #TODO\n end",
"def file_upload\n redirect_to wip_path()\n # TODO file_upload_wip\n end",
"def upload\n respond_to do |format|\n format.html # upload.html.erb\n end\n end",
"def upload\n create_document\n \n render_upload\n end",
"def upload_file\n @site_mapping = SiteMapping.new\n @site_mapping.parent_id = params[:site_mapping_id]\n \n @chunk = Chunk.new\n @chunk_version = ChunkVersion.new\n \n render :update do |page|\n page.replace_html 'content', :partial => 'upload'\n page.show 'content'\n end\n end",
"def upload\n\n\t\t@uploads = Idea.find(params[:id]).uploads\n\t\t@idea = params[:id]\n\t\t@idea_obj = Idea.find(@idea)\n\n\t\t# allows user to delete files\n\t\t@delete = true\n\n\t\t@path = [link_to_ideas, link_to_idea_uploads(@idea_obj)]\n\t\t@subnavigation = [active_link_to_idea_uploads(@idea_obj), link_to_idea(@idea_obj), link_to_show_all_ideas(\"Alle Ideen\", \"title\", \"ASC\", \"\", 0, 30)]\n\tend",
"def convert_upload_jpgs\n\n page=Page.find(params[:page][:id])\n page.save!\n\n page.save_file(params[:page][:result_jpg], :jpg)\n page.save_file(params[:page][:result_sjpg], :s_jpg)\n\n push_app_status ## send status-update to application main page via private_pub gem, fayes,\n push_converted_page(page)\n\n render :nothing => true\n\n end",
"def upload_file\n #Load upload view\n #render the view \"upload_file\"\n end",
"def multipart_upload\n end",
"def upload_document\n render template: \"/dash/chooser/upload_document\"\n end",
"def uploadtempbanner\n\tctime=Time.now().to_i\n filename = ''\n if params[:upload]\n\t\t\tfilename = ctime.to_s + params[:upload]['datafile'].original_filename\n\t\t\tpost = DataFile.savetmp(params[:upload],ctime)\n end\n render text: filename + \"@@@\"+params[:upload]['datafile'].size.to_s\n end",
"def show\n # redirect_to @upload.url\n end",
"def multipart; end",
"def client_side_multipart_upload\n end",
"def upload\n begin\n solve(@viewable_list,@browse_list)\n render :result\n rescue Exception => e\n raise_error INCORRECT_DATA\n end\n end",
"def set_home_page_file\n @home_page_file = HomePageFile.find(params[:id])\n end",
"def toe_multi_upload_form\n authorize!(:toe_multi_upload_form,@user) unless @user.has_access?('Terms of Engagement')\n @document_home = @matter.document_homes.new\n @document = @document_home.documents.build\n render :layout =>false\n end",
"def files\n redirect_to(ContentServer.uploaded_content_url(params[:id], '.' + params[:ext].to_s))#params[:id].to_s.gsub(\".\")[1]))\n end",
"def files\n redirect_to(ContentServer.uploaded_content_url(params[:id], '.' + params[:ext].to_s))#params[:id].to_s.gsub(\".\")[1]))\n end",
"def upload\n self._create params[:upfile], params[:pictitle]\n end",
"def manage_files\n redirect_to wip_path()\n end",
"def pshr_uploader(upload)\n render 'pshr/uploads/uploader', upload: upload\n end",
"def public_file_server; end",
"def public_file_server; end",
"def html_uploader\n # TODO\n end",
"def upload_url\n return unless @data['image']\n # Isn't actually displayed in-app without this set\n return unless image['property'] == 'image'\n file(@data['image'])\n end",
"def upload_image\n render template: \"/dash/chooser/upload_image\"\n end",
"def upload\n do_upload(self.class.upload_class)\n end",
"def new_by_mass_upload\n end",
"def upload\n \tset_up_instances_variable\n \tuploaded_io = @tree.file\n \t@nome_arquivo = Rails.root.join('public', 'uploads', uploaded_io.original_filename)\n \tFile.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|\n \t\tfile.write(uploaded_io.read)\n \tend\n \tler_texto @nome_arquivo\n end",
"def setup(easy)\n super\n if form.empty?\n easy.upload = true\n easy.infilesize = 0\n end\n end",
"def index\n # index page for media files\n end",
"def import_page\n end",
"def upload\n file = params[:file].original_filename\n activity = file.sub(/\\..*$/,'')\n path = RAILS_ROOT + \"/public/data/\" + activity\n Dir.mkdir path\n datapath = path + \"/data/\"\n Dir.mkdir datapath\n basename = datapath + activity\n smi = File.open(\"#{basename}.smi\",\"w\")\n cl = File.open(\"#{basename}.class\",\"w\")\n params[:file].read.each do |line|\n items = line.split(/\\s+/)\n smi.puts \"#{items[0]}\\t#{items[1]}\"\n cl.puts \"#{items[0]}\\t#{activity}\\t#{items[2]}\"\n end\n if LazarCategory.find_by_name(\"Uploads\").blank?\n cat = LazarCategory.create(:name => \"Uploads\")\n else\n cat = LazarCategory.find_by_name(\"Uploads\")\n end\n LazarModule.create(:endpoint => activity, :directory => path, :lazar_category => cat)\n redirect_to :action => :search\n end",
"def index\n @home_page_files = HomePageFile.all\n end",
"def upload_user_bikes\n end",
"def handle_docs_upload\n @user_document = current_user.build_user_document(document_params)\n if @user_document.save\n flash[:success] = I18n.t 'after_signup.upload_success'\n render_wizard current_user\n else\n flash[:error] = I18n.t 'after_signup.upload_failure'\n render after_signup_path(:upload_docs)\n end\n end",
"def upload\n\n current_user_id = params[:current_user_id]\n print current_user_id\n filename = params[:Filename]\n print filename\n filedata = params[:Filedata]\n print filedata\n galleryname = params[:gallery_name]\n print galleryname\n\n # Construct the gallery if necessary\n gallery = Gallery.find_by_title(galleryname)\n if gallery.nil?\n gallery = Gallery.new\n gallery.title = galleryname\n gallery.person_id = current_user_id\n gallery.save\n end\n \n picture = Picture.new\n picture.picture_file_name = filename\n picture.picture_file_data = filedata\n picture.title = \"\"\n picture.person_id = current_user_id\n picture.gallery_id = gallery.id\n picture.save\n \n end",
"def goto_upload_page\r\n (func, title) = get_2_params()\r\n init_globals()\r\n\r\n goto_upload_page1(func, title)\r\nend",
"def show\n show! do\n add_crumb(I18n.t(\"controller.uploads\"), uploads_path)\n add_crumb(@upload.to_s, upload_path(@upload))\n end\n end",
"def image_upload_prep(artist)\n\n bk_image_name = \"Three_Repeater-\"+artist.url_slug+\"-\"\n @bucket = IMAGE_BUCKET\n\n @image_save_location = artist_save_image_url(@artist.url_slug)\n\n logger.info(\"save image location\")\n logger.info(@image_save_location)\n\n #bk_image_uplosd\n @bk_image_upload = render_to_string('shared/_s3_upload_form_image', :locals => {:image_name => bk_image_name, :image_type => \"bk_image\", :image_save_url =>@image_save_location}, :layout => false)\n\n #logo Upload\n @logo_image_upload = render_to_string('shared/_s3_upload_form_image', :locals => {:image_name => bk_image_name, :image_type => \"logo\", :image_save_url => @image_save_location}, :layout => false)\n\n #profile image upload\n @profile_image_upload = render_to_string('shared/_s3_upload_form_image', :locals => {:image_name => bk_image_name, :image_type => \"profile\", :image_save_url => @image_save_location}, :layout => false)\n\n logger.info \"bk form\"\n logger.info @bk_image_upload\n\n logger.info \"image upload form\"\n logger.info @logo_image_upload\n\n\n end",
"def upload\n @direct_upload_url = params[:direct_upload_url]\n respond_to do |format|\n format.js { render template: \"#{website.folder}/module_requests/upload.js\", layout: false }\n end # respond_to do |format|\n end",
"def upload_shipped\n end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def new\n return error_status(true, :cannot_create_uploaded_file) unless (UploadedFile.can_be_created_by(@logged_user, @page))\n \n @uploaded_file = @page.uploaded_files.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uploaded_file }\n end\n end",
"def index\n @title = \"User uploaded files\"\n get_files(params)\n end",
"def process_file_upload\n if params[:file].present? and params[:file].respond_to?(:size) and params[:file].size != 0\n # there is an actual file being uploaded\n filename = params[:filename].present? ? params[:filename] : params[:file].original_filename.sanitize_as_filename\n directory = File.join(Rails.root, '/public/', params[:directory])\n full_path = File.join(directory, filename)\n\n # no directory by that name\n error_msg = 'Błąd: nie ma katalogu, do którego można wgrać plik.' if !File.directory?(directory)\n\n # file already exists\n if File.exist?(full_path)\n # overwrite existing file?\n if params[:overwrite] == 'on'\n # overwrite, but also save a timestamped backup copy\n backup_filename = File.basename(filename, File.extname(filename)) + \".#{Time.now.strftime(\"%Y%m%d%H%M%S\")}\" + File.extname(filename)\n begin\n File.rename(full_path, File.join(directory, backup_filename))\n rescue SystemCallError\n error_msg = 'Błąd: nie mogę utworzyć kopii zapasowej istniejącego pliku.'\n end\n else\n error_msg = 'Błąd: istnieje już plik o tej nazwie.'\n end\n end\n else\n # no file uploaded\n error_msg = 'Błąd: brak pliku do wgrania.'\n end\n\n # render response in parent frame (parent of the iframe object) (requires responds_to_parent plugin: https://github.com/pjg/responds_to_parent)\n responds_to_parent do\n render :update do |page|\n\n # remove the spinner\n page[\".file_upload_box .loading\"].remove\n\n if error_msg.present?\n # display errors\n page['.file_upload_box .message'].attr 'class', 'message alert'\n page['.file_upload_box .message'].text error_msg\n else\n # actually save the file\n File.open(full_path , \"wb\") {|f| f.write(params[:file].read)}\n File.chmod(0644, full_path)\n\n # execute callback task if present\n if params[:callback].present?\n # allowing system callbacks is a very serious security risk (but we still want them), so we drastically limit allowed characters\n callback = params[:callback].gsub(/[^a-z A-Z0-9=\\/\\.\\_-]/, '')\n system(\"cd #{Rails.root} && rake maintenance:#{callback}\")\n end\n\n # message for the user\n page['.file_upload_box .message'].attr 'class', 'message notice'\n page['.file_upload_box .message'].text 'Plik wgrany pomyślnie.'\n\n\n # simply_textile_editor integration (https://github.com/pjg/simply_textile_editor)\n # add the just uploaded file to the 'pictures' list and select the filename of the uploaded file but only if there is a picture insert box on the page\n page << \"\n if ($('.insert_picture_box #picture_filename').size() > 0 && typeof $.selectNewlyUploadedPicture == 'function') {\n $.selectNewlyUploadedPicture('#{full_path}')\n }\n \"\n end\n end\n end\n end",
"def on_post(path)\n acct = I3.server.remote_account\n local_path = DocumentFile::DOC_FILE_PATH + path\n \n # Sanity checks\n unless File.directory?(local_path)\n send_uploaded_file_response I3::NotFoundException.new(\n :message => \"The path '#{path}' could not be found.\")\n return\n end #unless\n \n if DocumentPlatform.check_permission(:write, acct, local_path).empty?\n send_uploaded_file_response I3::SecurityException.new(\n :message => \"You do not have permission to write to folder '#{path}'\")\n return\n end #if\n \n # We are good to go so far, so let's grab the file\n file = I3.server.cgi[\"fileToUpload\"]\n filename = file.filename\n \n # Internet Explorer will sometimes send the whole path. We only want the filename.\n filename = filename.split(\"\\\\\").last if filename =~ /\\w:\\\\/\n \n begin\n response = UploadedFile.save_as(filename, file, local_path)\n send_uploaded_file_response response\n \n rescue I3::SecurityException\n log.warn \"User #{acct.account_name} tried to upload a file to '#{path}' and was denied.\"\n send_uploaded_file_response $!\n \n rescue FileAlreadyExistsException\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n response = $!.to_shared\n response.temp_file = UploadedFile.save_as_temp(file)\n response.path = path\n response.original_filename = filename\n response.overwritable = (not DocumentPlatform.check_permission(\n :write, acct, File.join(local_path, filename)).empty?)\n send_uploaded_file_response response\n rescue\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n send_uploaded_file_response I3::ServerException.new(\n :title => \"Could not save file\", \n :message => $!.message )\n end #begin\n \n end",
"def upload_url\n return @upload_url\n end",
"def upload\n files_saved = 0\n # Build product images from upload\n\t\tparams[:file].each do |i|\n if i[:file_data] && !i[:file_data].blank?\n new_file = UserUpload.init(i[:file_data])\n if new_file.save\n files_saved += 1\n end\n end\n end\n \n flash[:notice] = \"#{files_saved} file(s) uploaded.\"\n \n if params[:modal]\n redirect_to :action => 'image_library' and return\n else\n redirect_to :action => 'index' and return\n end\n end",
"def new_files; end",
"def upload\n\t\t@musician = User.find_by_id(current_user)\n\t\tif !params[:user].nil?\n\t\t\t@musician.avatar = params[:user][:avatar]\n\t\t\t@musician.uploaded = true\n\t\tend\n\n\t\tif @musician.save\n\t\t\tredirect_to musician_path(@musician)\n\t\telse\n\t\t\t@musician.uploaded = false if params[:user][:avatar]\n\t\t\trender 'show'\n\t\tend\n\tend",
"def index\n @upload = Upload.new # Allow file uploads on index page via jq_fu\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @uploads }\n end\n end",
"def save_attached_files; end",
"def save_attached_files; end",
"def home\n @picture = Picture.new\n # @data = { 'form-data' => (@s3_direct_post.fields), 'url' => @s3_direct_post.url, 'host' => URI.parse(@s3_direct_post.url).host }\n end",
"def multipart?; end",
"def upload_file_url\n \"file://#{upload_full_path}\"\n end",
"def upload(major)\n unless File.exist?(major)\n puts \"File #{major} not found.\"\n return\n end\n major = File.absolute_path(major)\n response, success = ImgurAPI.upload(major)\n puts response unless success\n if success\n response = \"![#{options[:title].nil? ? 'Screenshot' : options[:title]}](#{response})\" if options[:markdown]\n response = build_HTML_response(response) if options[:html]\n puts \"Copied #{Platform.copy(response)} to clipboard\"\n end\n storage.save\n end",
"def upload_data_button_onclick\r\n aname = @@alib.remove_space(params[\"tbox_aname\"])\r\n datafile = params[\"tbox_datfile\"]\r\n\r\n error = @@alib.is_nil_log(datafile, \"Data File\")\r\n if (!error)\r\n lpath = @@alib.get_localpath(session[:cas_user], \"upload\")\r\n fname = @@alib.upload_txtfile(lpath, datafile)\r\n pid = @@slib.sql_get_1num(\"plate\", \"plate_id\", \"name = 'template'\")\r\n pwid = @@slib.sql_get_1num(\"pathway\", \"pathway_id\", \"name='template'\")\r\n\r\n assayfields = @@alib.new_arr10(session[:cas_user], fname, aname, 1, pid, \"\", \"\", \"\", pwid, 1)\r\n\r\n @@ulib.load_data(lpath, assayfields)\r\n end\r\n \r\n (func, title) = get_2_params()\r\n goto_upload_page1(func, title)\r\nend",
"def uploaded_file\n initalize_breadcrumb(\"Uploaded File(s)\", uploadedfile_datauploaders_path)\n currentUser = current_user.id\n @uploadedFiles = UserFileMapping.where(:user_id =>currentUser )\n respond_with(@uploadedFiles)\n end",
"def create\n @upload = current_user.uploads.build(upload_params)\n if @upload.save\n flash[:notice] = \"Successfully uploaded the file.\"\n if @upload.folder\n redirect_to browse_path(@upload.folder)\n else\n redirect_to root_url\n end\n else\n render :action => 'new'\n end\n end",
"def upload\n return if current_pstore.nil?\n fichier_synchro.upload\n flash \"PStore uploadé\"\n end",
"def upload_file\n @assignment = Assignment.find(params[:id])\n if ((@assignment.facebook_user.id == @fb_user.id) or (@assignment.is_author? @fb_user))\n @add_file_url = ActionController::Base.asset_host + \"/assignments/add_file/\"\n else\n flash[:alert] = \"You do not have permissions to add a file to that assignment.\"\n redirect_to @assignment\n end\n\n end",
"def create\n @upload = current_user.uploads.build(upload_params)\n if @upload.save \n flash[:notice] = \"Successfully uploaded the file.\"\n if @upload.folder #checking if we have a parent folder for this file \n redirect_to browse_path(@upload.folder) #then we redirect to the parent folder \n else\n redirect_to root_url \n end \n else\n render 'new'\n end\n end",
"def uploadImage\n post = DataFile.save(params[:upload], \"\")\n \n f = Family.where(turn: -1).first\n if f.nil?\n f = Family.new\n f.turn = -1\n f.save\n end\n \n f.name = post.to_s\n f.save\n \n # render :text => \"File has been uploaded successfully\"\n redirect_to :back\n end",
"def upload(file, someone)\n end",
"def view_upload_csv\n @title_page = 'Upload questions'\n erb :upload, layout: :session\nend",
"def getUploadfile\r\n\t\t\t\t\treturn @uploadfile\r\n\t\t\t\tend",
"def home\n @page = Page.find_or_create_by(name: \"home\")\n @images = Dir.glob(\"app/assets/images/home_banner/cropped/*.jpg\")\n @twitter_client = get_twitter_client\n end",
"def index\n\t\t@uploads = current_user.all_uploads.sort_by! { |x| x.heading.downcase }\n\tend",
"def create\n @home_page_file = HomePageFile.new(home_page_file_params)\n\n respond_to do |format|\n if @home_page_file.save\n format.html { redirect_to @home_page_file, notice: 'Home page file was successfully created.' }\n format.json { render action: 'show', status: :created, location: @home_page_file }\n else\n format.html { render action: 'new' }\n format.json { render json: @home_page_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_file_to_server id, content, size, page_count, extension = \".jpg\"\n\n @s.execute_file_post @s.url_for(\"system/pool/createfile.#{id}.page#{page_count}-#{size}\"), \"thumbnail\", \"thumbnail\", content, related_mimetype(extension)\n alt_url = @s.url_for(\"p/#{id}/page#{page_count}.#{size}\" + extension)\n @s.execute_post alt_url, {\"sakai:excludeSearch\" => true}\n log \"Uploaded image to curl #{alt_url}\"\nend",
"def cmd_upload\n raise NotImplementedError, \"Subclass must implement cmd_upload()\"\n end",
"def set_upload\n @upload = Upload.friendly.find(params[:id])\n end",
"def rawDataUpload()\n # prepare raw data for upload\n show do\n title \"Prepare to upload resulting analyzer data\"\n check \"Under <b>Analysis</b>. <b>Gel Image</b> tab, click <b>Select All</b>.\"\n check \"Under the <b>View</b> tab, check <b>Show Analysis Parameters</b>.\"\n #image \"frag_an_select_all\"\n end\n # save run\n show do\n title \"Save resulting analyzer data\"\n check \"Under the <b>Report</b> tab, click <b>Start Report/Export</b>.\"\n note \"Wait while the files are generated.\"\n check \"Under <b>File</b>-></b>Open Data Directory</b>, click <b>Export</b>.\"\n check \"Copy the following files with today's date, and paste into <b>Documents/Raw Data</b>:\"\n note \"_Rw\"\n note \"_Rw.csv\"\n note \"_Go_150dpi_1\"\n note \"_Ex_PeakCalling.csv\"\n #image \"frag_an_files_to_upload\"\n end\n # upload data \n show do\n title \"Upload resulting analyzer data\"\n note \"Upload the files ending in the following sequences:\"\n note \"_Rw\"\n upload var: \"Raw XML\"\n note \"_Rw.csv\"\n upload var: \"Raw CSV\"\n note \"_Go_150dpi_1\"\n upload var: \"Gel Image\"\n note \"_Ex_PeakCalling.csv\"\n upload var: \"Peak Calling CSV\"\n end\n end",
"def set_upload\n @upload = nil\n @upload = Upload.find(params[:upload_id]) if params[:upload_id]\n @upload = @content.upload if @upload.nil? && !@content.nil?\n end",
"def run_upload!\n \tself.status = 'En Proceso'\n \tsave\n end",
"def upload\n # connected to upload.html.haml form\n # looks for :zernike in params, existence means file is attached\n # significant help from \"http://www.tutorialspoint.com/ruby-on-rails/rails-file-uploading.htm\"\n if params[:zernike]\n uploaded_file = params[:zernike][:attachment]\n file_name = uploaded_file.original_filename\n jsonified_file = uploaded_file.as_json[\"tempfile\"]\n extract_data = coefficients_extractor(jsonified_file)\n @file = extract_data\n \n if @file.nil? or @file.empty?\n flash[:warning] = \"Unable to upload file\"\n # made it a \"warning\" instead of \"notice\" so we can change the colors/text\n else\n flash[:notice] = \"File successfully uploaded!\"\n end\n \n redirect_to zernikes_path\n end\n \n # if not @file.nil?\n # byebug\n # end\n # self.content = [TEXT INSIDE test.txt]\n # @file = params[:file]\n # byebug\n # @zernike = Zernike.\n # if @zernike.save\n # flash[:notice] = \"File successfully uploaded!\"\n # redirect_to \n # else \n # flash[:notice] = \"Unable to upload file\"\n \n # byebug\n # @file = params[:file]\n # if @file.nil? or @file.empty? \n # flash[:notice] = \"File is empty!\"\n # else \n # flash[:notice] = \"File successfully uploaded!\"\n # end\n \n end",
"def public_file_server=(_arg0); end",
"def public_file_server=(_arg0); end",
"def file_upload_wip()\n logger.debug \"\\r\\n\\r\\n!! ------ in upload/file_upload -----\"\n logger.debug params[:datafile].original_filename\n logger.debug params\n logger.debug \"\\r\\n!! ===========================\\r\\n\"\n is_successful = true\n\n if params[:datafile]\n tmp = params[:datafile].tempfile\n file = File.join( \"public/uploads\", params[:datafile].original_filename )\n FileUtils.cp tmp.path, file\n# \n # name = params[:datafile].original_filename\n # directory = \"public/uploads\"\n # path = File.join(directory, name)\n # File.open(path, \"wb\") { |f|\n # f.write( params[:datafile].read )\n # }\n else\n is_successful = false\n end\n\n redirect_to upload_path()\n end",
"def index\n \n \n\n if params[:file]\n @file = params[:file] \n p @file\n @path = \"/home/session[:user_name]/#{@file}\"\n @path.to_s.gsub!('\\.\\.' , '')\n if File.directory?(@path)\n @files = Dir.foreach(\"/home/session[:user_name]/#{@file}\") \n else\n send_file @path\n end\n else\n @path = \"/home/session[:user_name]\"\n @files = Dir.foreach(\"/home/session[:user_name]\")\n \n end\n\n\n \n end",
"def setUploadfile(uploadfile)\r\n\t\t\t\t\t@uploadfile = uploadfile\r\n\t\t\t\tend",
"def index\n @uploads = Upload.all\n @upload = Upload.new\n end",
"def upload\n if can?(:>, \"4\")\n params[:page] = params[:page].nil? ? 1 : params[:page]\n @part_upload = Kitting::KitBomBulkOperation.new\n @part_uploads = Kitting::KitBomBulkOperation.where(\"operation_type = ? and customer_id IN (?)\",\"PART CUP COUNT\",current_company).paginate(:page => params[:page], :per_page => 100).order('created_at desc')\n else\n redirect_to main_app.unauthorized_url\n end\n end",
"def upload_file=(file_name)\n self.file_field(:id=>\"multifile_upload\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-oae/\" + file_name)\n end"
] |
[
"0.75396794",
"0.7247704",
"0.7217689",
"0.7217689",
"0.7048944",
"0.7025128",
"0.6786027",
"0.6634935",
"0.66342694",
"0.65733033",
"0.6517045",
"0.65095687",
"0.64565",
"0.64150196",
"0.640897",
"0.6394262",
"0.63933957",
"0.63890725",
"0.63294303",
"0.6294235",
"0.62794113",
"0.62760234",
"0.6253428",
"0.6199411",
"0.6113085",
"0.6097747",
"0.60597306",
"0.60597306",
"0.60588896",
"0.6056747",
"0.6029254",
"0.59955066",
"0.59955066",
"0.5991896",
"0.59877783",
"0.59781736",
"0.59668046",
"0.59580654",
"0.5954182",
"0.5948279",
"0.59382486",
"0.5932813",
"0.5919512",
"0.5909148",
"0.5903534",
"0.5891047",
"0.58814234",
"0.58805",
"0.58688325",
"0.58638465",
"0.58635974",
"0.58402914",
"0.58281195",
"0.58281195",
"0.58281195",
"0.58281195",
"0.58281195",
"0.58281195",
"0.5822629",
"0.58022803",
"0.58015996",
"0.5789848",
"0.57825774",
"0.57781494",
"0.5772867",
"0.5766393",
"0.57580584",
"0.5736574",
"0.5736574",
"0.57363814",
"0.57164705",
"0.5715121",
"0.57135886",
"0.5697073",
"0.56904775",
"0.5688225",
"0.5686515",
"0.5686301",
"0.56829184",
"0.568196",
"0.5680809",
"0.56806606",
"0.5676525",
"0.56720704",
"0.56681395",
"0.566488",
"0.5661387",
"0.5659141",
"0.5655973",
"0.56536084",
"0.5650588",
"0.5647717",
"0.5641591",
"0.56390506",
"0.56390506",
"0.5635186",
"0.5627738",
"0.5612984",
"0.56102365",
"0.56092674",
"0.5609232"
] |
0.0
|
-1
|
Used for home page upload
|
def process_text
@receipt = current_user.receipts.find(params[:receipt_id])
if @receipt.present?
@receipt.process_text!
render json: { receiptUrl: receipt_url(@receipt)}, status: 200
else
render json: {
error: @receipt.errors.full_messages.first,
}, status: 400
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def adm_upload_selected\n if params[:upload].nil?\n flash.now[:error]='Es wäre schon gut, vor dem Upload eine Datei auszuwählen'\n else\n fpath=params[:upload].tempfile\n fbasename=File.basename(params[:upload].original_filename)\n # tempf=File.open(fpath,'r:BOM|UTF-8')\n FileUtils.cp fpath, AMP_DIR+'/'+fbasename # Throws exception if it fails\n # tempf.close\n File.unlink(fpath) # Throws exception if it fails\n # Put information on it into DB.\n # Only adds to DB if not exists yet, otherwise old entry is kept\n added_info=Userpage.new_page_with_default(fbasename)\n if added_info.kind_of?(Array)\n if added_info.length == 0\n flash.now[:info]=\"Neue Version von #{fbasename} gespeichert.\"\n else\n flash.now[:error]=\"Fehler beim Speichern in die Datenbank: \"+added_info.to_sentence\n end\n else\n flash.now[:info]=\"Datei #{fbasename} gespeichert.\"\n end\n end\n prepare_admin_home_data\n render admin_pages_home_path\n end",
"def upload\r\n \r\n end",
"def upload\n end",
"def upload\n end",
"def upload_simple\r\n \r\n end",
"def file_uploads; end",
"def upload_process\n # アップロードファイルを取得\n file = params[:upfile]\n\n # ファイルのベース名(パスを除いた部分)を取得\n name = file.original_filename\n\n # 許可する拡張子を定義\n permits = ['.jpg', '.jpeg', '.gif', '.png']\n\n # 配列 permits にアップロードファイルの拡張子に合致するものがあるか\n if ! permits.include?(File.extname(name).downcase)\n render :text => \"アップロードできるのは画像ファイルのみ( \" + permits.join(', ') + \" )です。\"\n elsif file.size > 1.megabyte\n render :text => 'ファイルサイズは1MBまでです。'\n else\n # utf8 to sjis\n name = name.kconv(Kconv::SJIS, Kconv::UTF8)\n\n # /public/doc フォルダ配下にアップロードファイルを保存\n File.open(\"public/docs/#{name}\", 'wb') { |f| f.write(file.read) }\n render :text => \"#{name.toutf8}をアップロードしました。\"\n end\n end",
"def upload\n @active_link = \"upload\"\n @post = generate_post(session_obj, {:is_upload=>true})\n render :new\n end",
"def uploading_pictures\n end",
"def upload_file\n #TODO\n end",
"def file_upload\n redirect_to wip_path()\n # TODO file_upload_wip\n end",
"def upload\n respond_to do |format|\n format.html # upload.html.erb\n end\n end",
"def upload\n create_document\n \n render_upload\n end",
"def upload_file\n @site_mapping = SiteMapping.new\n @site_mapping.parent_id = params[:site_mapping_id]\n \n @chunk = Chunk.new\n @chunk_version = ChunkVersion.new\n \n render :update do |page|\n page.replace_html 'content', :partial => 'upload'\n page.show 'content'\n end\n end",
"def upload\n\n\t\t@uploads = Idea.find(params[:id]).uploads\n\t\t@idea = params[:id]\n\t\t@idea_obj = Idea.find(@idea)\n\n\t\t# allows user to delete files\n\t\t@delete = true\n\n\t\t@path = [link_to_ideas, link_to_idea_uploads(@idea_obj)]\n\t\t@subnavigation = [active_link_to_idea_uploads(@idea_obj), link_to_idea(@idea_obj), link_to_show_all_ideas(\"Alle Ideen\", \"title\", \"ASC\", \"\", 0, 30)]\n\tend",
"def convert_upload_jpgs\n\n page=Page.find(params[:page][:id])\n page.save!\n\n page.save_file(params[:page][:result_jpg], :jpg)\n page.save_file(params[:page][:result_sjpg], :s_jpg)\n\n push_app_status ## send status-update to application main page via private_pub gem, fayes,\n push_converted_page(page)\n\n render :nothing => true\n\n end",
"def upload_file\n #Load upload view\n #render the view \"upload_file\"\n end",
"def multipart_upload\n end",
"def upload_document\n render template: \"/dash/chooser/upload_document\"\n end",
"def uploadtempbanner\n\tctime=Time.now().to_i\n filename = ''\n if params[:upload]\n\t\t\tfilename = ctime.to_s + params[:upload]['datafile'].original_filename\n\t\t\tpost = DataFile.savetmp(params[:upload],ctime)\n end\n render text: filename + \"@@@\"+params[:upload]['datafile'].size.to_s\n end",
"def show\n # redirect_to @upload.url\n end",
"def multipart; end",
"def client_side_multipart_upload\n end",
"def upload\n begin\n solve(@viewable_list,@browse_list)\n render :result\n rescue Exception => e\n raise_error INCORRECT_DATA\n end\n end",
"def set_home_page_file\n @home_page_file = HomePageFile.find(params[:id])\n end",
"def toe_multi_upload_form\n authorize!(:toe_multi_upload_form,@user) unless @user.has_access?('Terms of Engagement')\n @document_home = @matter.document_homes.new\n @document = @document_home.documents.build\n render :layout =>false\n end",
"def files\n redirect_to(ContentServer.uploaded_content_url(params[:id], '.' + params[:ext].to_s))#params[:id].to_s.gsub(\".\")[1]))\n end",
"def files\n redirect_to(ContentServer.uploaded_content_url(params[:id], '.' + params[:ext].to_s))#params[:id].to_s.gsub(\".\")[1]))\n end",
"def manage_files\n redirect_to wip_path()\n end",
"def upload\n self._create params[:upfile], params[:pictitle]\n end",
"def pshr_uploader(upload)\n render 'pshr/uploads/uploader', upload: upload\n end",
"def public_file_server; end",
"def public_file_server; end",
"def html_uploader\n # TODO\n end",
"def upload_url\n return unless @data['image']\n # Isn't actually displayed in-app without this set\n return unless image['property'] == 'image'\n file(@data['image'])\n end",
"def upload_image\n render template: \"/dash/chooser/upload_image\"\n end",
"def upload\n do_upload(self.class.upload_class)\n end",
"def new_by_mass_upload\n end",
"def upload\n \tset_up_instances_variable\n \tuploaded_io = @tree.file\n \t@nome_arquivo = Rails.root.join('public', 'uploads', uploaded_io.original_filename)\n \tFile.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|\n \t\tfile.write(uploaded_io.read)\n \tend\n \tler_texto @nome_arquivo\n end",
"def setup(easy)\n super\n if form.empty?\n easy.upload = true\n easy.infilesize = 0\n end\n end",
"def index\n # index page for media files\n end",
"def import_page\n end",
"def upload\n file = params[:file].original_filename\n activity = file.sub(/\\..*$/,'')\n path = RAILS_ROOT + \"/public/data/\" + activity\n Dir.mkdir path\n datapath = path + \"/data/\"\n Dir.mkdir datapath\n basename = datapath + activity\n smi = File.open(\"#{basename}.smi\",\"w\")\n cl = File.open(\"#{basename}.class\",\"w\")\n params[:file].read.each do |line|\n items = line.split(/\\s+/)\n smi.puts \"#{items[0]}\\t#{items[1]}\"\n cl.puts \"#{items[0]}\\t#{activity}\\t#{items[2]}\"\n end\n if LazarCategory.find_by_name(\"Uploads\").blank?\n cat = LazarCategory.create(:name => \"Uploads\")\n else\n cat = LazarCategory.find_by_name(\"Uploads\")\n end\n LazarModule.create(:endpoint => activity, :directory => path, :lazar_category => cat)\n redirect_to :action => :search\n end",
"def index\n @home_page_files = HomePageFile.all\n end",
"def upload_user_bikes\n end",
"def handle_docs_upload\n @user_document = current_user.build_user_document(document_params)\n if @user_document.save\n flash[:success] = I18n.t 'after_signup.upload_success'\n render_wizard current_user\n else\n flash[:error] = I18n.t 'after_signup.upload_failure'\n render after_signup_path(:upload_docs)\n end\n end",
"def goto_upload_page\r\n (func, title) = get_2_params()\r\n init_globals()\r\n\r\n goto_upload_page1(func, title)\r\nend",
"def upload\n\n current_user_id = params[:current_user_id]\n print current_user_id\n filename = params[:Filename]\n print filename\n filedata = params[:Filedata]\n print filedata\n galleryname = params[:gallery_name]\n print galleryname\n\n # Construct the gallery if necessary\n gallery = Gallery.find_by_title(galleryname)\n if gallery.nil?\n gallery = Gallery.new\n gallery.title = galleryname\n gallery.person_id = current_user_id\n gallery.save\n end\n \n picture = Picture.new\n picture.picture_file_name = filename\n picture.picture_file_data = filedata\n picture.title = \"\"\n picture.person_id = current_user_id\n picture.gallery_id = gallery.id\n picture.save\n \n end",
"def show\n show! do\n add_crumb(I18n.t(\"controller.uploads\"), uploads_path)\n add_crumb(@upload.to_s, upload_path(@upload))\n end\n end",
"def upload\n @direct_upload_url = params[:direct_upload_url]\n respond_to do |format|\n format.js { render template: \"#{website.folder}/module_requests/upload.js\", layout: false }\n end # respond_to do |format|\n end",
"def image_upload_prep(artist)\n\n bk_image_name = \"Three_Repeater-\"+artist.url_slug+\"-\"\n @bucket = IMAGE_BUCKET\n\n @image_save_location = artist_save_image_url(@artist.url_slug)\n\n logger.info(\"save image location\")\n logger.info(@image_save_location)\n\n #bk_image_uplosd\n @bk_image_upload = render_to_string('shared/_s3_upload_form_image', :locals => {:image_name => bk_image_name, :image_type => \"bk_image\", :image_save_url =>@image_save_location}, :layout => false)\n\n #logo Upload\n @logo_image_upload = render_to_string('shared/_s3_upload_form_image', :locals => {:image_name => bk_image_name, :image_type => \"logo\", :image_save_url => @image_save_location}, :layout => false)\n\n #profile image upload\n @profile_image_upload = render_to_string('shared/_s3_upload_form_image', :locals => {:image_name => bk_image_name, :image_type => \"profile\", :image_save_url => @image_save_location}, :layout => false)\n\n logger.info \"bk form\"\n logger.info @bk_image_upload\n\n logger.info \"image upload form\"\n logger.info @logo_image_upload\n\n\n end",
"def upload_shipped\n end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def new\n return error_status(true, :cannot_create_uploaded_file) unless (UploadedFile.can_be_created_by(@logged_user, @page))\n \n @uploaded_file = @page.uploaded_files.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uploaded_file }\n end\n end",
"def index\n @title = \"User uploaded files\"\n get_files(params)\n end",
"def process_file_upload\n if params[:file].present? and params[:file].respond_to?(:size) and params[:file].size != 0\n # there is an actual file being uploaded\n filename = params[:filename].present? ? params[:filename] : params[:file].original_filename.sanitize_as_filename\n directory = File.join(Rails.root, '/public/', params[:directory])\n full_path = File.join(directory, filename)\n\n # no directory by that name\n error_msg = 'Błąd: nie ma katalogu, do którego można wgrać plik.' if !File.directory?(directory)\n\n # file already exists\n if File.exist?(full_path)\n # overwrite existing file?\n if params[:overwrite] == 'on'\n # overwrite, but also save a timestamped backup copy\n backup_filename = File.basename(filename, File.extname(filename)) + \".#{Time.now.strftime(\"%Y%m%d%H%M%S\")}\" + File.extname(filename)\n begin\n File.rename(full_path, File.join(directory, backup_filename))\n rescue SystemCallError\n error_msg = 'Błąd: nie mogę utworzyć kopii zapasowej istniejącego pliku.'\n end\n else\n error_msg = 'Błąd: istnieje już plik o tej nazwie.'\n end\n end\n else\n # no file uploaded\n error_msg = 'Błąd: brak pliku do wgrania.'\n end\n\n # render response in parent frame (parent of the iframe object) (requires responds_to_parent plugin: https://github.com/pjg/responds_to_parent)\n responds_to_parent do\n render :update do |page|\n\n # remove the spinner\n page[\".file_upload_box .loading\"].remove\n\n if error_msg.present?\n # display errors\n page['.file_upload_box .message'].attr 'class', 'message alert'\n page['.file_upload_box .message'].text error_msg\n else\n # actually save the file\n File.open(full_path , \"wb\") {|f| f.write(params[:file].read)}\n File.chmod(0644, full_path)\n\n # execute callback task if present\n if params[:callback].present?\n # allowing system callbacks is a very serious security risk (but we still want them), so we drastically limit allowed characters\n callback = params[:callback].gsub(/[^a-z A-Z0-9=\\/\\.\\_-]/, '')\n system(\"cd #{Rails.root} && rake maintenance:#{callback}\")\n end\n\n # message for the user\n page['.file_upload_box .message'].attr 'class', 'message notice'\n page['.file_upload_box .message'].text 'Plik wgrany pomyślnie.'\n\n\n # simply_textile_editor integration (https://github.com/pjg/simply_textile_editor)\n # add the just uploaded file to the 'pictures' list and select the filename of the uploaded file but only if there is a picture insert box on the page\n page << \"\n if ($('.insert_picture_box #picture_filename').size() > 0 && typeof $.selectNewlyUploadedPicture == 'function') {\n $.selectNewlyUploadedPicture('#{full_path}')\n }\n \"\n end\n end\n end\n end",
"def on_post(path)\n acct = I3.server.remote_account\n local_path = DocumentFile::DOC_FILE_PATH + path\n \n # Sanity checks\n unless File.directory?(local_path)\n send_uploaded_file_response I3::NotFoundException.new(\n :message => \"The path '#{path}' could not be found.\")\n return\n end #unless\n \n if DocumentPlatform.check_permission(:write, acct, local_path).empty?\n send_uploaded_file_response I3::SecurityException.new(\n :message => \"You do not have permission to write to folder '#{path}'\")\n return\n end #if\n \n # We are good to go so far, so let's grab the file\n file = I3.server.cgi[\"fileToUpload\"]\n filename = file.filename\n \n # Internet Explorer will sometimes send the whole path. We only want the filename.\n filename = filename.split(\"\\\\\").last if filename =~ /\\w:\\\\/\n \n begin\n response = UploadedFile.save_as(filename, file, local_path)\n send_uploaded_file_response response\n \n rescue I3::SecurityException\n log.warn \"User #{acct.account_name} tried to upload a file to '#{path}' and was denied.\"\n send_uploaded_file_response $!\n \n rescue FileAlreadyExistsException\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n response = $!.to_shared\n response.temp_file = UploadedFile.save_as_temp(file)\n response.path = path\n response.original_filename = filename\n response.overwritable = (not DocumentPlatform.check_permission(\n :write, acct, File.join(local_path, filename)).empty?)\n send_uploaded_file_response response\n rescue\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n send_uploaded_file_response I3::ServerException.new(\n :title => \"Could not save file\", \n :message => $!.message )\n end #begin\n \n end",
"def upload_url\n return @upload_url\n end",
"def upload\n files_saved = 0\n # Build product images from upload\n\t\tparams[:file].each do |i|\n if i[:file_data] && !i[:file_data].blank?\n new_file = UserUpload.init(i[:file_data])\n if new_file.save\n files_saved += 1\n end\n end\n end\n \n flash[:notice] = \"#{files_saved} file(s) uploaded.\"\n \n if params[:modal]\n redirect_to :action => 'image_library' and return\n else\n redirect_to :action => 'index' and return\n end\n end",
"def new_files; end",
"def upload\n\t\t@musician = User.find_by_id(current_user)\n\t\tif !params[:user].nil?\n\t\t\t@musician.avatar = params[:user][:avatar]\n\t\t\t@musician.uploaded = true\n\t\tend\n\n\t\tif @musician.save\n\t\t\tredirect_to musician_path(@musician)\n\t\telse\n\t\t\t@musician.uploaded = false if params[:user][:avatar]\n\t\t\trender 'show'\n\t\tend\n\tend",
"def index\n @upload = Upload.new # Allow file uploads on index page via jq_fu\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @uploads }\n end\n end",
"def home\n @picture = Picture.new\n # @data = { 'form-data' => (@s3_direct_post.fields), 'url' => @s3_direct_post.url, 'host' => URI.parse(@s3_direct_post.url).host }\n end",
"def save_attached_files; end",
"def save_attached_files; end",
"def upload(major)\n unless File.exist?(major)\n puts \"File #{major} not found.\"\n return\n end\n major = File.absolute_path(major)\n response, success = ImgurAPI.upload(major)\n puts response unless success\n if success\n response = \"![#{options[:title].nil? ? 'Screenshot' : options[:title]}](#{response})\" if options[:markdown]\n response = build_HTML_response(response) if options[:html]\n puts \"Copied #{Platform.copy(response)} to clipboard\"\n end\n storage.save\n end",
"def multipart?; end",
"def upload_file_url\n \"file://#{upload_full_path}\"\n end",
"def upload_data_button_onclick\r\n aname = @@alib.remove_space(params[\"tbox_aname\"])\r\n datafile = params[\"tbox_datfile\"]\r\n\r\n error = @@alib.is_nil_log(datafile, \"Data File\")\r\n if (!error)\r\n lpath = @@alib.get_localpath(session[:cas_user], \"upload\")\r\n fname = @@alib.upload_txtfile(lpath, datafile)\r\n pid = @@slib.sql_get_1num(\"plate\", \"plate_id\", \"name = 'template'\")\r\n pwid = @@slib.sql_get_1num(\"pathway\", \"pathway_id\", \"name='template'\")\r\n\r\n assayfields = @@alib.new_arr10(session[:cas_user], fname, aname, 1, pid, \"\", \"\", \"\", pwid, 1)\r\n\r\n @@ulib.load_data(lpath, assayfields)\r\n end\r\n \r\n (func, title) = get_2_params()\r\n goto_upload_page1(func, title)\r\nend",
"def uploaded_file\n initalize_breadcrumb(\"Uploaded File(s)\", uploadedfile_datauploaders_path)\n currentUser = current_user.id\n @uploadedFiles = UserFileMapping.where(:user_id =>currentUser )\n respond_with(@uploadedFiles)\n end",
"def create\n @upload = current_user.uploads.build(upload_params)\n if @upload.save\n flash[:notice] = \"Successfully uploaded the file.\"\n if @upload.folder\n redirect_to browse_path(@upload.folder)\n else\n redirect_to root_url\n end\n else\n render :action => 'new'\n end\n end",
"def upload\n return if current_pstore.nil?\n fichier_synchro.upload\n flash \"PStore uploadé\"\n end",
"def upload_file\n @assignment = Assignment.find(params[:id])\n if ((@assignment.facebook_user.id == @fb_user.id) or (@assignment.is_author? @fb_user))\n @add_file_url = ActionController::Base.asset_host + \"/assignments/add_file/\"\n else\n flash[:alert] = \"You do not have permissions to add a file to that assignment.\"\n redirect_to @assignment\n end\n\n end",
"def create\n @upload = current_user.uploads.build(upload_params)\n if @upload.save \n flash[:notice] = \"Successfully uploaded the file.\"\n if @upload.folder #checking if we have a parent folder for this file \n redirect_to browse_path(@upload.folder) #then we redirect to the parent folder \n else\n redirect_to root_url \n end \n else\n render 'new'\n end\n end",
"def view_upload_csv\n @title_page = 'Upload questions'\n erb :upload, layout: :session\nend",
"def uploadImage\n post = DataFile.save(params[:upload], \"\")\n \n f = Family.where(turn: -1).first\n if f.nil?\n f = Family.new\n f.turn = -1\n f.save\n end\n \n f.name = post.to_s\n f.save\n \n # render :text => \"File has been uploaded successfully\"\n redirect_to :back\n end",
"def upload(file, someone)\n end",
"def home\n @page = Page.find_or_create_by(name: \"home\")\n @images = Dir.glob(\"app/assets/images/home_banner/cropped/*.jpg\")\n @twitter_client = get_twitter_client\n end",
"def getUploadfile\r\n\t\t\t\t\treturn @uploadfile\r\n\t\t\t\tend",
"def index\n\t\t@uploads = current_user.all_uploads.sort_by! { |x| x.heading.downcase }\n\tend",
"def create\n @home_page_file = HomePageFile.new(home_page_file_params)\n\n respond_to do |format|\n if @home_page_file.save\n format.html { redirect_to @home_page_file, notice: 'Home page file was successfully created.' }\n format.json { render action: 'show', status: :created, location: @home_page_file }\n else\n format.html { render action: 'new' }\n format.json { render json: @home_page_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_file_to_server id, content, size, page_count, extension = \".jpg\"\n\n @s.execute_file_post @s.url_for(\"system/pool/createfile.#{id}.page#{page_count}-#{size}\"), \"thumbnail\", \"thumbnail\", content, related_mimetype(extension)\n alt_url = @s.url_for(\"p/#{id}/page#{page_count}.#{size}\" + extension)\n @s.execute_post alt_url, {\"sakai:excludeSearch\" => true}\n log \"Uploaded image to curl #{alt_url}\"\nend",
"def cmd_upload\n raise NotImplementedError, \"Subclass must implement cmd_upload()\"\n end",
"def set_upload\n @upload = Upload.friendly.find(params[:id])\n end",
"def rawDataUpload()\n # prepare raw data for upload\n show do\n title \"Prepare to upload resulting analyzer data\"\n check \"Under <b>Analysis</b>. <b>Gel Image</b> tab, click <b>Select All</b>.\"\n check \"Under the <b>View</b> tab, check <b>Show Analysis Parameters</b>.\"\n #image \"frag_an_select_all\"\n end\n # save run\n show do\n title \"Save resulting analyzer data\"\n check \"Under the <b>Report</b> tab, click <b>Start Report/Export</b>.\"\n note \"Wait while the files are generated.\"\n check \"Under <b>File</b>-></b>Open Data Directory</b>, click <b>Export</b>.\"\n check \"Copy the following files with today's date, and paste into <b>Documents/Raw Data</b>:\"\n note \"_Rw\"\n note \"_Rw.csv\"\n note \"_Go_150dpi_1\"\n note \"_Ex_PeakCalling.csv\"\n #image \"frag_an_files_to_upload\"\n end\n # upload data \n show do\n title \"Upload resulting analyzer data\"\n note \"Upload the files ending in the following sequences:\"\n note \"_Rw\"\n upload var: \"Raw XML\"\n note \"_Rw.csv\"\n upload var: \"Raw CSV\"\n note \"_Go_150dpi_1\"\n upload var: \"Gel Image\"\n note \"_Ex_PeakCalling.csv\"\n upload var: \"Peak Calling CSV\"\n end\n end",
"def set_upload\n @upload = nil\n @upload = Upload.find(params[:upload_id]) if params[:upload_id]\n @upload = @content.upload if @upload.nil? && !@content.nil?\n end",
"def run_upload!\n \tself.status = 'En Proceso'\n \tsave\n end",
"def public_file_server=(_arg0); end",
"def public_file_server=(_arg0); end",
"def upload\n # connected to upload.html.haml form\n # looks for :zernike in params, existence means file is attached\n # significant help from \"http://www.tutorialspoint.com/ruby-on-rails/rails-file-uploading.htm\"\n if params[:zernike]\n uploaded_file = params[:zernike][:attachment]\n file_name = uploaded_file.original_filename\n jsonified_file = uploaded_file.as_json[\"tempfile\"]\n extract_data = coefficients_extractor(jsonified_file)\n @file = extract_data\n \n if @file.nil? or @file.empty?\n flash[:warning] = \"Unable to upload file\"\n # made it a \"warning\" instead of \"notice\" so we can change the colors/text\n else\n flash[:notice] = \"File successfully uploaded!\"\n end\n \n redirect_to zernikes_path\n end\n \n # if not @file.nil?\n # byebug\n # end\n # self.content = [TEXT INSIDE test.txt]\n # @file = params[:file]\n # byebug\n # @zernike = Zernike.\n # if @zernike.save\n # flash[:notice] = \"File successfully uploaded!\"\n # redirect_to \n # else \n # flash[:notice] = \"Unable to upload file\"\n \n # byebug\n # @file = params[:file]\n # if @file.nil? or @file.empty? \n # flash[:notice] = \"File is empty!\"\n # else \n # flash[:notice] = \"File successfully uploaded!\"\n # end\n \n end",
"def file_upload_wip()\n logger.debug \"\\r\\n\\r\\n!! ------ in upload/file_upload -----\"\n logger.debug params[:datafile].original_filename\n logger.debug params\n logger.debug \"\\r\\n!! ===========================\\r\\n\"\n is_successful = true\n\n if params[:datafile]\n tmp = params[:datafile].tempfile\n file = File.join( \"public/uploads\", params[:datafile].original_filename )\n FileUtils.cp tmp.path, file\n# \n # name = params[:datafile].original_filename\n # directory = \"public/uploads\"\n # path = File.join(directory, name)\n # File.open(path, \"wb\") { |f|\n # f.write( params[:datafile].read )\n # }\n else\n is_successful = false\n end\n\n redirect_to upload_path()\n end",
"def index\n \n \n\n if params[:file]\n @file = params[:file] \n p @file\n @path = \"/home/session[:user_name]/#{@file}\"\n @path.to_s.gsub!('\\.\\.' , '')\n if File.directory?(@path)\n @files = Dir.foreach(\"/home/session[:user_name]/#{@file}\") \n else\n send_file @path\n end\n else\n @path = \"/home/session[:user_name]\"\n @files = Dir.foreach(\"/home/session[:user_name]\")\n \n end\n\n\n \n end",
"def setUploadfile(uploadfile)\r\n\t\t\t\t\t@uploadfile = uploadfile\r\n\t\t\t\tend",
"def index\n @pictures=PictureSet.get params[:tag]\n render :file => (App.webmaster.join 'page'), :layout => false\n end",
"def index\n @uploads = Upload.all\n @upload = Upload.new\n end",
"def upload_file=(file_name)\n self.file_field(:id=>\"multifile_upload\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-oae/\" + file_name)\n end"
] |
[
"0.7539814",
"0.7244742",
"0.7215036",
"0.7215036",
"0.70458555",
"0.7022036",
"0.6785197",
"0.66328365",
"0.6632056",
"0.65708524",
"0.65152776",
"0.6508702",
"0.64537793",
"0.6414205",
"0.6407937",
"0.639302",
"0.63928306",
"0.6385388",
"0.63282716",
"0.6292313",
"0.6278396",
"0.6273231",
"0.6250055",
"0.6197199",
"0.61141926",
"0.60954034",
"0.6058713",
"0.6058713",
"0.6057454",
"0.60570383",
"0.6029182",
"0.59965044",
"0.59965044",
"0.59897035",
"0.59862936",
"0.5977216",
"0.5964309",
"0.59551924",
"0.5952862",
"0.59458476",
"0.5939775",
"0.5934178",
"0.5917916",
"0.5910091",
"0.59001833",
"0.5889888",
"0.58795816",
"0.58783233",
"0.5870539",
"0.5862173",
"0.5860338",
"0.58380455",
"0.58264434",
"0.58264434",
"0.58264434",
"0.58264434",
"0.58264434",
"0.58264434",
"0.58228624",
"0.58016163",
"0.58007425",
"0.57883185",
"0.57807845",
"0.5774554",
"0.57716966",
"0.576532",
"0.5757275",
"0.5735275",
"0.5734271",
"0.5734271",
"0.57135797",
"0.57133853",
"0.57131606",
"0.5695308",
"0.5688803",
"0.56880814",
"0.56854516",
"0.5684043",
"0.5682397",
"0.56810087",
"0.5679708",
"0.56782836",
"0.56742615",
"0.56737477",
"0.56684935",
"0.56651264",
"0.56584305",
"0.56573194",
"0.56532425",
"0.56506705",
"0.564725",
"0.5645707",
"0.56393135",
"0.56393135",
"0.56390256",
"0.5632727",
"0.5627842",
"0.5610352",
"0.5609263",
"0.5609026",
"0.56068146"
] |
0.0
|
-1
|
unless you yield or call to the block:
|
def hello
"hello"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block?; end",
"def yield; end",
"def block\n true\n end",
"def block_given?() end",
"def captured_by_block?; end",
"def block_node; end",
"def block_node; end",
"def run_block\n yield\nend",
"def i_take_a_block\n yield\nend",
"def callBlock\n yield\n yield\nend",
"def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"def return(&block); end",
"def captured_by_block; end",
"def run_block_proc\n yield\nend",
"def blocks() end",
"def just_yield\n yield\nend",
"def callBlock\n yield # Invokes block\n yield # Invokes block again\nend",
"def return_block\n yield\nend",
"def run_this_for_me\n\tyield\nend",
"def run_block # this is a method that accepts a block and yields action to block once method is called (just like map or each)\n yield if block_given? # prevents error if no block is run with method invocation; only use this if you have a specific reason for it, otherwise, it's best to fail and fail early\nend",
"def foo\n # Call the block\n yield\n yield\nend",
"def foo\n # Call the block\n yield\n yield\nend",
"def block_method\n yield if block_given?\nend",
"def call_block\n @_block.call(self) if @_block\n end",
"def gimme\n if block_given?\n yield\n else\n puts \"I'm blockless!\"\n end\nend",
"def block_method\nputs \"called outside block in block_method\"\n#add method, to check if there is a block on this method\nyield if block_given? #predicate method, it have question mark on end\nputs \"now we are returning again to block\"\nend",
"def accept_nonblock\r\n end",
"def try\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend",
"def rblock\n if block_given?\n # yield execute the block\n yield\n else\n puts \"No block\"\n end\n end",
"def call_block \n yield('hello', 99) \nend",
"def call_block \n yield('hello', 99) \nend",
"def one_yield\n yield\n end",
"def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend",
"def try\n if block_given?\n yield\n else\n puts 'no block'\n end\nend",
"def callBlock\n yield ,\n end",
"def block_checker\n block_given?\nend",
"def gimme_your_blocks\n yield if block_given?\nend",
"def run(&block)\n end",
"def with_block(&block)\n end",
"def run(&block); end",
"def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend",
"def foo\n if block_given?\n # Call the block\n yield\n else\n puts \"Sem parâmetro do tipo bloco\"\n end\nend",
"def do_something\n yield if block_given?\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def run\n yield\n end",
"def process(&block); end",
"def ar\n yield if block_given? && ar?\n end",
"def require_block; end",
"def will_run_block\n # when you use yield, you'll call the block\n yield\n puts 'End'\nend",
"def record_block\n @block = true\n end",
"def yield\n @eff.yield.perform\n end",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def run\n block.call\n end",
"def execute\n yield self if block_given?\n end",
"def if_block_given\n p \"hoge\"\n yield if block_given?\n p \"end\"\nend",
"def method\n puts block_given?\n if block_given?\n yield\n end\nend",
"def block_test\n puts \"we are in the method\"\n puts \"Yielding to the block\"\n yield\n puts \"We are back in the method\"\n\nend",
"def block_method\n puts \"This is printing from the method.\"\n yield(\"Alice\", \"Bill\")\n yield(\"Dan\", \"Carlos\")\n yield\n puts \"This is printing from the method again.\"\nend",
"def block_sample\n p \"AAA\"\n yield\n p \"BBB\"\nend",
"def take_this\n\tyield \"present\"\nend",
"def block=(_arg0); end",
"def block=(_arg0); end",
"def test_block\n\tputs \"You are in the method\"\n\tyield\n\tputs \"You are again back to the method\"\n\tyield\nend",
"def explicit_block(&sloth)\n sloth.call # same as yield\nend",
"def block_method1\n yield\nend",
"def do_something\n value = yield('Hello world') if block_given?\n puts \"The block returned #{value}\"\nend",
"def accept_nonblock(*) end",
"def accept_nonblock(*) end",
"def accept_nonblock(*) end",
"def pass_control_on_condition\n puts \"Inside the method\"\n yield if block_given? #only if the block present the yield will be executed\n # or yield\n # end\n puts \"Back inside the method\"\nend",
"def generate_next\n @block.call(@so_far)\n end",
"def block_test\r\n puts \"We're in the method!\"\r\n puts \"Yielding to the block...\"\r\n yield\r\n puts \"We're back in the method!\"\r\nend"
] |
[
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8364825",
"0.8074893",
"0.7929169",
"0.7578412",
"0.7463051",
"0.7462534",
"0.73702013",
"0.73702013",
"0.73503685",
"0.729674",
"0.72890615",
"0.72456884",
"0.7227105",
"0.7227105",
"0.7227105",
"0.72169113",
"0.7210871",
"0.7194908",
"0.7194243",
"0.7185405",
"0.7156074",
"0.7131909",
"0.7084069",
"0.70632255",
"0.7044388",
"0.7044388",
"0.704355",
"0.7043235",
"0.70384395",
"0.7023666",
"0.70010537",
"0.6996788",
"0.6993292",
"0.6988301",
"0.6988301",
"0.69710577",
"0.6969465",
"0.69622755",
"0.69488955",
"0.6939131",
"0.69378245",
"0.6903927",
"0.6895212",
"0.6895139",
"0.6853678",
"0.6839265",
"0.68385905",
"0.6813835",
"0.6813835",
"0.6813835",
"0.6813835",
"0.6813835",
"0.6813085",
"0.67945814",
"0.6787447",
"0.67836493",
"0.6774865",
"0.6772615",
"0.6765982",
"0.6759677",
"0.6759677",
"0.6759677",
"0.6755134",
"0.67518044",
"0.6748626",
"0.6748152",
"0.6744372",
"0.67420363",
"0.6736611",
"0.6734278",
"0.6720079",
"0.6720079",
"0.6711221",
"0.67027175",
"0.67014253",
"0.66979027",
"0.6688395",
"0.6688395",
"0.6688395",
"0.66869223",
"0.6683909",
"0.66837645"
] |
0.0
|
-1
|
Here we yield to the block on line 22 then execute the rest of the method
|
def say(words)
yield
puts words
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def yield; end",
"def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend",
"def run_this_for_me\n\tyield\nend",
"def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend",
"def callBlock\n yield\n yield\nend",
"def call_block \n yield('hello', 99) \nend",
"def call_block \n yield('hello', 99) \nend",
"def yield\n @eff.yield.perform\n end",
"def run_block\n yield\nend",
"def execute\n yield self if block_given?\n end",
"def blocks() end",
"def return(&block); end",
"def my_method\n puts \"inside my method\"\n yield\nend",
"def run\n yield\n end",
"def foo\n #chamar um block\n yield #quando passarmos o block como parametro sera executado no lugar do yield\n yield #sera executado 2 vezes\nend",
"def block_method\n puts \"This is printing from the method.\"\n yield(\"Alice\", \"Bill\")\n yield(\"Dan\", \"Carlos\")\n yield\n puts \"This is printing from the method again.\"\nend",
"def generate_next\n @block.call(@so_far)\n end",
"def foo\n # Call the block\n yield\n yield\nend",
"def foo\n # Call the block\n yield\n yield\nend",
"def run(&block); end",
"def block?; end",
"def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend",
"def run_block # this is a method that accepts a block and yields action to block once method is called (just like map or each)\n yield if block_given? # prevents error if no block is run with method invocation; only use this if you have a specific reason for it, otherwise, it's best to fail and fail early\nend",
"def block_method\nputs \"called outside block in block_method\"\n#add method, to check if there is a block on this method\nyield if block_given? #predicate method, it have question mark on end\nputs \"now we are returning again to block\"\nend",
"def met\n yield 1\n puts \"This is method\"\n yield 2\nend",
"def process(&block); end",
"def call_block2\n yield(\"hello\",4)\nend",
"def yield_block_example()\n puts \"Start of yield block example\"\n yield('example of param passing')\n puts \"End of yield block example\"\nend",
"def run_block_proc\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def i_take_a_block\n yield\nend",
"def greeter\n puts \"in the method\"\n puts \"yielding to block\"\n yield\n puts \"back in method\"\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def aMethod\n puts 'In aMethod'\n yield\nend",
"def miltiple_pass\n puts \"Inside the method\"\n yield\n puts \"Back inside the method\"\n yield\nend",
"def method_with_yield_1\n some_code\n yield\n some_code\n end",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"def callBlock\n yield ,\n end",
"def method\n\tputs \"This is our method\"\n\tyield(\"bob\", \"nancy\")\nend",
"def met\n puts \"This is method\"\n yield\n puts \"You will be back to method\"\n yield\nend",
"def call_block2\n yield(\"hello\", 99)\nend",
"def MyBlockMethod()\n puts \"At the top of the method\"\n\tyield\n\tputs \"At the bottom of the method\"\nend",
"def block_test\n\n puts \"We're in the method!\"\n puts \"Yielding to the block...\"\n yield #this expression allows the method to receive and execute a block\n puts \"We're back in the method!\"\nend",
"def my_method2\n puts \"We are in the method\"\n yield\nend",
"def callBlock\n yield # Invokes block\n yield # Invokes block again\nend",
"def test\n yield 5\n puts \"You are in the method test\"\n yield 100\nend",
"def test\n yield 5\n puts \"You are in the method test\"\n yield 100\nend",
"def foo\n\n yield # executa um bloco passado por parametro (so pode passar 1)\n yield \nend",
"def calculate\n puts \"#{3+4} is equal to 7\"\n yield\n yield\n puts \"after this is block\"\n\nend",
"def multiple_pass\n puts \"Inside the method\"\n yield\n puts \"Back inside the method\"\n yield\nend",
"def run(&block)\n end",
"def block_test\n puts \"we are in the method\"\n puts \"Yielding to the block\"\n yield\n puts \"We are back in the method\"\n\nend",
"def hello\n puts \"I am inside the method\"\n yield\nend",
"def yield_practice\n p \"in the method\"\n yield(\"jamal\")\n p 'back in the method'\nend",
"def execute(&block)\n block.call\n puts \"End of block\"\nend",
"def block_method1\n yield\nend",
"def return_block\n yield\nend",
"def test\n yield 5, 15\n puts \"You are in the method test\"\n yield 100\nend",
"def multiple_pass_control\n puts \"Inside the method\"\n yield\n puts \"Back inside the method\"\n yield\nend",
"def my_method(*args)\n # yield()\n # yield(self)\n # yield(\"booyaka\")\n # yield(\"booyaka\", \"come and get it\")\n yield(args)\nend",
"def test\n yield 5, \"lobby\"\n puts \"You are in the method test\"\n yield 100, \"door\"\nend",
"def call_block\n puts 'Start'\n yield\n yield\n puts 'End'\nend",
"def block_test\r\n puts \"We're in the method!\"\r\n puts \"Yielding to the block...\"\r\n yield\r\n puts \"We're back in the method!\"\r\nend",
"def test_block\n\tputs \"You are in the method\"\n\tyield\n\tputs \"You are again back to the method\"\n\tyield\nend",
"def multiple_pass\n puts \"Inside the method\"\n yield if block_given? # Invoke block only it is given \n puts \"Back inside the method\"\n yield if block_given?\n yield if block_given?\n yield if block_given?\n yield if block_given?\nend",
"def method_name\n puts \"im in the method\"\n yield\n puts \"im back in the method\"\nend",
"def do_something\n puts \"before the block\"\n yield\n puts \"after the block\"\nend",
"def metodo_2\n yield if block_given? #el metodo se ejecuta con o sin metodo metodo_2()\nend",
"def aMethod\n yield\nend",
"def meth1\n\tyield('Hi World')\n\t'Something!!'\nend",
"def my_method\n puts \"hello\"\n yield if block_given?\n puts \"goodbye\"\nend",
"def parse_yield(context, single, tk, method)\n return if method.block_params\n\n get_tkread\n method.block_params = parse_method_or_yield_parameters\n end",
"def will_run_block\n # when you use yield, you'll call the block\n yield\n puts 'End'\nend"
] |
[
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7752462",
"0.7741243",
"0.7475723",
"0.7375506",
"0.7364266",
"0.7292715",
"0.7187787",
"0.7187787",
"0.7154064",
"0.71314067",
"0.71247625",
"0.709773",
"0.70890516",
"0.70803845",
"0.70708",
"0.70638365",
"0.70502156",
"0.70500267",
"0.70440876",
"0.70440876",
"0.70311946",
"0.70260936",
"0.70250386",
"0.70231426",
"0.70148855",
"0.7007523",
"0.7000388",
"0.6971078",
"0.6969788",
"0.6968939",
"0.69555587",
"0.69555587",
"0.69555587",
"0.69555587",
"0.69555587",
"0.6953406",
"0.69512516",
"0.6949229",
"0.6949229",
"0.6949229",
"0.69381213",
"0.6937027",
"0.6921737",
"0.6918422",
"0.6918422",
"0.6918422",
"0.6912971",
"0.6905628",
"0.6886163",
"0.6874268",
"0.68692005",
"0.6863682",
"0.6860202",
"0.6859434",
"0.6857938",
"0.6851153",
"0.68504816",
"0.68330336",
"0.68197733",
"0.6810358",
"0.68004656",
"0.679763",
"0.6790126",
"0.6786652",
"0.6782891",
"0.6774405",
"0.6764708",
"0.67604464",
"0.67561257",
"0.6753663",
"0.67478794",
"0.67458665",
"0.67413825",
"0.6737747",
"0.6734899",
"0.6728727",
"0.67200994",
"0.671735",
"0.6716462",
"0.671528",
"0.67147726",
"0.67147464"
] |
0.0
|
-1
|
Hello the block executes (because it's the first line in the method implementation) World! then the rest of the method is evaluated => nil nil is returned at puts is the last expression evaluated and always returns nil
|
def say(words)
yield if block_given?
puts "> " + words
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hello_world(&block)\n puts block.call\nend",
"def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend",
"def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend",
"def hello(&block)\n puts block\n block.call\nend",
"def puts_this_block\n puts yield\nend",
"def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend",
"def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend",
"def hello\n puts \"I am inside the method\"\n yield\nend",
"def hello(&block)\n\tblock.call if block_given?\nend",
"def greeter\n puts \"in the method\"\n puts \"yielding to block\"\n yield\n puts \"back in method\"\nend",
"def say_hello(&block)\n puts \"Hello world\"\n name = block.call\n puts \"You entered #{name} as your name\"\nend",
"def print_world\n \"World\"\nend",
"def my_method\n puts \"hello\"\n yield if block_given?\n puts \"goodbye\"\nend",
"def greeter()\n yield\nend",
"def simple\n puts 'Here comes the code block!'\n yield\n puts 'There was the code block!'\nend",
"def do_something\n value = yield('Hello world') if block_given?\n puts \"The block returned #{value}\"\nend",
"def meth1\n\tyield('Hi World')\n\t'Something!!'\nend",
"def greeter\n yield\t\t# yields to block\nend",
"def hello\n\tyield\nend",
"def greet\n yield('Wake up', 'Neo')\nend",
"def hello_world(name)\n puts \"Hello, #{name}\"\n return \"Finished\"\nend",
"def hug \n puts \"{\"\n yield if block_given?\n puts \"}\"\nend",
"def say(words)\n yield\n puts words\nend",
"def greeting\n name = (yield if block_given?) || \"Stranger\"\n puts \"Hello! #{name}\"\nend",
"def print_func\n puts \"We are not inside of the method\"\n yield\n puts \"We are back inside the method\"\nend",
"def say_hello(&block)\n puts \"Hello, world\"\n \n # One advantage of yield is that you can run that code\n # any number of times, so let's go ahead and put yield \n # again.\n yield\n yield\n puts \"I said hello\"\nend",
"def block_message_printer\n message = \"Welcome to Block Message Printer\"\n if block_given?\n yield\n end\n puts \"But in this function/method message is :: #{message}\"\nend",
"def say_hello\n return\n puts \"Hello!\" #this code will never be reached\nend",
"def hello(str)\n yield\n str\nend",
"def say_goodbye \n puts \"Thanks for running the program! This function was passed into a block using the yield keyword.\"\nend",
"def method_that_takes_a_block(&blk)\n p blk.call(\"hello\")\n p blk.call(\"World!\")\nend",
"def say_hi(name)\r\n\tputs \"Hi #{name.capitalize}\"\r\n\tyield (name.capitalize, name.reverse.capitalize) if block_given?###only returns if block is true\r\nend",
"def block_print\r\n\tputs \"Before the block!\"\r\n\tyield(10)\r\n\tputs \"After the block!\"\r\nend",
"def speak_the_truth\n yield \"Boris\" if block_given?\nend",
"def ouch(body_part)\n puts \"Im in the method\"\n puts \"Ouch my #{body_part} hurts\"\n yield(\"John\")\nend",
"def execute(&block)\n block.call\n puts \"End of block\"\nend",
"def program_logger(block_description, &block)\n\n puts \"Started block #{block_description}.\"\n result = block.call\n puts \"#{block_description} finished, returning: #{result}\"\n\nend",
"def yielder\n puts 'STARTING YIELDING'\n yield if block_given?\n puts 'END YIELDING'\nend",
"def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend",
"def method3(&block)\n if block\n \"The block evaluates to #{block.call}\"\n else\n \"No block.\"\n end\nend",
"def execute(&block)\n puts block.call\nend",
"def greeter\n yield\nend",
"def greeter\n yield\nend",
"def greeter\n yield\nend",
"def pets\n yield\n puts \"Luna\"\n puts \"B\"\nend",
"def hello_world \n puts \"This is a crazy part of the world\"\n end",
"def i_take_an_explicit_block &block\n puts block.inspect\nend",
"def greeter\n yield\nend",
"def greeter\n yield\nend",
"def greeter\n yield\nend",
"def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend",
"def lol_wut\n puts \"lol wut\"\n yield(\"Dave\",\"lol\")\n yield(\"Andy\",\"wut\")\n puts \"no more luls\"\nend",
"def greet(name)\n return puts \"Hello, #{name} how are you doing today?\"\nend",
"def method\n puts block_given?\n if block_given?\n yield\n end\nend",
"def will_run_block\n # when you use yield, you'll call the block\n yield\n puts 'End'\nend",
"def if_block_given\n p \"hoge\"\n yield if block_given?\n p \"end\"\nend",
"def who_am_i\n adjective = yield\n puts \"I am very #{adjective}\"\nend",
"def who_am_i\n adjective = yield\n puts \"I am very #{adjective}\"\nend",
"def who_am_i\n adjective = yield\n puts \"I am very #{adjective}\"\nend",
"def who_am_i\n adjective = yield\n puts \"I am #{adjective}\"\nend",
"def another_greet(greeting, name)\n puts \"#{greeting}, #{name}!\"\n yield('Wake up', 'Neo')\nend",
"def print_the_value_returned_by_the_block\n if block_given?\n value = yield\n puts \"The block returned #{value}\"\n end\nend",
"def print_the_value_returned_by_the_block\n if block_given?\n value = yield\n puts \"The block returned #{value}\"\n end\nend",
"def print_me_2\n \"I'm printing the return value!!!\"\nend",
"def log(block_description, &block)\n puts \"Beginning #{block_description}...\"\n value_returned = block.call\n puts \"...#{block_description} finished, returning\"\n puts value_returned\nend",
"def say_hello(anything)\n # write code\n puts anything\n puts \"Hello World!\"\nend",
"def printer\n\tputs \"I hope this prints...\"\n\tyield(\"John\", \"Thomas\")\nend",
"def yield_return\n p yield\nend",
"def do_something_with_an_arg\n yield(\"Hello world 3\") if block_given?\nend",
"def print_result(&block)\n result_from_block = block.call()\n puts result_from_block\nend",
"def block_message_printer\n message = \"Welcome to Block Message Printer\"\n if block_given?\n proc.call\n end\n puts \"But in this function/method message is :: #{message}\"\n end",
"def hello\n puts \"Hello Dude!!!\"\n puts \"Hellod Douchebag!!!\"\nend",
"def return_test\n\tl = lambda { return }\n\tl.call\n\tputs \"Still here!\"\n\tp = Proc.new { return }\n\tp.call\n\tputs \"You won't see this message!\"\nend",
"def calculate\n puts \"#{3+4} is equal to 7\"\n yield\n yield\n puts \"after this is block\"\n\nend",
"def say_hello\n\tstudent1 = \"Adam\"\n\tstudent2 = \"Connor\"\n\tstudent3 = \"Jen\"\n\tstudent4 = \"Lindsay\"\n\n\tp \"Status: before\"\n\n\tputs \"Hello students! I wanted to welcome all of my new students to class!\"\n\tyield(student1, student2, student3, student4)\n\n\tp \"Status: after\"\n\nend",
"def run\n\t\t\t\t@wrapper.run do |command|\n\t\t\t\t\t@log.puts \"-> #{command.inspect}\"\n\t\t\t\t\t\n\t\t\t\t\tresult = yield command\n\t\t\t\t\t\n\t\t\t\t\t@log.puts \"<- #{result.inspect}\"\n\t\t\t\t\t\n\t\t\t\t\tnext result\n\t\t\t\tend\n\t\t\tend",
"def hola &block\n puts block.class.name #esta linea nos dice que esto es un proc\n block.call\nend",
"def assert\n\traise \"Something's not right.\" unless yield\n\tputs yield\nend",
"def call_block \n yield('hello', 99) \nend",
"def call_block \n yield('hello', 99) \nend",
"def log desc, &block\r\n puts \"Beginning #{desc.inspect}...\"\r\n result = block[]\r\n puts \"...#{desc.inspect} finished, returning: #{result}\"\r\nend",
"def gimme\n if block_given?\n yield\n else\n puts \"I'm blockless!\"\n end\nend",
"def my_method(&my_block)\n\n puts \"hello method\"\n\n my_block.call\n\n return my_block\n\nend",
"def run(&block)\n end",
"def block_sample\n p \"AAA\"\n yield\n p \"BBB\"\nend",
"def test_progs_and_lambdas\n yield \n puts \"Hello\"\nend",
"def print_block_result\n block_result = yield\n puts block_result\nend",
"def get_toy(&block)\n block.call(\"stuffed mouse\")\n end",
"def miltiple_pass\n puts \"Inside the method\"\n yield\n puts \"Back inside the method\"\n yield\nend",
"def puts_done()\n puts \"I got nothin.\"\nend",
"def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def name\n puts \"you are in the Method.\"\n yield\n end",
"def foo(arg)\n puts 'in foo'\n if block_given?\n puts 'block provided, executing it now'\n yield(arg)\n else\n puts 'no block provided, nothing to execute'\n end\nend",
"def optional\n puts 'A code block isn\\'t required, but it\\'s nice.'\n yield if block_given? #Kernel#block_given?\n puts 'I\\'m happy either way, really.'\nend",
"def block_testing\r\n student1 = \"John\"\r\n student2 = \"Jane\"\r\n puts \"The student has not begun racing yet.\"\r\n yield(student1, student2)\r\nend",
"def scream(word)\n word = word + \"!!!\"\n return puts \"#{word}\" #<--------\nend",
"def my_method(&my_block)\n puts \"hello method\"\n my_block.call\n return my_block\nend"
] |
[
"0.7029063",
"0.7000186",
"0.7000186",
"0.68835276",
"0.6721916",
"0.6712578",
"0.6712578",
"0.66419613",
"0.66212165",
"0.64980346",
"0.64818966",
"0.647526",
"0.6347402",
"0.6341181",
"0.633767",
"0.6320346",
"0.63184357",
"0.6309011",
"0.6307766",
"0.6306559",
"0.62841207",
"0.62767065",
"0.6256684",
"0.62472576",
"0.62420493",
"0.6222822",
"0.6222302",
"0.6222122",
"0.6216291",
"0.621591",
"0.6198391",
"0.6193072",
"0.61738044",
"0.61632055",
"0.61549544",
"0.6153593",
"0.61475074",
"0.6146585",
"0.6138352",
"0.6138352",
"0.61346614",
"0.61342555",
"0.61342555",
"0.61342555",
"0.61169094",
"0.61123586",
"0.6107882",
"0.61050546",
"0.61050546",
"0.61050546",
"0.60846937",
"0.6064075",
"0.60500807",
"0.6042382",
"0.60189795",
"0.6001338",
"0.59964955",
"0.59964955",
"0.59964955",
"0.59893036",
"0.5978836",
"0.5954767",
"0.5954767",
"0.59545213",
"0.59472287",
"0.5942199",
"0.59418684",
"0.59313005",
"0.5926476",
"0.5920605",
"0.5918764",
"0.5916126",
"0.5894563",
"0.5886009",
"0.5885918",
"0.5868328",
"0.5867483",
"0.58572644",
"0.5851696",
"0.5851696",
"0.5845998",
"0.5845375",
"0.5845088",
"0.58343726",
"0.5828651",
"0.58248377",
"0.5824816",
"0.58202636",
"0.5815257",
"0.5813395",
"0.5809917",
"0.58054656",
"0.58054656",
"0.58054656",
"0.58012533",
"0.5797517",
"0.5792462",
"0.578908",
"0.5788493",
"0.5786073"
] |
0.63480604
|
12
|
Constantize full class name to allow methods to be sent to class
|
def modularized_class
"NameDrop::Resources::#{resource_class_name}".constantize
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def underscorized_classname\n self.class.name.split(\"::\").last.\n gsub( /([A-Z]+)([A-Z][a-z])/, '\\1_\\2' ).\n gsub( /([a-z\\d])([A-Z])/, '\\1_\\2' ).downcase\n end",
"def safe_class_name()\n self.class.name.downcase.gsub(/[^\\d\\w]/, '_')\n end",
"def full_class_name\n @class_names.join(\"::\")\n end",
"def to_class_name\n self.to_method_name.gsub(/\\/(.?)/) { \"#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n end",
"def to_class_name\n parts = downcase.split('/')\n parts.each(&:capitalize!)\n parts.join('').gsub(%r{-}, '')\n end",
"def class_name\n self.fullname[/\\A(.*)([\\.\\#])([^\\.\\#]+)\\z/, 1]\n end",
"def class_name(name)\n name, anchor = name.to_s.split(\"#\", 2)\n name = File.basename(name, \".json\")\n name = name + \"_\" + anchor if anchor.present?\n name.gsub(/[^\\w]/, \"_\").camelcase\n end",
"def class_name\n Jaspion::Kilza::Class.normalize(@original_name)\n end",
"def class_name_for(object)\n object.name.split('.').first.downcase.tr('_', '-')\n end",
"def variable_name_to_class_name(name)\n name.to_s.\n gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.\n gsub(/(?:^|_)(.)/) { $1.upcase }\n end",
"def variable_name_to_class_name(name)\n name.to_s.\n gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.\n gsub(/(?:^|_)(.)/) { $1.upcase }\n end",
"def class_name\n self.class.name.split(\"::\").last.downcase\n end",
"def full_name\n decorated_class_name = case self.klass_flags\n when 0x2\n \"<Class::#{klass_name}>\"\n when 0x4\n \"<Module::#{klass_name}>\"\n when 0x8\n \"<Object::#{klass_name}>\"\n else\n klass_name\n end\n\n \"#{decorated_class_name}##{method_name}\"\n end",
"def class_name method_name\n segments = method_name.split('::')\n return segments[0..-2].join('::') if segments.count > 1\n \"Object\"\nend",
"def class_name\n @class_name ||= (@options[:class_name] || @name).to_s.camelize\n end",
"def full_name\n klass.name\n end",
"def class_name\n Heroics.camel_case(name)\n end",
"def classname\n @classname ||= self.class.name.split(\"::\")[1..-1].join(\"::\")\n end",
"def formatted_class_name(class_name)\n class_name = class_name.split(':')[-1]\n (class_name.gsub!(/(.)([A-Z])/, '\\1_\\2') || class_name).upcase\n end",
"def action\n self.class.name.split(\"::\").last.tap do |class_name|\n class_name[0] = class_name[0].downcase\n end\n end",
"def class_name\n @class_name ||= derive_class_name\n end",
"def to_class_name\n to_s.gsub('&', 'and').gsub(/[\\- ]/, '_').camelize(:upper)\n end",
"def class_name\n self.class.to_s.split('::').last\n end",
"def construct_klass(name)\n name.to_s.split('_').map{|i|i.capitalize}.join\n end",
"def name_and_class\n [name, self['class']].compact.join('.')\n end",
"def class_name\n self.to_s.demodulize.underscore\n end",
"def className _args\n \"className _args;\" \n end",
"def base_filename; class_to_filename(name.gsub(/.*:/, '')); end",
"def class_name\n self.class.name.split(\"::\").last\n end",
"def full_name\n @full_name ||= \"#{@klass}##{@method_name}\"\n end",
"def sanitize_class_name(name)\n name.gsub(/[^_0-9A-Za-z:]/, '')\n end",
"def cr_class_name(attr_name)\n instance_var = attr_name.gsub('/','_').downcase()\n instance_var.gsub!(' ','_')\n instance_var = instance_var.gsub('-','_')\n class_name = \"Cr\" + camelise(instance_var)\n return class_name\nend",
"def class_name_to_variable_name(name)\n name.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def class_name_to_variable_name(name)\n name.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def class_name\r\n r = \"\"\r\n up = true\r\n each_byte do |c|\r\n if c == 95\r\n if up\r\n r << \"::\"\r\n else\r\n up = true\r\n end\r\n else\r\n m = up ? :upcase : :to_s\r\n r << (c.chr.send(m))\r\n up = false\r\n end\r\n end\r\n r\r\n end",
"def name\n camel = self.class.to_s.gsub(/.*::/, '')\n camel.gsub(/(\\S)([A-Z])/, '\\1_\\2').downcase\n end",
"def pretty_class_name\n return self.class.to_s.split(/(?=[A-Z])/).join(' ')\n end",
"def convert_class(klass)\n ::ActiveSupport::Inflector.underscore(klass.name).gsub(\"/\", \"_\")\n end",
"def class_name; end",
"def class_name; end",
"def name_from_object(class_name)\n class_name.split('::').last\n end",
"def namespaced_class_name(name)\n class_name = \"#{name.split('/').map(&:camelize).join('::')}Controller\"\n if @namespaces.empty?\n class_name\n else\n @namespaces.map { |namespace| \"#{namespace.camelize}::\" }.join('') + class_name\n end\n end",
"def specialize_method_name( name )\n return \"#{name}#{self.class.name.split(\"::\")[-1].gsub(/[A-Z]/){|s| \"_#{s.downcase}\"}}\".intern\n end",
"def base_class_name\n split('::').last\n end",
"def pearified_classname\n self\n end",
"def name\n @class_name\n end",
"def make_key class_name\n name = class_name.to_s.pluralize.gsub(/::/, '__').underscore\n only_last_part_plural(name).to_sym\n end",
"def klass_name\n \"#{params[:klass_name].classify}\"\n end",
"def safe_constantize\n ActiveSupport::Inflector.safe_constantize(self)\n end",
"def class_name_for(file_name)\n file_name.split(/\\//).last.sub(/\\.rb$/, '').split(/_/).map do |s|\n s.capitalize\n end.join('')\n end",
"def retain_class_name\n @retain_class_name ||= \"Retain::\" + my_class_name.to_s.sub(/.*::/, \"\")\n end",
"def ruby_classname_to_java(class_name:)\r\n\r\n parts = class_name.to_s.split('::')\r\n packageless_class_name = parts.pop\r\n\r\n parts.map! do |package_part|\r\n package_part[0] = package_part[0].downcase\r\n package_part\r\n end\r\n\r\n parts << packageless_class_name\r\n parts.join('.')\r\n end",
"def class_name object\n return object.class.to_s.split(/(?=[A-Z])/).join(' ')\n end",
"def class_to_filename (c)\n c.split(/::/).map {|i| i.gsub(/([A-Z])/, '_\\1').sub(/_/, '').downcase}.\n join('/')\nend",
"def class_name_for(module_name, name)\n \"#{module_name}::#{class_name(name)}\"\n end",
"def class_name()\n return self.id.downcase.gsub(/\\Ah?l_/i, \"\")\n end",
"def underscore\n class_name.to_s.underscore\n end",
"def classname(name)\n [@lexer.namespace, name].join(\"::\").sub(/^::/, '')\n end",
"def class_name\n klass = single_class\n while klass.name == ''\n klass = klass.superclass\n end\n if list_context?\n \"[#{klass}]\"\n else\n klass.name\n end\n end",
"def generate\n base_name = camel_case identifier.to_s\n decorate_klass_name base_name\n end",
"def target_class_name\n options[:class_name] || name.to_s.classify\n end",
"def name\n self.class.name.downcase\n end",
"def class_name\n name = @klass.name\n name.name\n end",
"def make_queue_name(klass)\n name = klass.dup\n name.gsub!(/::/, '/')\n name.gsub!(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n name.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n name.tr!(\"-\", \"_\")\n name.downcase!\n name\n end",
"def downcased_class_name(obj)\n obj.class.to_s.downcase\n end",
"def name\n klass.name.split('::').last\n end",
"def definition\n \"class #{full_name}\"\n end",
"def parse_classname(full_cname)\n names=full_cname.split(\"::\")\n return names[0..-2].join('::'), names[-1], names.join(\"/\") \n end",
"def name\n has_module?(klass) ? klass[(klass.index(\"::\")+2)..-1] : klass\n end",
"def name\n self.class.name.split(\"::\").last.downcase\n end",
"def _class\n special_attribute('@class'.freeze) || self.class.name.demodulize\n end",
"def class_name\n fetch('heroes_of_the_storm.class_names')\n end",
"def name\n self.class.to_s.gsub(/controller$/i, \"\")\n end",
"def class_name_id object\n return object.class.to_s.split(/(?=[A-Z])/).join('-').downcase\n end",
"def class_name(table_name = table_name) # :nodoc:\n # remove any prefix and/or suffix from the table name\n class_name = Inflector.camelize(table_name[table_name_prefix.length..-(table_name_suffix.length + 1)])\n class_name = Inflector.singularize(class_name) if pluralize_table_names\n return class_name\n end",
"def combined_class_name\n @combined_class_name ||= \"Combined::\" + my_class_name.to_s.sub(/.*::/, \"\")\n end",
"def safe_constantize\n MotionSupport::Inflector.safe_constantize(self)\n end",
"def constantize(klass_string) \n BentoSearch::Util.constantize(klass_string) \n end",
"def class_unqualified_name(clazz)\n name = clazz.name\n if name =~ /::([^:]+)$/\n $1\n else\n name\n end\n end",
"def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end",
"def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end",
"def name\n n = self.class.name\n n.gsub!( /::/, '.' )\n n.gsub( /(\\w)\\w+\\./ ) { |m| $1.downcase + '.' }\n end",
"def validate_class_name(name)\n only_basic_type(name) || name.gsub(/-/, \"_\").camelcase\n end",
"def class_name_to_attribute_name(name)\n name.gsub(/([a-z]+)([A-Z])/, '\\1_\\2').gsub('-', '_').downcase\n end",
"def class_name_to_attribute_name(name)\n name.gsub(/([a-z]+)([A-Z])/, '\\1_\\2').gsub('-', '_').downcase\n end",
"def class_name_to_attribute_name(name)\r\n name.gsub(/([a-z]+)([A-Z])/, '\\1_\\2').gsub('-', '_').downcase\r\n end",
"def class_name_to_attribute_name(name)\r\n name.gsub(/([a-z]+)([A-Z])/, '\\1_\\2').gsub('-', '_').downcase\r\n end",
"def command_name\n klass_name = self.class.name.split('::').last\n command = klass_name.gsub(/([^\\^])([A-Z])/, '\\1_\\2').downcase\n command\n end",
"def stripped_class_name\n name.demodulize\n end",
"def class_names op, deep_inheritance=false\n raise \"#{self.class}.class_names not implemented\"\n end",
"def prefixed_class_name(prefix)\n (class_path + [\"#{prefix}_#{file_name}\"]).map!(&:camelize).join(\"::\")\n end",
"def underscore(class_name)\n class_name.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def klass\n name.gsub(module_name+\"::\",\"\")\n end",
"def locale_klass_name\n @locale_klass_name ||= self.class.name.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr('-', '_').\n downcase\n end",
"def instance_variable_name_for(klass)\n klass.to_s.split('::').last.underscore\n end",
"def instancename classname\n\t\t\t'i'+classname\n\t\tend",
"def require_path class_name\n class_name.\n split('::').\n map { |str| tools.str.underscore(str) }.\n join '/'\n end",
"def class_titleize\n self.class.to_s.titleize\n end",
"def extract_class_name(filename)\n File.basename(filename).chomp(\".rb\").camelize\n end",
"def readonly_class_name(db_name)\n \"#{db_name.camelize}\"\n end",
"def class_name\n self.class == Class ? self.name : self.class.name\n end"
] |
[
"0.786215",
"0.77200544",
"0.754699",
"0.75467527",
"0.74926627",
"0.7381466",
"0.73253787",
"0.72885156",
"0.7274573",
"0.72708374",
"0.72708374",
"0.7241179",
"0.7179849",
"0.71694124",
"0.7093171",
"0.70799255",
"0.7062662",
"0.7044486",
"0.70441365",
"0.7040874",
"0.704003",
"0.70307004",
"0.7030228",
"0.7018764",
"0.7015897",
"0.69967574",
"0.6994121",
"0.698634",
"0.6973125",
"0.69689554",
"0.6968793",
"0.6945334",
"0.6942999",
"0.6942999",
"0.6939623",
"0.6917766",
"0.6911367",
"0.68949044",
"0.6885347",
"0.6885347",
"0.68675244",
"0.68665266",
"0.68370616",
"0.6832341",
"0.68067646",
"0.6806536",
"0.6788011",
"0.6783891",
"0.67708737",
"0.67674494",
"0.67598426",
"0.6754961",
"0.67502445",
"0.6750019",
"0.67406726",
"0.67344344",
"0.6703668",
"0.6696349",
"0.6695511",
"0.6693824",
"0.66849804",
"0.6673575",
"0.6672612",
"0.66675156",
"0.6664077",
"0.6656196",
"0.6655352",
"0.6640234",
"0.6637818",
"0.66283524",
"0.66273326",
"0.6626408",
"0.6623459",
"0.66201407",
"0.66199595",
"0.66139805",
"0.6611515",
"0.6601573",
"0.6594",
"0.65932447",
"0.65932447",
"0.65884763",
"0.6576196",
"0.65729654",
"0.65729654",
"0.65723443",
"0.65723443",
"0.6564651",
"0.65636957",
"0.65531796",
"0.65350527",
"0.65304774",
"0.6527762",
"0.6523999",
"0.6518166",
"0.65058404",
"0.65048057",
"0.6497412",
"0.648775",
"0.64829546",
"0.6480837"
] |
0.0
|
-1
|
GET /posts/1 GET /posts/1.json
|
def show
@post = Post.find(params[:id])
@commentable = @post
@comments = @commentable.comments
@comment = Comment.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
"def show\n \trender json: Post.find(params[:id])\n end",
"def show\n post = Post.find(params[:id])\n render json: post\n end",
"def show\n\t \trender json: Post.find(params[:id])\n\t end",
"def show\n @post = Post.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n render json: @post\n end",
"def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end",
"def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def show\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n render json: { posts: Post.all }\n end",
"def show\n @post ||= Mist::Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n @posts = Post.order(\"created_at DESC\").includes(:user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n # when you go to http://localhost:3000/posts/1, rails interprets this\n # as a call to the show action for the resource and passes 1 to the \n # :id paramater. Using this blog app you can do that by clicking the \n # show link for a post on the index page.\n\n @post = Post.find(params[:id])\n # The show action uses Post.find to search for a single record \n # in the database by its id value. After finding the record, Rails \n # displays it by using app/views/posts/show.html.erb\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n post = Post.find_by(id: params[:id])\n if post \n render json: post\n else\n render json: {errors: 'Not found'}\n end\n end",
"def index\n render json: Post.all\n end",
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def index\n @posts = Post.all.order(created_at: :asc)\n json_response(@posts)\n end",
"def index\n @posts = Post.all\n \n render json: @posts\n end",
"def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html { render 'application/index' }\n format.json { render :json => { :post => @post.as_json } }\n end\n end",
"def show\n render json: @post, serializer: Api::V1::PostSerializer\n end",
"def show\r\n @post = root_post_of(Post.find(params[:id]))\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @post }\r\n end\r\n end",
"def show\n render json: @post\n end",
"def show\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v2_post }\n end\n end",
"def show\n render json: @post\n end",
"def index\n @posts = Post.paginate(:page => params[:page], :per_page => 10).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end",
"def index\n render json: Post.all.order(id: :desc), each_serializer: V1::Posts::PostSerializer\n end",
"def show\n render :json => @post\n end",
"def index\n # @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @posts }\n end\n end",
"def index\n @api_v1_posts = Api::V1::Post.all\n end",
"def show\n @post = Post.find(params[:id])\n render json: @post, meta: { status: :ok }, meta_key: 'result'\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render jsonapi: @post }\n end\n end",
"def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"def show\n @post = PostsService.getPostById(params[:id])\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n #@posts = Post.all\n @posts = Post.paginate( :page => params[:page],\n :per_page => 2\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n # Post.all returns all of the posts currently in the \n # database as an array of Post records that we store \n # in an instance variable called @posts.\n # http://guides.rubyonrails.org/active_record_querying.html\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n # The respond_to block handles both HTML and JSON calls \n # to this action. If you browse to \n # http://localhost:3000/posts.json, you’ll see a JSON \n # containing all of the posts. \n end",
"def index\n\n # We display the posts be cronological inverted order\n if authenticated?\n @posts = Post.order('created_at DESC').page(params[:page])\n else\n @posts = Post.order('created_at DESC').where(:status => :true).page(params[:page])\n end\n \n respond_to do |format|\n format.html { render html: @posts }\n format.json { render json: @posts }\n end\n end",
"def show\n @user = User.find(params[:id])\n @posts = @user.posts\n\n respond_to do |format|\n format.json { render json: {user: User._build(@user), posts: Post.build_posts(@posts)}, location: root_path }\n end\n end",
"def index\n\t\tgon.posts = Post.all.as_json\n\tend",
"def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end",
"def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def show\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # format.html # show.html.erb\n #format.json { render json: @post }\n #end\n end",
"def index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end",
"def index\n @posts = Post.find(:all)\n end",
"def show\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n render json: { posts: current_user.posts.all.map(&:to_h) }\n end",
"def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def index\n\t@posts = list_posts\n end",
"def show\n #GET a single post by ID\n @post = Post.find(params[:id])\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def show\n @post = Post.find(params[:id])\n @title = @post.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n # TODO: implement listing all posts\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end",
"def show\n @blogpost = Blogpost.published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogpost }\n end\n end",
"def show\n # @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @post }\n end\n end",
"def post(postid)\n request(:id => postid).posts.first\n end",
"def show\n Rails.logger.debug(\"Inside show \")\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @posto = Posto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @posto }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @post }\n format.json do\n render :json => @post.to_json(:only => [:id, :title, :text, :lat, :lng, :created_at, :post_type, :likes], \n :methods => [:image_url, :video_url], \n :include => [:comments])\n end\n end\n end",
"def display_post\n begin\n # asks the user for the post id\n print \"Enter the post ID: \"\n id = STDIN.gets.chomp\n response = RestClient.get \"#{@@DOMAIN}/api/posts/#{id}.json\", authorization_hash\n\n js = JSON response.body\n js.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def index\n @posts = Post.all.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = PostService.getAllPosts\n end",
"def show\n render json: {\n data: @post\n }\n end",
"def show\n @post = Post.find(params[:id])\n @videos = Video.get_for @post #where([\"post_id = ?\", params[:id]]).all\n @background = get_background_for @post #Background::DEFAULT #Background.where([\"post_id = ?\", params[:id]])\n @nav = get_navigation :for => 'post', :current => @post\n @menu = get_menu :for => 'post'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end",
"def get(options = {})\n response= handle_errors { self.class.get('/get', :query => options)}\n if response[\"posts\"][\"post\"].is_a?(Hash)\n Rubycious::Post.new response[\"posts\"][\"post\"]\n elsif response[\"posts\"][\"post\"].is_a?(Array)\n response[\"posts\"][\"post\"].collect{|i| Rubycious::Post.new(i)}\n else\n nil\n end\n end",
"def show\n if !params[:id]\n @post = Post.find_by_title('Welcome')\n elsif params[:id] =~ /^[a-zA-Z ]+$/\n @post = Post.find_by_title(params[:id])\n else\n @post = Post.find(params[:id].to_i)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @blogpost = Blogpost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogpost }\n end\n end",
"def show\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blog_post }\n end\n end",
"def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end",
"def show\n @post2 = Post2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post2 }\n end\n end"
] |
[
"0.77110183",
"0.73537844",
"0.73433185",
"0.73379177",
"0.73228735",
"0.7293139",
"0.7275997",
"0.7256934",
"0.7161576",
"0.7158913",
"0.71552676",
"0.71552676",
"0.7119547",
"0.7094749",
"0.7094749",
"0.7094749",
"0.70943594",
"0.7071599",
"0.70607626",
"0.70452625",
"0.7032558",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.69897074",
"0.6955722",
"0.6955722",
"0.6954564",
"0.6937062",
"0.6936725",
"0.69257236",
"0.6917876",
"0.69010335",
"0.69005007",
"0.6894985",
"0.6893989",
"0.68756175",
"0.6860515",
"0.6853294",
"0.6853291",
"0.6847577",
"0.68364173",
"0.68232405",
"0.68093437",
"0.6804144",
"0.67621773",
"0.6743674",
"0.67226875",
"0.6720067",
"0.67147297",
"0.6713107",
"0.6699554",
"0.6693189",
"0.6679935",
"0.6655543",
"0.6644503",
"0.6641595",
"0.66299",
"0.6619761",
"0.66178924",
"0.66124725",
"0.6608166",
"0.66017526",
"0.6597235",
"0.65952027",
"0.65909946",
"0.65858185",
"0.6582703",
"0.658145",
"0.65768254",
"0.65733755",
"0.6568626",
"0.65668",
"0.655592",
"0.65385455",
"0.6525845",
"0.65144473",
"0.6513119",
"0.6497587",
"0.6497312",
"0.6493223",
"0.6491053",
"0.64720887",
"0.6471776",
"0.64655757",
"0.6455566",
"0.64530945",
"0.6448596",
"0.64456475",
"0.64289075"
] |
0.0
|
-1
|
GET /posts/new GET /posts/new.json
|
def new
if signed_in?
@post = Post.new
else
flash[:error] = "Please sign in to post"
redirect_to('/signin')
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n post = Post.new\n render json: post\n end",
"def new\n authenticated\n\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new \n @post = Post.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\r\n @post = Post.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @post }\r\n end\r\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n @title = \"New post\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n @post = Post.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @title = \"Create New Post\"\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n @post = Post.new\n # Creating a new post involves two actions. \n # The first is the new action, which \n # instantiates an empty Post object\n # The new.html.erb view displays this \n # empty Post to the user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n format.xml { render :xml => @post }\n end\n end",
"def new\n # responsbile for creating a new instance of a post\n @post = Post.new\n end",
"def new\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n @post = Mist::Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n authorize\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n # @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @post }\n end\n end",
"def new\n @post = model.new\n\n respond_to do |format|\n format.html { render :action => resource_template(\"new\") }\n end\n end",
"def new\n @post = Post.new\n @title = \"New Post\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n format.json { render :json => @post }\n end\n end",
"def new\n @user = User.find(params[:user_id])\n @post = Post.new(:user_id => @user.id)\n @title = \"New Post\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @news_post = NewsPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_post }\n end\n end",
"def new\n @news_post = NewsPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_post }\n end\n end",
"def new\n @posto = Posto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @posto }\n end\n end",
"def new #http://localhost:3000/posts/new\n\t@post = Post.new #creates a new empty post,if a form is created for it, it will be empty as well \n end",
"def new\n @mypost = Mypost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mypost }\n end\n end",
"def new\n #@post = Post.new\n\n #respond_to do |format|\n # format.html # new.html.erb\n #format.json { render json: @post }\n #end\n end",
"def new\n @newspost = Newspost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspost }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @news_post }\n end\n end",
"def new\n @posttag = Posttag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @posttag }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html #{ redirect_to '/' }\n format.json { render json: @post }\n end\n end",
"def new\n @posts = Post.find(:all, :order => 'updated_at DESC')\n @post = Post.new\n @post.title = \"Überschrift*\"\n\n respond_to do |format|\n format.html { render :template => \"posts/new\" }\n format.xml { render :xml => @post }\n end\n end",
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def new\n @posttag = Posttag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @posttag }\n end\n end",
"def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def new\n @post = Post.new\n @tags = Tag.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @api_v2_post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_v2_post }\n end\n end",
"def new\n @post = Post.new()\n end",
"def new\n @post = Post.new()\n end",
"def new\n @post = Post.new()\n end",
"def new\n @post = Post.new #returns an empty post\n end",
"def new\n @post = current_user.posts.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n @post = Post.new\n respond_with(@post)\n end",
"def new\n @post = Post.new\n respond_with(@post)\n end",
"def new\n\t\t@post = Post.new\n\t\trender :new\n\tend",
"def new\n @test_post = TestPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_post }\n end\n end",
"def new\n @blogpost = Blogpost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blogpost }\n end\n end",
"def new\n respond_to do |format|\n format.html { render :template => 'posts/new' } # we specify the template because in theory we could be reverting from a post to create \n format.js { render :partial => 'posts/reply' }\n end\n end",
"def new\n @posting = Posting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @posting }\n end\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end"
] |
[
"0.8041974",
"0.80156785",
"0.79855186",
"0.7931169",
"0.79215",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.78988296",
"0.78666586",
"0.78468144",
"0.78327304",
"0.7832491",
"0.7822257",
"0.7780887",
"0.7681105",
"0.7630568",
"0.7627285",
"0.75908595",
"0.7578067",
"0.75370306",
"0.7530152",
"0.7473938",
"0.74487615",
"0.7443868",
"0.74131733",
"0.74131733",
"0.7405905",
"0.73812896",
"0.73479295",
"0.7308366",
"0.7286089",
"0.7285293",
"0.72837895",
"0.7271229",
"0.7254161",
"0.7231453",
"0.7225646",
"0.72144365",
"0.7204585",
"0.7194356",
"0.71823084",
"0.71823084",
"0.71823084",
"0.7174505",
"0.71544987",
"0.71502286",
"0.71502286",
"0.71278226",
"0.7113166",
"0.7111857",
"0.710849",
"0.7106992",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334",
"0.7096334"
] |
0.0
|
-1
|
POST /posts POST /posts.json
|
def create
@post = current_user.posts.create(params[:post])
if @post.save
flash[:success] = 'Post was successfully created.'
redirect_to @post
else
render :new
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create\n respond_with Post.create(params[:posts])\n end",
"def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end",
"def create\n @post = Post.new(post_params)\n @post.user = current_user\n\n if @post.save\n render json: @post, status: :created, location: api_v1_post_path(@post), serializer: Api::V1::PostSerializer\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n\n if @post.save\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end",
"def create\n post = @current_user.posts.create(post_params)\n\n if post.save\n render json: post\n else\n render json: { errors: post.errors.full_messages }, status: :forbidden\n end\n end",
"def create\n title = params[:title]\n body = params[:body]\n\n @post = current_user.posts.create(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def create\n @post = Post.new({ :title => params[:post][:title] })\n \n respond_to do |format|\n if @post.save\n format.json { render :json => { :post => @post.as_json}, :status => :created, :location => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(params[:user_id])\n @post = @user.posts.new(post_params)\n\n if @post.save\n render json: @post, status: :created, location: [@user, @post]\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new(post_params)\n\n if @post.save\n render json: {\n message: 'Post was successfully created.'\n }, status: :created\n else\n render json: {\n errors: @post.errors,\n message: 'Post could not be created.'\n }, status: :unprocessable_entity\n end\n end",
"def post(id, opts = {})\r\n uri = url_for(\"posts/#{id}\", opts)\r\n response = RestClient.get(uri)\r\n JSON.parse response\r\n end",
"def create\n\n\n @post = current_user.posts.build(post_params)\n\n if @post.save\n\n render json: \"Posted successfully\", status: 201\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new(params[:post])\n respond_to do |format|\n if @post.save\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.create(params[:post])\n end",
"def create\n\t\tpost = @current_user.posts.create(post_params) \n\t\tif post.save\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id}\n\t else\n\t render json: {success: false, errors: post.errors.full_messages, message: \"Validation failed\"}, status: 422\n\t\tend \n\tend",
"def create_posts\n end",
"def create_posts\n end",
"def create_post\n begin\n #asks the user for the title, body, and whether it should be anonymous\n print \"Title: \"\n title = STDIN.gets.chomp\n print \"Body: \"\n body = STDIN.gets.chomp\n print \"Post as Anonymous? (y/n): \"\n anonymous = STDIN.gets.chomp.upcase == 'Y' ? true : false\n # check user information from login\n\n # Rails will reject this unless you configure the cross_forgery_request check to\n # a null_session in the receiving controller. This is because we are not sending\n # an authenticity token. Rails by default will only send the token with forms /users/new and\n # /users/1/edit and REST clients don't get those.\n # We could perhaps arrange to send this on a previous\n # request but we would then have to have an initial call (a kind of login perhaps).\n # This will automatically send as a multi-part request because we are adding a\n # File object.\n response = RestClient.post \"#{@@DOMAIN}/api/posts.json\",\n\n {\n post: {\n title: title,\n body: body,\n anonymous: anonymous\n },\n }, authorization_hash\n\n if (response.code == 201)\n puts \"Created successfully\"\n end\n puts \"URL for new resource: #{response.headers[:location]}\"\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def create\n @api_post = Api::Post.new(api_post_params)\n\n if @api_post.save\n render json: @api_post, status: :created, location: @api_post\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render :show, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \tif logged_in?\n params[:post][:user_id] = current_user.id\n @post = Post.new(post_params)\n if @post.save\n puts @post.published\n render json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n respond_with Post.create(post_params)\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def post(*args)\n request(:post, *args)\n end",
"def post(*args)\n request :post, *args\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_post = current_user.posts.new(api_post_params)\n if @api_post.save\n render :show\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def create\n authenticated\n\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new post_params\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n if @post.save\n render :show, status: :created, location: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n puts \"create post: #{post_params.inspect}\"\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @title = \"Create New Post\"\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"def create\n post_service = PostService.new(current_user, params)\n post_service.create_post\n #post_service.create\n respond_to do |format|\n if post_service.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to new_post_url, alert: post_service.errors }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render json: @post, status: :created, location: @post }\n format.xml { render xml: @post, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #raise params.inspect\n \n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @posts = Post.page(params[:page]).order('created_at desc')\n @post = Post.new(post_params)\n @user = User.where('account_id == ?', current_account.id)[0]\n respond_to do |format|\n if @post.save\n format.html { redirect_to '/posts' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :index }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\t\t\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user_post_param\n respond_to do |format|\n if @post.save\n format.html do\n redirect_to @post, notice:\n \"Post was successfully created.\"\n end\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json do\n render json: @post.errors, status:\n :unprocessable_entity\n end\n end\n end\n end",
"def create\n @api_v1_post = Api::V1::Post.new(api_v1_post_params)\n\n respond_to do |format|\n if @api_v1_post.save\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_post }\n else\n format.html { render :new }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.new(params[:post])\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @post.user_id = current_user.id\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { redirect_to posts_path, flash: { error: @post.errors.full_messages } }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def new\n post = Post.new\n render json: post\n end",
"def create\n @user = current_user\n @post = @user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @post = Post.new(params[:post])\r\n\r\n respond_to do |format|\r\n if @post.save\r\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\r\n format.json { render json: @post, status: :created, location: @post }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @post = Post.create(post_params)\n set_posts\n respond_to do |format|\n format.js\n format.html\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, :notice => \"slam\" }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { redirect_to posts_path }\n flash[:alert] = \"shit.\"\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n post\n end",
"def create\n @post = Post.new(content: params[:post][:content], user_id: @user.id)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @user }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { redirect_to @user }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @post = Post.new(post_params)\n @post.user_id = params[:user_id]\n if @post.save\n render json: @post, meta: { status: :created }, meta_key: 'result', status: :created\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = current_user.posts.new(post_params.merge(writter: current_user.name))\n\n if @post.save\n render json: {status: 1, id: @post.id.to_s, notice: \"新增成功,标题是:#{@post.title.capitalize}\", number: @post.number, errors: []}\n else\n render json: {status: -1, notice: \"新增失败,请先登录\", errors: @post.errors.full_messages}\n end\n end",
"def create\n puts \"Trying to Create New Post\"\n # Creates new post with given content tied to given userid\n @post = Post.new(post_params) \n if @post.save\n puts \"Post successfully created\"\n response.status=(201)\n render json: {status: \"Success\", message: [\"Post created!\"]}\n else\n # Error handling\n puts \"Something went wrong while creating new Post\"\n puts(@Post.errors.full_messages)\n response.status=(422)\n render json: { status: \"Error\", message: [@post.errors.full_messages]}\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to list_of_posts_post_path(@post.user), notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n execute(:post, *args)\n end",
"def create\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n coerce_date(params[:post], 'published_at')\n @post = Mist::Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to new_post_successful_posts_path, notice: 'Anúncio criado com sucesso.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def create\n redirect_to login_path unless session[:user_id]\n message = 'Post was successfully created.'\n @post = Post.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: message }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @post.user = User.find_by_auth_token!(cookies[:auth_token])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n if @post.save\n redirect_to find_redirect(@post.page)\n else\n render :new\n render json: @post.errors, status: :unprocessable_entity\n end\n end"
] |
[
"0.74463975",
"0.73221767",
"0.73072433",
"0.7123966",
"0.7015686",
"0.701327",
"0.69841874",
"0.6939327",
"0.69313824",
"0.69053805",
"0.68196476",
"0.6812792",
"0.6793222",
"0.6792862",
"0.6779654",
"0.6779654",
"0.67625546",
"0.67602354",
"0.67515427",
"0.6735786",
"0.66983837",
"0.6694823",
"0.6676922",
"0.6648634",
"0.6618174",
"0.6609208",
"0.6576672",
"0.6567517",
"0.6535031",
"0.65248317",
"0.6517826",
"0.6512526",
"0.6512526",
"0.65004253",
"0.64875203",
"0.6482612",
"0.64796066",
"0.6479418",
"0.64762664",
"0.64762664",
"0.64762664",
"0.64762664",
"0.64762664",
"0.64762664",
"0.64762664",
"0.6452396",
"0.6443543",
"0.64413923",
"0.6439579",
"0.6431225",
"0.6411242",
"0.64027417",
"0.6402409",
"0.63972473",
"0.63956606",
"0.6388207",
"0.6388207",
"0.6380103",
"0.63764375",
"0.6374259",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.63714516",
"0.6369631",
"0.6361449",
"0.6350474",
"0.6349784",
"0.6345706",
"0.6312865",
"0.63084143",
"0.630361",
"0.63009614",
"0.62957925",
"0.6295694",
"0.62955",
"0.6294854",
"0.62942207",
"0.628781",
"0.62877417",
"0.6283785",
"0.6282612",
"0.6263583"
] |
0.0
|
-1
|
PUT /posts/1 PUT /posts/1.json
|
def update
@post = Post.find(params[:id])
if @post.update_attributes(params[:post])
flash[:success] = 'Post was successfully created.'
redirect_to @post
else
render action: "edit"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n respond_with Post.update(params[:id], params[:posts])\n end",
"def update\n respond_with post.update(params[:id], params[:post])\n end",
"def update\n title = params[:title]\n body = params[:body]\n\n @post.update!(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def update\n authorize @post\n\n if @post.save\n render json: @post\n else\n render json: @post.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n respond_with Post.update(params[:id],post_params)\n end",
"def update\n\t\t@post = post.find(params[:id])\n\t\t@post.update_attributes(post_params)\n\t\trespond_to do |format|\n\t\t\tformat.html {redirect_to post_path(@post)}\n\t\t\tformat.json {render json: @post}\n\t\tend\n\tend",
"def update\n if @post.update({\n title: post_params[:title],\n content: post_params[:content],\n })\n render json: Post.all.as_json\n else\n render json: {errors: @post.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.update(params[:id], params[:post])\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n @post.update_attributes(params[:post])\n format.html { redirect_to posts_url, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n end \n end",
"def update\n @api_post = Api::Post.find(params[:id])\n\n if @api_post.update(api_post_params)\n head :no_content\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def update\n id = Post.find(params[:id])._id\n \n respond_to do |format|\n if ((@post.update_attributes(params[:post])) && (@post._id = id))\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n redirect_to '/posts'\n end",
"def update\n\t\tif @post.update(post_params)\n\t\t\trender json: @post, status: :success\n\t\telse\n\t\t\trender json: @post.errors, status: :unprocessable_entity #422\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @api_v1_post.update(api_v1_post_params)\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_post }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n\t\t# find our post\n\t\tid = params[:id]\n\t\t@post = Post.find(id)\n\n\t\t# increment the number of votes\n\t\tif params[:tweet] == \"true\"\n\t\t\t@post.votes = @post.votes + 1\n\t\t\t@post.save\n\t\telsif params[:flagged] == \"true\"\n\t\t\t@post.flagged = @post.flagged + 1\n\t\t\t@post.save\n\t\tend\n\t\t\n\t\t# TODO: ask Tom what this does again\n\t\trender :json => @post\n\tend",
"def update\n if (@post.update(params.permit(:title, :content)))\n render json: @post, status: :ok\n else\n render json: @post.errors, status: 422\n end\n end",
"def put!\n request! :put\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render json: @post }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update! { posts_url }\n end",
"def update\n if @post.update(post_params)\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.json { render :show, status: :ok, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n @post.update_attributes(params[:post])\n respond_with(@post)\n end",
"def update\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n if @api_v2_post.update_attributes(params[:api_v2_post])\n format.html { redirect_to @api_v2_post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v2_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def update\n post = Post.find_by(id: params[:id])\n # byebug\n\n post.assign_attributes(update_params)\n if post.valid?\n post.save\n render json: post, status: :created\n else\n render json: {errors: post.errors.full_messages}, status: 422\n end\n end",
"def update_post(post_id, post_data)\n uri = \"#{@api_url}/#{@project_id}/posts/#{post_id}?access_token=#{@access_token}\"\n put uri, post_data\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'slam updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authenticated\n\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: '' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n update_resource_response(@post, blog_post_params)\n end",
"def update\n @post = Post.find_by_slug(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n render action: \"show.json.jbuilder\"\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to :action => 'index', notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_user\n @post = @user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n post = current_user.posts.find_by_uuid(params[:id])\n return render_item_not_found('Post') unless post\n post.update_attributes(post_params)\n broadcast(post, 'update')\n head :ok\n end",
"def update\r\n @post = Post.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def update\n @post = Post.find(params[:id])\n @title = \"EDIT\"\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update\n if @post.update(post_params)\n render json: {status: 1, id: @post.id.to_s, notice: \"修改成功,标题是:#{@post.title.capitalize}\", errors: []}\n else\n render json: {status: -1, notice: \"修改失败\", errors: @post.errors.fall_message}\n end\n end",
"def update\n respond_to do |format|\n @post.title = params[:title]\n @post.body = params[:body]\n @tags = params[:tags].split(',') unless params[:tags].blank?\n Post.transaction do\n if @post.save\n destroy_tags(@post, @tags)\n create_tags(@post, @tags)\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n @action_path = post_path @post\n @method = :put\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n redirect_to posts_path and return unless Mist.authorized?(:update_post, self)\n @post = Mist::Post.find(params[:id])\n\n respond_to do |format|\n coerce_date(params[:post], 'published_at')\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def update\n put :update\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to magazine_post_path(@post.short_url), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.update(params[:id], params[:post].permit(:caption))\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n authorize\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post.update!(post_params)\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to \"/#{session[:username]}\", notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n if @post.update(post_params)\n render :show, status: :ok, location: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @post.update(post_params)\n render :show, status: :ok, location: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\t\n\t\tpost = @current_user.role == \"admin\" ? Post.find_by(id: params[:id]) : @current_user.posts.find_by(id: params[:id]) \n\t\tif post && post.update_attributes(post_params)\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id, post_desc: post.description}\n\t else\n\t render json: {success: false, message: \"not found or validation failed\"}, status: 422\n\t\tend \n\tend",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:article])\n format.html { redirect_to @post, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to sites_url, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_post\n @api_v1_post = Api::V1::Post.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @resource.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post}\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n clean = params.require(:post).permit(:title, :body, :tag)\n if @post.update_attributes(clean)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n @post.update_attributes(params[:post])\n flash[:notice] = \"Updated succesfully\"\n respond_with(@post)\n end",
"def update\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.730712",
"0.7121667",
"0.6814235",
"0.66412306",
"0.66166633",
"0.66057837",
"0.6581644",
"0.656272",
"0.6549959",
"0.65330195",
"0.651011",
"0.64858186",
"0.644467",
"0.6430717",
"0.6413994",
"0.6384365",
"0.6381423",
"0.63646674",
"0.6364095",
"0.6363726",
"0.6361106",
"0.63592327",
"0.6353868",
"0.6353467",
"0.6352811",
"0.634443",
"0.6328202",
"0.6316728",
"0.6299945",
"0.6299945",
"0.62736493",
"0.6269168",
"0.6268442",
"0.6265348",
"0.6239916",
"0.6237959",
"0.6234839",
"0.6219431",
"0.6217122",
"0.6212364",
"0.62049645",
"0.6188839",
"0.6188839",
"0.6188839",
"0.6188839",
"0.61838293",
"0.6180399",
"0.6180399",
"0.61731964",
"0.6165625",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.61637706",
"0.6163369",
"0.6149891",
"0.6146981",
"0.6138538",
"0.6133172",
"0.6132206",
"0.61239386",
"0.61213",
"0.612117",
"0.61115533",
"0.6108367",
"0.60961616",
"0.60809964",
"0.6057712",
"0.60457355",
"0.60450715",
"0.60250574",
"0.6025044",
"0.60222715",
"0.600368",
"0.5992828",
"0.5992628",
"0.59848887",
"0.59633887",
"0.59633887",
"0.5941279",
"0.59403",
"0.592711",
"0.5924792",
"0.59132844",
"0.5908147",
"0.59072536",
"0.59070766",
"0.5898446",
"0.5897126"
] |
0.0
|
-1
|
DELETE /posts/1 DELETE /posts/1.json
|
def destroy
@post = Post.find(params[:id])
@post.destroy
redirect_to posts_url
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: params[:id]}}, status: :ok\n end\n end",
"def destroy\n @post.destroy\n render json: {}, status: :ok\n end",
"def destroy\n if @post.destroy\n render json: {\n post: @post\n }, status: :ok\n else\n render status: :bad_request\n end\n end",
"def destroy\n @api_v2_post = Post.find(params[:id])\n @api_v2_post.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v2_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_post.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_posts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authenticated\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @post = Post.find(params[:id])\n # @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post.destroy\n\n json_response(@post)\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with Post.destroy(params[:id])\n end",
"def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n\n head :no_content\n end",
"def destroy\n @post.destroy\n render json: {\n data: {\n post: { key: @post.id },\n status: @post.status,\n }\n }\n end",
"def destroy\n\t\tpost = Post.find(params[:id])\n\t\t# byebug\n \tpost.destroy\n\t posts = Post.all\n \trender json: posts\n end",
"def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to posts_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_path, notice: \"Post removed.\" }\n format.json { render 'destroy' }\n end\n end",
"def delete\n @post = Post.find(params[:id])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path(client_id:current_user.client.id, per_page:5), notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with Post.destroy(params[:id])\n end",
"def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to root_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @post.destroy\n\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/posts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n render json: Post.all.as_json\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to blog_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n @title = \"Kill Post\"\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to all_user_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html {redirect_to posts_url, notice: 'Post was successfully destroyed.'}\n format.json {head 200}\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path, notice: 'Post was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with post.destroy(params[:id])\n end",
"def destroy\n @post.destroy\n \n respond_to do |format|\n format.html { redirect_to post_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n Post.find(params[:id]).delete\n\n redirect_to '/'\n end",
"def destroy\n # @post = Post.find(params[:id])\n #@post.destroy\n\n #respond_to do |format|\n # format.html { redirect_to posts_url }\n #format.json { head :no_content }\n #end\n end",
"def delete(url)\n raise Error, \"Missing URL\" unless url\n get('posts/delete?uri=' << u(url))\n nil\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to news_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find_by_slug(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Anúncio removido com sucesso.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.friendly.find(params[:id])\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Story deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Postitus edukalt kustutatud!\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluida com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluída com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mural_post.destroy\n respond_to do |format|\n format.html { redirect_to mural_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @posto = Posto.find(params[:id])\n @posto.destroy\n\n respond_to do |format|\n format.html { redirect_to postos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n end"
] |
[
"0.8046884",
"0.76902676",
"0.7583626",
"0.75803024",
"0.7568048",
"0.75047046",
"0.75031126",
"0.74750155",
"0.74671036",
"0.74650854",
"0.746482",
"0.74589694",
"0.74589694",
"0.74589694",
"0.74589694",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7423174",
"0.74059606",
"0.73990285",
"0.73928183",
"0.7389498",
"0.7371715",
"0.7371117",
"0.7349121",
"0.7344524",
"0.7342226",
"0.7338908",
"0.7313371",
"0.73123556",
"0.731156",
"0.73095584",
"0.7299751",
"0.7298017",
"0.7298017",
"0.7282874",
"0.7277125",
"0.7266815",
"0.7260945",
"0.72549784",
"0.7254856",
"0.7239102",
"0.7238946",
"0.7229726",
"0.7227931",
"0.7221013",
"0.721375",
"0.7211237",
"0.72097856",
"0.7190222",
"0.71850675",
"0.7171746",
"0.71533066",
"0.71457464",
"0.71434635",
"0.7142048",
"0.7139985",
"0.7137574"
] |
0.0
|
-1
|
GET /book_editions/1 GET /book_editions/1.json
|
def show
@book_edition = BookEdition.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @book_edition }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_editions(params = {})\n get_json(get_editions_url(params))\n end",
"def show\n @ebook = Ebook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ebook }\n end\n end",
"def show\n @bookwork = Bookwork.find(params[:id])\n @book_participants = Participant.find_all_by_bookwork_id(params[:id])\n @book_editions = BookEdition.find_all_by_bookwork_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bookwork }\n end\n end",
"def new\n @book_edition = BookEdition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_edition }\n end\n end",
"def show\n @book_step = BookStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_step }\n end\n end",
"def index\n @digital_editions = DigitalEdition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @digital_editions }\n end\n end",
"def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end",
"def index\n @book_steps = @book.book_steps.all\n @book = @book\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_steps }\n end\n end",
"def index\n set_sort_params(params, params[:edition])\n find_editions(params)\n \n #exclude_unpublished\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @editions }\n format.atom\n end\n end",
"def book\n @book = Book.published.find(params[:id])\n render json: @book\n end",
"def index\n @chapters = @book.chapters\n @chapter_list = @chapters.to_json(:only => [:name, :chapter_start, :chapter_end]) if @chapters.present?\n respond_to do |format|\n format.html\n format.json { \n render_json(@chapter_list)\n }\n end\n end",
"def new\n isbn = params[:isbn]\n uri = URI(\"http://107.170.7.58:4567/api/book\")\n parameters = {\"ext\" => \"json\", \"isbn\" => isbn.to_s}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n if list.empty?\n redirect_to(action: \"search\", error: isbn.to_s)\n else\n @edition = Edition.new(list[0][\"data\"])\n end\n end",
"def index\n @ebooks = Ebook.all\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def show\n @exercises = Exercise.where(\"chapter_id = ?\", params[:id]).order(:number)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end",
"def index\n @notebooks = Notebook.all\n render json: @notebooks\n end",
"def show\n @book_shelf = BookShelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_shelf }\n end\n end",
"def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end",
"def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end",
"def show\n render json: @book\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end",
"def destroy\n @book_edition = BookEdition.find(params[:id])\n @book_edition.destroy\n\n respond_to do |format|\n format.html { redirect_to book_editions_url }\n format.json { head :no_content }\n end\n end",
"def show\n @chapter = @book.chapters.find(params[:id])\n # @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to book_series_collection_book_chapter_verses_url(@book_series, @collection, @book, @chapter) }\n format.json { head :no_content }\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @chapter }\n end\n end",
"def show\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_page }\n end\n end",
"def show\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to book_series_collection_book_chapters_url(@book_series, @collection, @book) }\n format.json { head :no_content }\n\n# respond_to do |format|\n# format.html # show.html.erb\n# format.json { render json: @book }\n end\n end",
"def show\n @first_semester_library_book_outline = FirstSemesterLibraryBookOutline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @first_semester_library_book_outline }\n end\n end",
"def index\n @educations = Education.all\n render json: @educations\n end",
"def new\n @ebook = Ebook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ebook }\n end\n end",
"def index\n @books = Book.extended_details\n\n render json: @books.as_json(\n only: [:id, :title, :author, :created_at, :total_income_cents, :copies_count, :remaining_copies_count, :loaned_copies_count]\n )\n end",
"def show\n @second_semester_library_book_outline = SecondSemesterLibraryBookOutline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @second_semester_library_book_outline }\n end\n end",
"def index\n @articles = @book.articles\n end",
"def show\n @edition_type = EditionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @edition_type }\n end\n end",
"def create\n @book_edition = BookEdition.new(params[:book_edition])\n\n respond_to do |format|\n if @book_edition.save\n format.html { redirect_to @book_edition, notice: 'Book edition was successfully created.' }\n format.json { render json: @book_edition, status: :created, location: @book_edition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_edition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end",
"def scubooks\n sections = Section.all\n render json: sections\n end",
"def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def index\n @notebooks = Notebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notebooks }\n end\n end",
"def index\n @notebooks = Notebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notebooks }\n end\n end",
"def show\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @book }\n end\n end",
"def set_ebook\n @ebooks = Ebook.find(params[:id])\n end",
"def show\n @book_review = BookReview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_review }\n end\n end",
"def new\n @edition = Edition.new\n @edition.book_id = params[:book_id]\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @edition }\n end\n end",
"def show\n @notebook = Notebook.find(params[:id])\n render json: @notebook\n end",
"def index\n if params[:book_id]\n @book = Book.find(params[:book_id])\n recipes = @book.recipes\n render json: RecipeSerializer.new(recipes).to_serialized_json\n else \n recipes = Recipe.all.order(:name)\n render json: RecipeSerializer.new(recipes).to_serialized_json\n end\n end",
"def show\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @authors_book }\n end\n end",
"def recipebook\n @levels = Level.all\n\n respond_to do |format|\n format.html # recipebook.html.erb\n format.json { render json: @levels }\n end\n end",
"def show\n find_book(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book_step = BookStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_step }\n end\n end",
"def show\n @kidandparentbook = Kidandparentbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kidandparentbook }\n end\n end",
"def show\n @book_catalog_entrie = BookCatalogEntrie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_catalog_entrie }\n end\n end",
"def show\n @cook_book = CookBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cook_book }\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def index\n @books = Book.all\n render json: @books\n end",
"def index\n @free_ebooks = FreeEbook.all\n end",
"def show\n @ingredient_assignment = IngredientAssignment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ingredient_assignment }\n end\n end",
"def get_paged_editions(params = {})\n Enumerator.new do |yielder|\n next_link = get_editions_url(params)\n while next_link\n yielder.yield begin\n response = get_json(next_link)\n end\n next_link_info = response[\"links\"].select { |link| link[\"rel\"] == \"next\" }.first\n next_link = next_link_info && next_link_info[\"href\"]\n end\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def show\n @guestbook = Guestbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guestbook }\n end\n end",
"def show\n @book_of_class = BookOfClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_of_class }\n end\n end",
"def index\n @book_recommendations = BookRecommendation.all\n end",
"def new\n @book_shelf = BookShelf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_shelf }\n end\n end",
"def show\n @enrolled = Enrolled.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enrolled }\n end\n end",
"def show\n @experience_history = ExperienceHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experience_history }\n end\n end",
"def show\n @exhibition = Exhibition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exhibition }\n end\n end",
"def index\n @book_lends = BookLend.all\n end",
"def show\n @enrollment = Enrollment.on_db(session[:shard_name]).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enrollment }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end",
"def get_editions(ol_keys)\n editions = []\n ol_keys.each do |k|\n link = @api_url + \"/get?key=\" + k\n resp = open(link).read\n editions << JSON.parse(resp)['result']\n end\n return editions\n end",
"def new\n @chapter.book = Book.find params[:book]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chapter }\n end\n end",
"def update\n @book_edition = BookEdition.find(params[:id])\n\n respond_to do |format|\n if @book_edition.update_attributes(params[:book_edition])\n format.html { redirect_to @book_edition, notice: 'Book edition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_edition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @evaluation_sheet = EvaluationSheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluation_sheet }\n end\n end",
"def show\n @notebook = Notebook.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notebook }\n end\n end",
"def search\n @query = params[:q]\n @editions = Book.search(@query)\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @editions }\n end\n end",
"def show\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommendation }\n end\n end",
"def show\n render json: @api_book\n end",
"def index\n @proposals = Proposal.all\n\n render json: @proposals\n end",
"def index\n @bookings = Booking.all\n\n render json: @bookings\n end",
"def show\n @earned_award = EarnedAward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @earned_award }\n end\n end",
"def show\n @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end",
"def show\n @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end",
"def index\n @books = Book.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def show\n @game = Game.find(params[:id], :include => [:tags, :authors, :extensions, :base_game])\n @editions = @game.editions.all(:order => \"published_at ASC\", :include => :editor)\n @title = @game.name\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @game.to_xml }\n end\n end",
"def show\n @election_type = ElectionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @election_type }\n end\n end",
"def show\n @title = \"Show Book\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n render json: @educations\n end",
"def index\n @elections = Election.all\n end"
] |
[
"0.75861424",
"0.63522375",
"0.6336166",
"0.6311693",
"0.6262766",
"0.6220065",
"0.6185017",
"0.61807644",
"0.61670285",
"0.6116654",
"0.5896409",
"0.58800846",
"0.5848406",
"0.5824201",
"0.5811929",
"0.5804929",
"0.5795652",
"0.5782079",
"0.5782079",
"0.57789487",
"0.5771109",
"0.57658464",
"0.5746983",
"0.5740086",
"0.57219434",
"0.5720683",
"0.5712732",
"0.5708369",
"0.5704128",
"0.5690563",
"0.56903666",
"0.56668913",
"0.5665004",
"0.5655549",
"0.5635436",
"0.56290364",
"0.5609109",
"0.5609109",
"0.5609109",
"0.5609109",
"0.5609109",
"0.5609109",
"0.5609109",
"0.5609109",
"0.5609109",
"0.56025386",
"0.558906",
"0.558906",
"0.5577305",
"0.5577305",
"0.5574944",
"0.55749327",
"0.5564017",
"0.554042",
"0.5536722",
"0.55336",
"0.55145603",
"0.5505641",
"0.55041176",
"0.54941076",
"0.54928154",
"0.54790103",
"0.5476125",
"0.54600155",
"0.5449779",
"0.54473376",
"0.5445199",
"0.5418042",
"0.5417929",
"0.5412338",
"0.5412338",
"0.5410684",
"0.5407329",
"0.5406082",
"0.540467",
"0.54032373",
"0.5397242",
"0.5394347",
"0.5388022",
"0.53853536",
"0.53763676",
"0.53755623",
"0.53728974",
"0.5372665",
"0.5364522",
"0.53611475",
"0.53587306",
"0.53563243",
"0.53549504",
"0.53466445",
"0.5346374",
"0.53463364",
"0.5337934",
"0.5337934",
"0.5332396",
"0.5330977",
"0.5330685",
"0.53293246",
"0.5326617",
"0.5326071"
] |
0.69758075
|
1
|
GET /book_editions/new GET /book_editions/new.json
|
def new
@book_edition = BookEdition.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @book_edition }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @ebook = Ebook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ebook }\n end\n end",
"def new\n @book_step = BookStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_step }\n end\n end",
"def new\n isbn = params[:isbn]\n uri = URI(\"http://107.170.7.58:4567/api/book\")\n parameters = {\"ext\" => \"json\", \"isbn\" => isbn.to_s}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n if list.empty?\n redirect_to(action: \"search\", error: isbn.to_s)\n else\n @edition = Edition.new(list[0][\"data\"])\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n load_data\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @book }\n end\n end",
"def new\n @current_book = Book.find_by_id(params[:book_id])\n @chapter = Chapter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :json => @chapter }\n end\n end",
"def new\n @edition = Edition.new\n @edition.book_id = params[:book_id]\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @edition }\n end\n end",
"def create\n @book_edition = BookEdition.new(params[:book_edition])\n\n respond_to do |format|\n if @book_edition.save\n format.html { redirect_to @book_edition, notice: 'Book edition was successfully created.' }\n format.json { render json: @book_edition, status: :created, location: @book_edition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_edition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @edition_type = EditionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @edition_type }\n end\n end",
"def new\n @title = \"New Book\"\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def new\n\t\t@book = Book.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render :json => @book }\n\t\tend\n\tend",
"def new\n @notebook = Notebook.new\n render json: @notebook\n end",
"def new\n @books = Book.all\n @knowledge_point = KnowledgePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @knowledge_point }\n end\n end",
"def new\n @book_shelf = BookShelf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_shelf }\n end\n end",
"def new\n @chapter.book = Book.find params[:book]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chapter }\n end\n end",
"def new\n @enrolled = Enrolled.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled }\n end\n end",
"def new\n @notebook = Notebook.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notebook }\n end\n end",
"def new\n @notebook = Notebook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notebook }\n end\n end",
"def new\n @notebook = Notebook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notebook }\n end\n end",
"def new\n @draft = Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @draft }\n end\n end",
"def new\n @book_page = @book.book_pages.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_page }\n end\n end",
"def new\n @look_book = LookBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @look_book }\n end\n end",
"def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end",
"def new\n @chapter = @book.chapters.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chapter }\n end\n end",
"def new\n \n @title = \"availabilities/new\"\n @availability = Availability.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @availability }\n end\n end",
"def new\n @election_type = ElectionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @election_type }\n end\n end",
"def new\n @selection = Selection.new\n\n respond_to do |format| \n format.html # new.html.erb\n format.json { render json: @selection }\n end\n end",
"def new\n @draft = Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @draft }\n end\n end",
"def new\n # @collection = Collection.find(params[:collection_id])\n @book = @collection.books.build\n #original: @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @cookbook = Cookbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cookbook }\n end\n end",
"def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end",
"def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end",
"def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end",
"def new\n @book_review = BookReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_review }\n end\n end",
"def new\n @book_catalog_entrie = BookCatalogEntrie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_catalog_entrie }\n end\n end",
"def new\n @cook_book = CookBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cook_book }\n end\n end",
"def new\n @book = Book.new(:serial_id => params[:serial_id])\n article = @book.articles.build\n article.authorships.build\n book = @book.editorships.build\n\n respond_to do |format|\n format.html { render layout: 'form' }# new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = current_user.books.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @chapter = @book.chapters.build\n # @chapter = Chapter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chapter }\n end\n end",
"def new\n @book_of_class = BookOfClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_of_class }\n end\n end",
"def new\n @bookwork = Bookwork.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bookwork }\n end\n end",
"def new\n @guestbook = Guestbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guestbook }\n end\n end",
"def new\n @ingredient_assignment = IngredientAssignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ingredient_assignment }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course_offering }\n end\n end",
"def new\n @authors_book = AuthorsBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @authors_book }\n end\n end",
"def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end",
"def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end",
"def new\n @election = Election.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @election }\n end\n end",
"def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @part }\n end\n end",
"def new\n @enrollment = Enrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enrollment }\n end\n end",
"def new\n @enrollment = Enrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enrollment }\n end\n end",
"def new\n @sections = Section.find(:all) # TODO: refactor so I don't have to repeat this all over the place\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @section }\n end\n end",
"def new\n @book = Book.new :copies => 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\r\n @page_title = '書籍情報作成'\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def new\n @office = Office.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @office }\n end\n end",
"def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end",
"def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end",
"def new\n @document_history = DocumentHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_history }\n end\n end",
"def new\n @arrival_range = ArrivalRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival_range }\n end\n end",
"def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @part }\n end\n end",
"def new\n @lecture = Lecture.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lecture }\n end\n end",
"def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lease }\n end\n end",
"def new\n @book = Book.new\n @publishers = Publisher.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @earned_award = EarnedAward.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @earned_award }\n end\n end",
"def new\n @proposal = listing.proposals.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end",
"def new\n @article = Article.new\n @drafts = Article.draft.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end",
"def new\n @candidate = Candidate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @candidate }\n end\n end",
"def new\n @experience_history = ExperienceHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experience_history }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @enterprise = Enterprise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enterprise }\n end\n end",
"def new\n @apprentice = Apprentice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @apprentice }\n end\n end",
"def new\n @addimition = Addimition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @addimition }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @book }\n format.json { render json: @book }\n end\n end",
"def new\n @immigrant = Immigrant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @immigrant }\n end\n end",
"def new\n @office = Office.new\n\n track_event(\"Viewed AddListing\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @office }\n end\n end",
"def new\n @student_availability = StudentAvailability.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_availability }\n end\n end",
"def new\n @eveninglist = Eveninglist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @eveninglist }\n end\n end",
"def new\n load_dependents\n @training_calendar = TrainingCalendar.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @training_calendar }\n end\n end",
"def new\n @primer = Primer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @primer }\n end\n end",
"def new\n @tutor_availability = TutorAvailability.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutor_availability }\n end\n end",
"def new\n @death_record_book = DeathRecordBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @death_record_book }\n end\n end"
] |
[
"0.6673376",
"0.6649164",
"0.66380847",
"0.6552363",
"0.6552363",
"0.6551553",
"0.64930576",
"0.646029",
"0.6452665",
"0.64522296",
"0.64522296",
"0.64522296",
"0.64522296",
"0.64522296",
"0.64522296",
"0.64522296",
"0.64522296",
"0.64522296",
"0.64522296",
"0.64522296",
"0.6439008",
"0.6429885",
"0.642709",
"0.6399582",
"0.6377745",
"0.6368177",
"0.63638526",
"0.6361362",
"0.63583446",
"0.6291358",
"0.62636554",
"0.6258457",
"0.6258457",
"0.62536037",
"0.6242365",
"0.6238454",
"0.62247866",
"0.62197703",
"0.62129325",
"0.62121356",
"0.62070745",
"0.62020993",
"0.6200313",
"0.6195903",
"0.61914665",
"0.61914665",
"0.61914665",
"0.6175601",
"0.6175345",
"0.6161319",
"0.6158855",
"0.61549383",
"0.61529195",
"0.61497605",
"0.61465055",
"0.61363745",
"0.6133418",
"0.6121167",
"0.6099613",
"0.60982406",
"0.60982406",
"0.60857964",
"0.6076662",
"0.6073838",
"0.6073838",
"0.606589",
"0.60544115",
"0.6049604",
"0.6049451",
"0.60463023",
"0.60463023",
"0.60449564",
"0.6040328",
"0.60393095",
"0.60345083",
"0.6024917",
"0.60240775",
"0.60233057",
"0.6021811",
"0.6020685",
"0.6013714",
"0.6005326",
"0.6001908",
"0.599168",
"0.599168",
"0.599168",
"0.599168",
"0.599168",
"0.59909946",
"0.59827185",
"0.59777397",
"0.5972336",
"0.5970618",
"0.5968222",
"0.5962709",
"0.59616053",
"0.596082",
"0.59391004",
"0.5935908",
"0.5935718"
] |
0.72223675
|
0
|
POST /book_editions POST /book_editions.json
|
def create
@book_edition = BookEdition.new(params[:book_edition])
respond_to do |format|
if @book_edition.save
format.html { redirect_to @book_edition, notice: 'Book edition was successfully created.' }
format.json { render json: @book_edition, status: :created, location: @book_edition }
else
format.html { render action: "new" }
format.json { render json: @book_edition.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_editions(params = {})\n get_json(get_editions_url(params))\n end",
"def new\n @book_edition = BookEdition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_edition }\n end\n end",
"def index\n set_sort_params(params, params[:edition])\n find_editions(params)\n \n #exclude_unpublished\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @editions }\n format.atom\n end\n end",
"def create\n @ebook = Ebook.new(params[:ebook])\n\n respond_to do |format|\n if @ebook.save\n format.html { redirect_to root_path, notice: 'Ebook was successfully created.' }\n format.json { render json: @ebook, status: :created, location: @ebook }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ebook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n params[:edition] = {} if !params[:edition]\n params[:edition][:isbn] = format_isbn(params[:edition][:isbn]) if params[:edition][:isbn]\n \n @edition = Edition.new(params[:edition])\n \n respond_to do |format|\n if @edition.save_with_image_and_index\n format.html { redirect_to(@edition, :notice => 'Edition was successfully created.') }\n format.xml { render :xml => @edition, :status => :created, :location => @edition }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @edition.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ebooks = Ebook.new(drmfreegame_params)\n\n respond_to do |format|\n if @ebooks.save\n format.html { redirect_to @ebooks, notice: 'Ebook was successfully created.' }\n format.json { render :show, status: :created, location: @ebooks }\n else\n format.html { render :new }\n format.json { render json: @ebooks.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n isbn = params[:isbn]\n uri = URI(\"http://107.170.7.58:4567/api/book\")\n parameters = {\"ext\" => \"json\", \"isbn\" => isbn.to_s}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n if list.empty?\n redirect_to(action: \"search\", error: isbn.to_s)\n else\n @edition = Edition.new(list[0][\"data\"])\n end\n end",
"def create\n @book_step = BookStep.new(params[:book_step])\n\n respond_to do |format|\n if @book_step.save\n format.html { redirect_to @book_step, notice: 'Book step was successfully created.' }\n format.json { render json: @book_step, status: :created, location: @book_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_step.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @book_edition = BookEdition.find(params[:id])\n @book_edition.destroy\n\n respond_to do |format|\n format.html { redirect_to book_editions_url }\n format.json { head :no_content }\n end\n end",
"def index\n @book_steps = @book.book_steps.all\n @book = @book\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_steps }\n end\n end",
"def expedition_params\n params.require(:expedition).permit(:title, :description, :number_of_guests, :cost, :allow_multiple_bookings_on_date)\n end",
"def create\n @ebook = Ebook.new(ebook_params)\n respond_to do |format|\n if @ebook.save\n format.html { redirect_to @ebook, notice: \"#{@ebook_name} was successfully created.\" }\n format.json { render action: 'show', status: :created, location: @ebook }\n else\n format.html { render action: 'new' }\n format.json { render json: @ebook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def election_params\n params.require(:election).permit(:title, :start_date, :finish_date, :status, :category_id)\n end",
"def index\n @digital_editions = DigitalEdition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @digital_editions }\n end\n end",
"def create\n @book_recommendation = BookRecommendation.new(book_recommendation_params)\n\n respond_to do |format|\n if @book_recommendation.save\n format.html { redirect_to @book_recommendation, notice: 'Book recommendation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @book_recommendation }\n else\n format.html { render action: 'new' }\n format.json { render json: @book_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parts_for_proposal = PartsForProposal.new(parts_for_proposal_params)\n\n respond_to do |format|\n if @parts_for_proposal.save\n curr_id = @parts_for_proposal.proposal_id\n format.html { redirect_to proposal_url(:id => curr_id), notice: 'Part added to this proposal successfully.' }\n format.json { render :show, status: :created, location: @parts_for_proposal }\n else\n format.html { render :new }\n format.json { render json: @parts_for_proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @book_step = BookStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_step }\n end\n end",
"def create\n @offices = Office.create!(office_params)\n json_response(@offices, :created)\n end",
"def show\n @book_edition = BookEdition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_edition }\n end\n end",
"def create\n @election = Election.new(election_params)\n\n respond_to do |format|\n if @election.save\n format.html { redirect_to @election, notice: \"Election was successfully created.\" }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @election = Election.new(election_params)\n respond_to do |format|\n if @election.save\n format.html { redirect_to [:admin, @election], notice: 'Election was successfully created.' }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gbooking = Gbooking.new(gbooking_params)\n @gbooking.user = current_user if current_user\n if @gbooking.save\n params[:customizebookings].each_with_index do |customizebooking,index|\n customizebooking.permit!\n @customizebooking = Customizebooking.new(customizebooking.permit!)\n @customizebooking.number = index + 1\n @customizebooking.gbooking = @gbooking\n @customizebooking.save\n end\n\n respond_to do |format|\n format.html { redirect_to(@gbooking, :notice => 'Customizebooking was successfully created.') }\n format.xml { render :xml => @customizebooking, :status => :created, :location => @customizebooking }\n end\n end\n end",
"def expedition_params\n params.require(:expedition).permit(:astronaut, :planet_id, :start_date, :end_date, astronaut_ids: [])\n end",
"def create\n @election = Election.new(election_params)\n\n respond_to do |format|\n if @election.save\n format.html { redirect_to @election, notice: 'Election was successfully created.' }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @election = Election.new(election_params)\n\n respond_to do |format|\n if @election.save\n format.html { redirect_to @election, notice: 'Election was successfully created.' }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = params[:book]\n add(@book)\n end",
"def create\n @chapter = @book.chapters.build(params[:chapter])\n\n respond_to do |format|\n if @chapter.save\n format.html { redirect_to book_series_collection_book_chapters_url(@book_series, @collection, @book), notice: 'Chapter was successfully created.' }\n format.json { render json: @chapter, status: :created, location: @chapter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chapter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @area_edition = @layout.area_editions.new(area_edition_params)\n\n respond_to do |format|\n if @area_edition.save\n format.html { redirect_to main_app.url_for([:edit, @product, @theme, @personalization, @layout, @area_edition]), notice: 'Area edition was successfully created.' }\n format.json { render :show, status: :created, location: @area_edition }\n else\n format.html { render :new }\n format.json { render json: @area_edition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book_lend = BookLend.new(book_lend_params)\n\n respond_to do |format|\n if @book_lend.save\n\n if (!params[:book_lend][:student_id].blank?)\n @book_lend.student_id = params[:book_lend][:student_id]\n @book_lend.save\n end\n\n format.html { redirect_to @book_lend, notice: 'Book lend was successfully created.' }\n format.json { render :show, status: :created, location: @book_lend }\n else\n format.html { render :new }\n format.json { render json: @book_lend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @edition = Edition.new\n @edition.book_id = params[:book_id]\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @edition }\n end\n end",
"def create\n respond_to do |format|\n if @chapter.save\n format.html { redirect_to book_path(@chapter.book_id), notice: 'Chapter was successfully created.' }\n format.json { render json: @chapter, status: :created, location: @chapter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chapter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book_exemplar = BookExemplar.new(book_exemplar_params)\n\n respond_to do |format|\n if @book_exemplar.save\n format.html { redirect_to @book_exemplar, notice: 'Book exemplar was successfully created.' }\n format.json { render :show, status: :created, location: @book_exemplar }\n else\n format.html { render :new }\n format.json { render json: @book_exemplar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inchef_recommendation = InchefRecommendation.new(inchef_recommendation_params)\n\n respond_to do |format|\n if @inchef_recommendation.save\n format.html { redirect_to @inchef_recommendation, notice: 'Inchef recommendation was successfully created.' }\n format.json { render :show, status: :created, location: @inchef_recommendation }\n else\n format.html { render :new }\n format.json { render json: @inchef_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book_edition = BookEdition.find(params[:id])\n\n respond_to do |format|\n if @book_edition.update_attributes(params[:book_edition])\n format.html { redirect_to @book_edition, notice: 'Book edition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_edition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edition_params\n params.require(:edition).permit(:pdf, :publish)\n end",
"def create\n @guest_educator = GuestEducator.new(guest_educator_params)\n\n respond_to do |format|\n if @guest_educator.save\n format.html { redirect_to @guest_educator, notice: 'Guest educator was successfully created.' }\n format.json { render :show, status: :created, location: @guest_educator }\n else\n format.html { render :new }\n format.json { render json: @guest_educator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @notebook = current_user.notebooks.find(params[:notebook_id])\n @page = @notebook.pages.find(params[:page_id])\n\n @page.paragraphs.create\n redirect_to notebook_page_path(@notebook, @page)\n end",
"def create\n\n @enrollment = Enrollment.new(properties_data: enrollment_properties_params)\n #debugger\n #@enrollment = Enrollment.new()\n #render json: request.raw_post(), status: :created\n\n if @enrollment.save\n render json: {:reference_number => @enrollment.reference_number}, status: :created\n else\n render json: @enrollment.errors, status: :unprocessable_entity\n end\n end",
"def create\n @book_page = @book.book_pages.build(params[:book_page])\n\n respond_to do |format|\n if @book_page.save\n format.html { redirect_to book_series_collection_book_book_pages_url(@book_series, @collection, @book), \n notice: 'Book page was successfully created.' }\n format.json { render json: @book_page, status: :created, location: @book_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @response = Response.find(params[:response_id])\n @request_selection = @response.create_request_selection(params[:request_selection])\n #@reward = @request_selection.create_reward(params[:reward])\n \n respond_to do |format|\n if @request_selection.save\n \n format.html { redirect_to _my_requests_path }\n format.json { render json: @request_selection, status: :created, location: @request_selection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request_selection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puntuation = Puntuation.new(puntuation_params)\n\n respond_to do |format|\n if @puntuation.save\n @voted_contribution = Contribution.find(@puntuation.contribution_id)\n @voted_contribution.increment!(:puntuation, 1)\n format.html { redirect_to :back }\n format.json { render :show, status: :created, location: @puntuation }\n else\n format.html { render :new }\n format.json { render json: @puntuation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = @collection.books.build(params[:book])\n #original: @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @ebook = Ebook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ebook }\n end\n end",
"def election_params\n params.require(:election).permit({ :state => ['preparation', 'voting', 'votes_counted']},\n :election_type, :eligible_seats, :state, :title, :description, :scope_type, :scope_id_region, :preparation_starts_at,\n :preparation_ends_at, :voting_starts_at, :voting_ends_at, :public_key, :private_key)\n end",
"def create\n @edition_type = EditionType.new(params[:edition_type])\n\n respond_to do |format|\n if @edition_type.save\n format.html { redirect_to @edition_type, notice: 'Edition type was successfully created.' }\n format.json { render json: @edition_type, status: :created, location: @edition_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @edition_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ebook_params\n params.require(:ebook).permit(:title, :short_desc, :body, :genre, :cost)\n end",
"def test_get_book_by_edition_group_id\n data = post_book('edition_group_id' => 1)\n assert_equal(1, data[0]['data']['edition_group_id'])\n end",
"def add_review\n UsersQuest.update(params[:id], params.require(:quest).permit(:review))\n redirect_to quest_path(params[:id])\n end",
"def create_review(booking, options = {})\n post(\"bookings/#{booking}/reviews\", reviews: [options]).pop\n end",
"def create\n @enrollments = Enrollment.new(enrollment_params)\n\n respond_to do |format|\n if @enrollments.save\n format.html { redirect_to current_user }\n format.json { render :show, status: :created, location: @enrollments }\n else\n format.html { render :new }\n format.json { render json: @enrollments.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n\t\trequire_admin!\n\t\t@election = Election.new(election_params)\n\n\t\trespond_to do |format|\n\t\t\tif @election.save\n\t\t\t\tformat.html { redirect_to @election, notice: 'Election was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @election }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @election.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def new\n @book = Book.new(:serial_id => params[:serial_id])\n article = @book.articles.build\n article.authorships.build\n book = @book.editorships.build\n\n respond_to do |format|\n format.html { render layout: 'form' }# new.html.erb\n format.json { render json: @book }\n end\n end",
"def book_params\n params.require(:book).permit(:title, :year, :publisher, :pages, :isbn, :editions, :image, :user_id)\n end",
"def create\n @kidandparentbook = Kidandparentbook.new(params[:kidandparentbook])\n\n respond_to do |format|\n if @kidandparentbook.save\n format.html { redirect_to @kidandparentbook, :notice => 'Kidandparentbook was successfully created.' }\n format.json { render :json => @kidandparentbook, :status => :created, :location => @kidandparentbook }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @kidandparentbook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ingredient_assignment = IngredientAssignment.new(params[:ingredient_assignment])\n\n respond_to do |format|\n if @ingredient_assignment.save\n format.html { redirect_to @ingredient_assignment, notice: 'Ingredient assignment was successfully created.' }\n format.json { render json: @ingredient_assignment, status: :created, location: @ingredient_assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ingredient_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def book_lend_params\n params.require(:book_lend).permit(:book_id, :student_id, :lendDateTime, :isReturned, :returnDateTime, :isDamaged, :notes)\n end",
"def index\n @chapters = @book.chapters\n @chapter_list = @chapters.to_json(:only => [:name, :chapter_start, :chapter_end]) if @chapters.present?\n respond_to do |format|\n format.html\n format.json { \n render_json(@chapter_list)\n }\n end\n end",
"def index\n @educations = Education.all\n render json: @educations\n end",
"def create\n #@enrollment = Enrollment.new(params[:enrollment])\n\n respond_to do |format|\n @enrollment = Enrollment.shard_for( params[:enrollment][:classroom_id] ).create!( params[:enrollment] )\n if @enrollment\n format.html { redirect_to @enrollment, notice: 'Enrollment was successfully created.' }\n format.json { render json: @enrollment, status: :created, location: @enrollment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def book_collection_params\n params.require(:book_collection).permit(:state, :owned, :book_id)\n end",
"def create\n puts \"post_params\"\n puts post_params\n if post_params[:book]\n response = RestClient::Request.execute(\n method: :get,\n url: post_params[:book]['self_link'],\n )\n response=JSON.parse(response)\n @book = Book.where(self_link: post_params[:book]['self_link']).first_or_create do |book|\n book.title=response['volumeInfo']['title']\n book.subtitle=response['volumeInfo']['subtitle']\n book.description=response['volumeInfo']['description']\n book.publisher=response['volumeInfo']['publisher']\n book.publication_date=response['volumeInfo']['publishedDate']\n if response['volumeInfo']['authors'] then book.author=response['volumeInfo']['authors'].join(', ') end\n if response['saleInfo']['listPrice'] then book.list_price=response['saleInfo']['listPrice']['amount'] end\n end\n puts @book\n if response['volumeInfo']['industryIdentifiers']\n response['volumeInfo']['industryIdentifiers'].each do |isbn_type|\n if isbn_type['type']=='ISBN_13'\n @book['ISBN_13']=isbn_type['identifier']\n elsif isbn_type['type']=='ISBN_10'\n @book['ISBN_10']=isbn_type['identifier']\n end\n end\n end\n if response['volumeInfo']['imageLinks']\n if response['volumeInfo']['imageLinks']['thumbnail']\n @book['cover_image']=response['volumeInfo']['imageLinks']['thumbnail']\n elsif response['volumeInfo']['imageLinks']['smallThumbnail']\n @book['cover_image']=response['volumeInfo']['imageLinks']['smallThumbnail']\n end\n end\n if @book.save\n # @posts.book_id=@book.id\n @post = current_user.posts.new(post_params.merge({book: @book}))\n\n respond_to do |format|\n if @post.save\n if params[:images]\n params[:images]['actual_product_image'].each do |image|\n @image = @post.images.create!(:actual_product_image => image)\n end\n end\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n if post_params['post_type']=='offer'\n format.html { render :new_offer }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n else\n format.html { render :new_request }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n else\n if post_params['post_type']==\"offer\"\n redirect_to posts_new_offer_path, notice:\"Need Book Information\"\n else\n redirect_to posts_new_request_path, notice:\"Need Book Information\"\n end\n end\nend",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to admin_book_url(@book), notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @proposal.save\n format.html { redirect_to @proposal.enrolment, notice: 'Proposal was successfully created.' }\n format.json { render json: @proposal, status: :created, location: @proposal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attend!(exerciseclass)\n \tself.class_bookings.create!(exercise_class_id: exerciseclass.id)\n \tend",
"def create\n @book = Book.new(book_params)\n\n if @book.save\n render json: @book, status: :created, location: @book\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def experience_params\n params.require(:experience).permit(:chef, :recipe, :starts_at)\n end",
"def educator_params\n params.require(:educator).permit(:paperwork)\n end",
"def create\n @enrolled = Enrolled.new(params[:enrolled])\n \n respond_to do |format|\n if @enrolled.save\n format.html { redirect_to @enrolled, :notice => t('selecao_admin.flash_messages.successfully_created.', :model => @enrolled.class.model_name.human) }\n format.json { render :json => @enrolled, :status => :created, :location => @enrolled }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @enrolled.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @fault_book = FaultBook.new(params[:fault_book])\n @fault_book.truck_fleet_id = @fault_book.fleet.truck_fleet_id\n \n respond_to do |format|\n if @fault_book.save\n s = Serviceable.find_by_fleet_id(params['fault_book']['fleet_id'])\n s.next_service_date = @fault_book.fault_date \n s.save\n format.html { redirect_to @fault_book, notice: 'Fault book was successfully created.' }\n format.json { render json: @fault_book, status: :created, location: @fault_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fault_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @chapter = @book.chapters.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chapter }\n end\n end",
"def create\n @traditional_literature_book = current_user.traditional_literature_books.build(traditional_literature_book_params)\n\n respond_to do |format|\n if @traditional_literature_book.save\n format.html { redirect_to @traditional_literature_book, notice: \"Traditional literature review was successfully created.\" }\n format.json { render :show, status: :created, location: @traditional_literature_book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @traditional_literature_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_enrollment\n\n end",
"def editions\n works.map {|work| work.editions}.flatten.map\n end",
"def create\n decoded_token = JWT.decode book_params[:swipeChefToken], \"spaghetti\", true, { algorithm: 'HS256' }\n\n if decoded_token\n\n user_id = decoded_token[0]['id'].to_i\n\n @book = Book.find_or_create_by(user_id: user_id, recipe_id: params[:recipe_id])\n\n respond_to do |format|\n format.json { render json: @book}\n end\n end\n end",
"def create\n @book_catalog_entrie = BookCatalogEntrie.new(params[:book_catalog_entrie])\n\n respond_to do |format|\n if @book_catalog_entrie.save\n format.html { redirect_to @book_catalog_entrie, notice: 'Book was successfully created.' }\n format.json { render json: @book_catalog_entrie, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_catalog_entrie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n\n params[:book][:author_id].each do |item| # A block of code to set current note sharing options with other users\n if (!item.blank?)\n @NewBookAuthor = AuthorsBook.new(:book_id => @book.id, :author_id => item)\n @NewBookAuthor.save\n end\n end\n\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @educator = Educator.new(educator_params)\n\n respond_to do |format|\n if @educator.save\n format.html { redirect_to @educator, notice: 'Educator was successfully created.' }\n format.json { render :show, status: :created, location: @educator }\n else\n format.html { render :new }\n format.json { render json: @educator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assessment = Assessment.new(assessment_params)\n \n respond_to do |format|\n if @assessment.save\n @assessment.assign_exercises_to_students(params[:number_of_versions]) \n format.html { redirect_to [@course, @assessment], notice: 'Assessment was successfully created.' }\n format.json { render :show, status: :created, location: @assessment }\n else\n format.html { render :new }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bookreview = Bookreview.new(bookreview_params)\n\n respond_to do |format|\n if @bookreview.save\n format.html { redirect_to book_path(@bookreview.book_id), notice: 'Bookreview was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bookreview }\n else\n format.html { render action: 'new' }\n format.json { render json: @bookreview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_book_google\n book = Book.create(book_params)\n \n if book.valid?\n #Book was added to library\n #Add book to users bookshelf\n user = User.find_by_id(params[:user_id])\n \n shelf = user.bookshelves.first\n shelf.books << book\n \n shelf = user.bookshelves.first\n pp shelf.shelfitems\n \n if params[:finished] == \"true\"\n shelf.shelfitems.last.finished = true\n #shelf.shelfitems.last\n shelf.shelfitems.last.save\n end\n #si.finished = params[:finished]\n #si.save\n \n render json: {msg: \"Successfully created \" + book.title, shelf: shelf.books}, :status => :created\n else\n render json: {e: \"Error creating book\"}, :status => :error\n end\n end",
"def enrollment(params = {})\n scope 'default'\n post('enrollment/', params)\n end",
"def create\n @book = Book.new(params[:book])\n\n for article in @book.articles\n current_aspect.references << article\n end\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n cnt = params[:tutor_availability][:repeat].to_i - 1\n params[:tutor_availability].delete :repeat\n @tutor_availability = TutorAvailability.new(params[:tutor_availability])\n\n respond_to do |format|\n if @tutor_availability.save\n if cnt > 0\n for i in 1..cnt\n new_ta = TutorAvailability.new(params[:tutor_availability])\n new_ta.start_time = @tutor_availability.start_time + 604800*i\n new_ta.save\n end\n end\n format.html { redirect_to tutor_availabilities_path, notice: 'Tutor availability was successfully created.' }\n format.json { render json: @tutor_availability, status: :created, location: @tutor_availability }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutor_availability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evenreview = Evenreview.new(evenreview_params)\n\n respond_to do |format|\n if @evenreview.save\n format.html { redirect_to @evenreview, notice: 'Evenreview was successfully created.' }\n format.json { render :show, status: :created, location: @evenreview }\n else\n format.html { render :new }\n format.json { render json: @evenreview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @edrife = Edrive.new(edrife_params)\n\n respond_to do |format|\n if @edrife.save\n format.html { redirect_to @edrife, notice: 'Edrive was successfully created.' }\n format.json { render :show, status: :created, location: @edrife }\n else\n format.html { render :new }\n format.json { render json: @edrife.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @first_semester_library_book_outline = FirstSemesterLibraryBookOutline.new(params[:first_semester_library_book_outline])\n\n respond_to do |format|\n if @first_semester_library_book_outline.save\n format.html { redirect_to ([:administrator, @first_semester_library_book_outline]), notice: 'First semester library book outline was successfully created.' }\n format.json { render json: @first_semester_library_book_outline, status: :created, location: @first_semester_library_book_outline }\n else\n format.html { render action: \"new\" }\n format.json { render json: @first_semester_library_book_outline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def educator_params\n params.require(:educator).permit(:title, :first_name, :last_name, :job_title, :summary, :dob, :ssn, :gender, :ethnicity)\n end",
"def get_editions(ol_keys)\n editions = []\n ol_keys.each do |k|\n link = @api_url + \"/get?key=\" + k\n resp = open(link).read\n editions << JSON.parse(resp)['result']\n end\n return editions\n end",
"def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_id)\n\t \tPeekBooker.upd_availability(booking.timeslot_id)\n\t \t\n\t \trender json: booking, status: 201\n\t end\n\tend",
"def create\n @book = Book.new(book_params)\n resort_orders\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @second_semester_library_book_outline = SecondSemesterLibraryBookOutline.new(params[:second_semester_library_book_outline])\n\n respond_to do |format|\n if @second_semester_library_book_outline.save\n format.html { redirect_to ([:administrator, @second_semester_library_book_outline]), notice: 'Second semester library book outline was successfully created.' }\n format.json { render json: @second_semester_library_book_outline, status: :created, location: @second_semester_library_book_outline }\n else\n format.html { render action: \"new\" }\n format.json { render json: @second_semester_library_book_outline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def create\n @book = Book.find(book_request_params[:book_id])\n @account = Account.find(params[:account_id])\n @book_request = BookRequest.new(book: @book, reader: @account, holder: @book.account)\n respond_to do |format|\n if @book_request.save\n format.json {\n render json:\n {\n book_id: @book_request.book_id,\n book_request_state: @book_request.state_name\n }\n }\n else\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def inproceedings_params\n params.require(:inproceedings).permit(:author, :title, :booktitle, :year)\n end",
"def create\n @education = Education.new(education_params)\n\n if @education.save\n render json: @education, status: :created, location: @education\n else\n render json: @education.errors, status: :unprocessable_entity\n end\n end",
"def create\n @partition = Partition.new(partition_params)\n @chapter = @partition.chapter\n @sectioned = @chapter\n\n respond_to do |format|\n if @partition.save\n #@partitions = Partition.all.includes([:chapter, :rich_text_body])\n format.html do\n redirect_to partition_url(@partition), notice: 'Partition was successfully created.'\n end\n format.json { render :show, status: :created, location: @partition }\n flash.now[:notice] = \"Partition was successfully created.\"\n format.turbo_stream { render 'shared/show', locals: { object: @chapter } }\n #format.turbo_stream { }\n else\n format.html { render :new }\n format.json { render json: @partition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inspiration = Inspiration.new(inspiration_params)\n @inspiration.user_id = current_user.id\n @inspiration.book_id = @book.id\n\n respond_to do |format|\n if @inspiration.save\n format.html { redirect_to @book, notice: 'Inspiration was successfully created.' }\n format.json { render action: 'show', status: :created, location: @inspiration }\n else\n format.html { render action: 'new' }\n format.json { render json: @inspiration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n @article.book = @book\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def election_params\n params.require(:election).permit(:voting_start_date, :voting_end_date, :years_range, :win_user)\n end",
"def create\n @escalation = Escalation.new(escalation_params)\n\n respond_to do |format|\n if @escalation.save\n format.html { redirect_to @escalation, notice: 'Escalation was successfully created.' }\n format.json { render :show, status: :created, location: @escalation }\n else\n format.html { render :new }\n format.json { render json: @escalation.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6483485",
"0.5559471",
"0.5534786",
"0.5522819",
"0.5461252",
"0.54524195",
"0.5435738",
"0.5397763",
"0.5324665",
"0.5295557",
"0.52609503",
"0.5211759",
"0.5158263",
"0.5131353",
"0.5089978",
"0.5073321",
"0.50497204",
"0.5042247",
"0.5015296",
"0.49752697",
"0.49639487",
"0.49616635",
"0.49451903",
"0.49428353",
"0.49428353",
"0.4937867",
"0.49204943",
"0.49191073",
"0.49123663",
"0.49123636",
"0.4909879",
"0.49095777",
"0.49042854",
"0.49040782",
"0.48964807",
"0.48829323",
"0.4875377",
"0.48725107",
"0.48719582",
"0.4848282",
"0.4845438",
"0.48421142",
"0.4833753",
"0.48324463",
"0.4811419",
"0.4802843",
"0.47986472",
"0.4797963",
"0.47968805",
"0.47936103",
"0.47934324",
"0.4791816",
"0.479031",
"0.4788739",
"0.47870287",
"0.4778136",
"0.47778943",
"0.4776856",
"0.4773858",
"0.47559333",
"0.47490752",
"0.47486272",
"0.47477996",
"0.4745676",
"0.47427145",
"0.47397524",
"0.47385824",
"0.4738212",
"0.47349066",
"0.4732998",
"0.47306743",
"0.47246397",
"0.47242457",
"0.47199187",
"0.4714771",
"0.47142076",
"0.47111192",
"0.4710742",
"0.47073975",
"0.4705683",
"0.47052366",
"0.47003326",
"0.47003105",
"0.46945944",
"0.46906644",
"0.46875054",
"0.46833205",
"0.46829268",
"0.46827722",
"0.46826625",
"0.46798977",
"0.46796697",
"0.4679354",
"0.46760446",
"0.46756285",
"0.46699896",
"0.46698335",
"0.46683332",
"0.46667686",
"0.46663103"
] |
0.6236308
|
1
|
PUT /book_editions/1 PUT /book_editions/1.json
|
def update
@book_edition = BookEdition.find(params[:id])
respond_to do |format|
if @book_edition.update_attributes(params[:book_edition])
format.html { redirect_to @book_edition, notice: 'Book edition was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @book_edition.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @book_step = BookStep.find(params[:id])\n\n respond_to do |format|\n if @book_step.update_attributes(params[:book_step])\n format.html { redirect_to @book_step, notice: 'Book step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_step.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n params[:edition] = {} if !params[:edition]\n params[:edition][:isbn] = format_isbn(params[:edition][:isbn]) if params[:edition][:isbn]\n \n @edition = Edition.find(params[:id])\n \n respond_to do |format|\n if @edition.update_attributes_and_index(params[:edition])\n format.html { redirect_to(@edition, :notice => 'Edition was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @edition.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ebook = Ebook.find(params[:id])\n\n respond_to do |format|\n if @ebook.update_attributes(params[:ebook])\n format.html { redirect_to @ebook, notice: 'Ebook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ebook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book_edition = BookEdition.new(params[:book_edition])\n\n respond_to do |format|\n if @book_edition.save\n format.html { redirect_to @book_edition, notice: 'Book edition was successfully created.' }\n format.json { render json: @book_edition, status: :created, location: @book_edition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_edition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n debugger\n chapter.book = book\n if chapter.save\n redirect_to(book_chapter_path([book, chapter]), notice: 'Chapter was successfully updated.')\n else\n render action: 'edit'\n end\n end",
"def destroy\n @book_edition = BookEdition.find(params[:id])\n @book_edition.destroy\n\n respond_to do |format|\n format.html { redirect_to book_editions_url }\n format.json { head :no_content }\n end\n end",
"def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n @book.attributes = params[:book]\n # a break point for debugging:\n # debugger\n client = Goodreads.new\n book_info = client.book_by_isbn(params[:book][:isbn])\n @book.title = book_info.title if @book.title.blank?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tclient = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\tbook = client.book_by_isbn(book_params[:isbn])\n\t\t\t@book.titlelong = book.title\n\t\t\t@book.description = strip_tags(book.description)\n\t\t\t@book.title = book.work.original_title\n\t\t\t@book.pages = book.num_pages\n\t\t\t@book.bookrating = book.average_rating\n\t\t\t@book.author = book.authors.author.name\n\t\t\t@book.publisher = book.publisher\n\t\t\t@book.save\n\t\t\tformat.html { redirect_to @book, notice: 'Book was successfully updated.' }\n\t\t\tformat.json { render :show, status: :ok, location: @book }\n\t\tend\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @book.update_attributes(params[:book])\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @chapter.update_attributes(params[:chapter])\n format.html { redirect_to book_path(@chapter.book_id), notice: 'Chapter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chapter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book_exemplar.update(book_exemplar_params)\n format.html { redirect_to @book_exemplar, notice: 'Book exemplar was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_exemplar }\n else\n format.html { render :edit }\n format.json { render json: @book_exemplar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n if @book_page.update_attributes(params[:book_page])\n format.html { redirect_to book_series_collection_book_book_page_url(@book_series, @collection, @book, @book_page), notice: 'Book page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes_and_index(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book_recommendation.update(book_recommendation_params)\n format.html { redirect_to @book_recommendation, notice: 'Book recommendation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n @book.update(book_params)\n redirect_to root_path\n end",
"def update\n\n respond_to do |format|\n if _create_or_update()\n\tformat.xml { render :xml => {:success=>true} }\n format.html { redirect_to @book_series, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n\tformat.xml { head :fail }\n format.json { render :json => @book_series.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chapter.update(update_chapter_params)\n format.html { redirect_to specification_path(@chapter.specification_id) }\n format.json { render :show, status: :ok, location: @chapter }\n else\n format.html { render :edit }\n format.json { render json: @chapter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_editions(params = {})\n get_json(get_editions_url(params))\n end",
"def book_update\n if params[:token] != ENV['UPDATE_TOKEN']\n return render :text => 'nope'\n end\n\n lang = params[:lang]\n chapter = params[:chapter].to_i\n section = params[:section].to_i\n chapter_title = params[:chapter_title]\n section_title = params[:section_title]\n content = params[:content].force_encoding(\"UTF-8\")\n\n # create book (if needed)\n book = Book.where(:code => lang).first_or_create\n\n # create chapter (if needed)\n chapter = book.chapters.where(:number => chapter).first_or_create\n chapter.title = chapter_title\n chapter.save\n\n # create/update section\n section = chapter.sections.where(:number => section).first_or_create\n section.title = section_title\n section.html = content\n section.save\n\n render :text => 'ok'\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n add_title_to_book\n end",
"def update\n\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def update\n authorize! :manage, @stuk_book\n\n respond_to do |format|\n if @stuk_book.update(stuk_book_params)\n format.html { redirect_to @stuk_book, notice: 'Stuk book was successfully updated.' }\n format.json { render :show, status: :ok, location: @stuk_book }\n else\n format.html { render :edit }\n format.json { render json: @stuk_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @free_ebook.update(free_ebook_params)\n format.html { redirect_to @free_ebook, notice: 'Free ebook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @free_ebook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n book = Book.find(params[:id])\n book.update_attributes(params[:book])\n redirect_to(book)\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to admin_book_url(@book), notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book.update(book_params)\n respond_with(@book, :flash => true)\n end",
"def update\n @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n if @chapter.update_attributes(params[:chapter])\n format.html { redirect_to book_chapter_path(@book,@chapter), notice: 'Chapter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chapter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book_lend.update(book_lend_params)\n format.html { redirect_to @book_lend, notice: 'Book lend was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_lend }\n else\n format.html { render :edit }\n format.json { render json: @book_lend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to [:admin, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_ebook\n @ebooks = Ebook.find(params[:id])\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to [current_user, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to manage_books_path, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @election = Election.find(election_params[:id])\n respond_to do |format|\n if @election.update(election_params)\n format.html { redirect_to user_elections_path, notice: 'Election was successfully updated.' }\n format.json { render :show, status: :ok, location: @election }\n else\n format.html { render :edit }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @api_book = Api::Book.find(params[:id])\n\n if @api_book.update(api_book_params)\n head :no_content\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def update\n @fault_book = FaultBook.find(params[:id])\n\n respond_to do |format|\n if @fault_book.update_attributes(params[:fault_book])\n format.html { redirect_to @fault_book, notice: 'Fault book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fault_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @ebook = Ebook.find_by_id(params[:id])\n end",
"def update\n @chapter = @book.chapters.find(params[:id])\n\n respond_to do |format|\n if @chapter.update_attributes(params[:chapter])\n flash[:notice] = 'Chapter was successfully updated.'\n format.html { redirect_to([@book,@chapter]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @chapter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: t('common.message.updated_success')}\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inspiration.update(inspiration_params)\n format.html { redirect_to @book, notice: 'Inspiration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inspiration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @step = params[:step].to_i\n content = FetchContentService.new.(current_student.os, @step)\n current_student.steps << {title: content[:title] }\n current_student.save!\n\n redirect_to edit_students_path\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.xml { head :ok }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @book.update(book_params)\r\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @book }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update!(**args)\n @book_edition_isbn = args[:book_edition_isbn] if args.key?(:book_edition_isbn)\n @book_edition_mid = args[:book_edition_mid] if args.key?(:book_edition_mid)\n end",
"def update\n @chapter = @aside.chapter\n @scripted = @chapter.scripted\n respond_to do |format|\n if @aside.update(aside_params)\n format.html { redirect_to chapter_path(@chapter), notice: 'Aside was successfully updated.' }\n format.json { render :show, status: :ok, location: @aside }\n else\n format.html { render :edit }\n format.json { render json: @aside.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @office.update(office_params)\n head :no_content\n end",
"def update\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n if @authors_book.update_attributes(params[:authors_book])\n format.html { redirect_to @authors_book, notice: 'Authors book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @authors_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_book = UserBook.find(params[:id])\n\n respond_to do |format|\n if @user_book.update_attributes(params[:user_book])\n format.html { redirect_to new_user_book_path, notice: 'Your book was successfully updated. You can add more or go back to your shelf' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_book.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6286758",
"0.6152691",
"0.61249655",
"0.6065369",
"0.6051807",
"0.5939199",
"0.5919881",
"0.5862974",
"0.5779976",
"0.5743298",
"0.5725421",
"0.5720114",
"0.5708054",
"0.5695846",
"0.5677846",
"0.56751186",
"0.56719136",
"0.56503654",
"0.56502616",
"0.5645794",
"0.5643389",
"0.56419796",
"0.56419796",
"0.56419796",
"0.56419796",
"0.56419796",
"0.56419796",
"0.56419796",
"0.56419796",
"0.56419796",
"0.5641191",
"0.5639576",
"0.5639239",
"0.56321317",
"0.56256807",
"0.5622259",
"0.56098086",
"0.56076884",
"0.5605884",
"0.5601519",
"0.560085",
"0.55977774",
"0.55799943",
"0.5571645",
"0.5566178",
"0.55647135",
"0.5563907",
"0.55590564",
"0.5546103",
"0.55408406",
"0.5539223",
"0.5537698",
"0.5535677",
"0.5535677",
"0.5535677",
"0.5535677",
"0.5533974",
"0.55267507",
"0.5516681",
"0.5500793",
"0.54907876",
"0.5490212",
"0.5489349",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.548754",
"0.5487342",
"0.5482424",
"0.5482338",
"0.547823",
"0.547823",
"0.5476516",
"0.5469233",
"0.5469022",
"0.54579043",
"0.545564",
"0.54554373",
"0.54536706"
] |
0.670074
|
0
|
DELETE /book_editions/1 DELETE /book_editions/1.json
|
def destroy
@book_edition = BookEdition.find(params[:id])
@book_edition.destroy
respond_to do |format|
format.html { redirect_to book_editions_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @book_step = BookStep.find(params[:id])\n @book_step.destroy\n\n respond_to do |format|\n format.html { redirect_to book_steps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ebooks.destroy :id\n respond_to do |format|\n format.html { redirect_to ebooks_url, notice: 'Ebook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ebook = Ebook.find(params[:id])\n @ebook.destroy\n\n respond_to do |format|\n format.html { redirect_to ebooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ebook.destroy\n respond_to do |format|\n format.html { redirect_to ebooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book_shelf = BookShelf.find(params[:id])\n @book_shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to book_shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_book.destroy\n\n head :no_content\n end",
"def destroy\n @edition = Edition.find(params[:id])\n @edition.destroy\n \n respond_to do |format|\n format.html { redirect_to(editions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @chapter.destroy\n\n respond_to do |format|\n format.html { redirect_to book_path(@chapter.book_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n book = Book.find(params[:id])\n book.destroy\n \n render json: {}, status: 204\n end",
"def destroy\n @book.destroy\n head :no_content\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @free_ebook.destroy\n respond_to do |format|\n format.html { redirect_to free_ebooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book_lend.destroy\n respond_to do |format|\n format.html { redirect_to book_lends_url, notice: 'Book lend was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chapter = @book.chapters.find(params[:id])\n # @chapter = Chapter.find(params[:id])\n @chapter.destroy\n\n respond_to do |format|\n format.html { redirect_to book_series_collection_book_chapters_url(@book_series, @collection, @book) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n \n format.json { render json: @book, status: :created, location: @book }\n end\n end",
"def destroy\n @resume_book_url.destroy\n respond_to do |format|\n format.html { redirect_to resume_book_urls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bookalawn.destroy\n respond_to do |format|\n format.html { redirect_to bookalawns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to admin_books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to admin_books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ab_chapter.destroy\n respond_to do |format|\n format.html { redirect_to ab_chapters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chapter.destroy\n respond_to do |format|\n format.html { redirect_to(edit_book_path(@chapter.book)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to book_series_collection_books_path(@book_series, @collection) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to admin_books_path, notice: \"Book #{@book.title} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expedition.destroy\n respond_to do |format|\n format.html { redirect_to expeditions_url, notice: 'Expedition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @readbook.destroy\n respond_to do |format|\n format.html { redirect_to readbooks_url, notice: 'Readbook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exhibition = Exhibition.find(params[:id])\n @exhibition.destroy\n\n respond_to do |format|\n format.html { redirect_to exhibitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n specification = @chapter.specification\n @chapter.destroy\n respond_to do |format|\n format.html { redirect_to specification_path(specification) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kidandparentbook = Kidandparentbook.find(params[:id])\n @kidandparentbook.destroy\n\n respond_to do |format|\n format.html { redirect_to kidandparentbooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :manage, @stuk_book\n\n @stuk_book.destroy\n respond_to do |format|\n format.html { redirect_to stuk_books_url, notice: 'Stuk book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end \n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end \n end",
"def destroy\n @book_catalog_entrie = BookCatalogEntrie.find(params[:id])\n @book_catalog_entrie.destroy\n\n respond_to do |format|\n format.html { redirect_to book_catalog_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @traditional_literature_book.destroy\n respond_to do |format|\n format.html { redirect_to traditional_literature_books_url, notice: \"Traditional literature review was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book_recommendation.destroy\n respond_to do |format|\n format.html { redirect_to book_recommendations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chapter = Chapter.find(params[:id])\n @chapter.destroy\n\n respond_to do |format|\n format.html { redirect_to book_chapters_url(@book) }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @bookreview.destroy\n respond_to do |format|\n format.html { redirect_to book_path(@bookreview.book_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @title = \"Destroy Book\"\n\n # @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @book1.destroy\n respond_to do |format|\n format.html { redirect_to book1s_url, notice: \"Book1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @book = current_user.books.find(params[:id])\n @book.destroy\n render json { head :no_content }\n end",
"def destroy\n @book_contest.destroy\n respond_to do |format|\n format.html { redirect_to book_contests_url, notice: 'Book contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book_exemplar.destroy\n respond_to do |format|\n format.html { redirect_to book_exemplars_url, notice: 'Book exemplar was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: t('common.message.destroyed_success')}\n format.json { head :no_content }\n end\n end",
"def destroy\n @cookbook.destroy\n respond_to do |format|\n format.html { redirect_to cookbooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book entry is deleted successfully\" }\n format.json { head :no_content }\n end\n else\n format.html { redirect_to books_url, notice: \"Book entry is not deleted.\" }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to book_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n get_chapter(params[:id])\n if @chapter && @e\n @chapter.destroy\n respond_to do |format|\n format.html { redirect_to(Book.find_by_id(@chapter.book_id)) }\n format.xml { head :ok }\n end\n else\n redirect_to \"/\"\n end \n end",
"def destroy\n @realistic_fiction_book.destroy\n respond_to do |format|\n format.html { redirect_to realistic_fiction_books_url, notice: \"Realistic fiction book was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enrollment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n @client.delete_document(@path)\n end",
"def destroy\n @mlines = @book.lines.multiple(params[:id])\n @mlines.each {|l| l.destroy}\n respond_to do |format|\n format.html { redirect_to book_multiple_lines_url(@book) }\n format.json { head :ok }\n end\n end",
"def destroy\n @book_a_lawn.destroy\n respond_to do |format|\n format.html { redirect_to book_a_lawns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bookable.destroy\n respond_to do |format|\n format.html { redirect_to bookables_url, notice: 'Bookable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bookkeeping.destroy\n\n head :no_content\n end",
"def destroy\n @chapter_event.destroy\n respond_to do |format|\n format.html { redirect_to chapter_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @education_entry.destroy\n respond_to do |format|\n format.html { redirect_to education_entries_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @book_page = @book.book_pages.find(params[:id])\n @book_page.destroy\n\n respond_to do |format|\n format.html { redirect_to book_series_collection_book_book_pages_url(@book_series, @collection, @book) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_uri, notice: '本を削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cook_book = CookBook.find(params[:id])\n @cook_book.destroy\n\n respond_to do |format|\n format.html { redirect_to cook_books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n format.json { head :no_content }\n end\n end",
"def destroy\n @read_book.destroy\n respond_to do |format|\n format.html { redirect_to read_books_url, notice: 'Read book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addimition = Addimition.find(params[:id])\n @addimition.destroy\n\n respond_to do |format|\n format.html { redirect_to addimitions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @guestbook = Guestbook.find(params[:id])\n @guestbook.destroy\n\n respond_to do |format|\n format.html { redirect_to guestbooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cookbook = Cookbook.find(params[:id])\n @cookbook.destroy\n\n respond_to do |format|\n format.html { redirect_to cookbooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chapter = @book.chapters.find(params[:id])\n @chapter.destroy\n\n respond_to do |format|\n format.html { redirect_to(book_chapters_url(@book)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bookitem.destroy\n respond_to do |format|\n format.html { redirect_to bookitems_url, notice: 'Bookitem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @poetry_anthology_book.destroy\n respond_to do |format|\n format.html { redirect_to poetry_anthology_books_url, notice: \"Poetry anthology review was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n chapter = @sheet.chapter\n @sheet.destroy\n respond_to do |format|\n format.html { redirect_to chapter, notice: 'Sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: @book.title + ' の削除に成功しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bookitem.destroy\n respond_to do |format|\n format.html { redirect_to bookitems_url, notice: \"Bookitem was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7028683",
"0.69519824",
"0.67939264",
"0.6776585",
"0.67064196",
"0.66786176",
"0.6643948",
"0.6634539",
"0.6586968",
"0.65838796",
"0.64897543",
"0.6487982",
"0.64759845",
"0.6473655",
"0.64643717",
"0.6455547",
"0.64515024",
"0.64497",
"0.6442694",
"0.6442694",
"0.6442694",
"0.6442694",
"0.6442694",
"0.6442694",
"0.6442694",
"0.64250445",
"0.64250445",
"0.642105",
"0.64167815",
"0.6399121",
"0.6399121",
"0.6399121",
"0.6399121",
"0.6399121",
"0.6399121",
"0.6399121",
"0.6399121",
"0.6399121",
"0.6399121",
"0.6399121",
"0.6399121",
"0.6392831",
"0.6392345",
"0.63901323",
"0.6381771",
"0.63754016",
"0.63739264",
"0.63739264",
"0.6368835",
"0.6368171",
"0.63626945",
"0.63624495",
"0.6361756",
"0.63581234",
"0.6357671",
"0.63572675",
"0.63572675",
"0.6356927",
"0.6355861",
"0.6355562",
"0.63555497",
"0.63425297",
"0.63305444",
"0.632246",
"0.6316842",
"0.63121605",
"0.63070387",
"0.63050264",
"0.63036484",
"0.6301985",
"0.6300423",
"0.62986284",
"0.6298114",
"0.62935406",
"0.6292777",
"0.6292619",
"0.6285061",
"0.6282119",
"0.6276321",
"0.62761",
"0.62741005",
"0.62739617",
"0.6269987",
"0.6269558",
"0.6268818",
"0.62656826",
"0.6261085",
"0.6260671",
"0.6260447",
"0.62584823",
"0.6256635",
"0.62558097",
"0.6247754",
"0.6247503",
"0.6245635",
"0.6244132",
"0.62439996",
"0.62428534",
"0.6242629",
"0.62425333"
] |
0.75303924
|
0
|
We need this for atom_feed since an item doesn't have its correspoding show page
|
def item_url(item)
item.url
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n\n update_feed(@feed)\n\n @items = @feed.items.order('pub_date DESC').page params[:page]\n\n end",
"def feed_items\n feed_item\n end",
"def show\n @feed = Feed.find(params[:id]) rescue Feed.find_by_uri(params[:id])\n if @feed.is_duplicate? and @feed.duplicate\n redirect_to feed_url(@feed.duplicate)\n else\n respond_to do |wants|\n wants.html do\n render :action => 'show'\n end\n wants.atom do\n render :xml => @feed.to_atom(:base => \"http://#{request.host}:#{request.port}\", :include_entries => true, :page => params[:page]) \n end\n wants.xml { render :xml => @feed.to_xml }\n end\n end\n end",
"def show\n get_activity\n @items = (@my_precontent + @precontent).flatten.uniq.sort {|a,b| b.published_at.to_i <=> a.published_at.to_i}[0..19]\n end",
"def show\n\n unless @post.listeners.blank?\n @posts = @post.listeners.first.favourites.where(:hidden => false).where.not(id: @post.id).page params[:page]\n end\n\n \n end",
"def is_displayed_on_site?\n feed.feed_type.name == \"Article\"\n end",
"def valid_feed?(item)\n !item['url'].to_s.strip.empty?\n end",
"def show\n current_user_as :main_app do |current_user|\n respond_to do |format|\n format.html { render }\n format.rss {\n if @page.contains_feed?\n render :action => \"show\", :layout => false, :handlers => [:builder]\n else\n render :xml => {:error => 'Not found'}, :status => 404\n end\n }\n end\n end\n end",
"def show\n @feed_item = Item.find(params[:id])\n\n render json: @feed_item\n end",
"def show\n @feed_item = FeedItem.find(params[:id])\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @feed_item }\n # end\n redirect_to feed_path\n end",
"def links_feed\n end",
"def shownUavFeed \n \"shownUavFeed\" \n end",
"def show\n @feed = Feed.find(params[:id])\n @related_feeds = @feed.list_related_feeds(current_user)\n @feed_entries = Entry.where(feed_id: @feed.id).order(\"updated_at DESC\").page(params[:page]).per(10)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def show\n @entries = @slideshow.entries.recent.limit(12)\n\n @active_feeds = @slideshow.feeds.order(title: :asc)\n @available_feeds = Feed.where.not(id: @slideshow.feed_ids).order(title: :asc)\n end",
"def show\n @recent = Entry.page\n end",
"def show\n\n @feed = Feed.find(params[:id]) rescue nil\n @page_title = @feed.title unless @feed.nil?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end",
"def show\n @page = Page.find params[:id]\n @feeds = @key_master.feeds(@page.external_id)[0..9]\n rescue\n # API calls have their own damage control mechanism\n # this is only to avoid any quirky things with a messy page id\n redirect_to root_url\n end",
"def show\n redirect_to feeds_url\n # @feed = Feed.find(params[:id])\n # @user_feed = current_user.user_feeds.find_by_feed_id(@feed.id)\n end",
"def show_nouser\n @feed = Feed.find_by_uid!(params[:feed])\n feed_uids = Rails.cache.fetch [:feed_uids, @feed] do\n [@feed.uid] + @feed.children.pluck(:uid)\n end\n\n if @date.nil?\n @date = @feed.last_paper_date\n end\n\n @backdate = _backdate(@date, @range)\n @recent_comments = _recent_comments(feed_uids)\n @papers, @pagination = _range_query(feed_uids, @backdate, @date, @page)\n\n render 'feeds/show'\n end",
"def show\n expires_in cache_page? ? 1.month : 0\n if !cache_page? || stale?(etag: @page, last_modified: @page.published_at, public: !@page.restricted)\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n format.rss do\n if @page.contains_feed?\n render action: 'show', layout: false, handlers: [:builder]\n else\n render xml: {error: 'Not found'}, status: 404\n end\n end\n format.json { render json: @page }\n end\n end\n end",
"def show\n @feed_entry = FeedEntry.find(params[:id])\n @feed_entry.set_read\n @title = @feed_entry.title\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed_entry }\n end\n end",
"def show\n set_meta_tags title: @item.title, reverse: true\n @rss = Rss.find(@item.rss_id)\n set_meta_tags twitter: {\n card: \"photo\",\n site: request.url,\n title: @item.title,\n image: @item.image,\n }\n end",
"def feed_items(feed_title) \n # update last_viewed_at \n @client.query \"UPDATE feeds SET last_viewed_at = now() where title = '#{e feed_title}'\"\n query = \"SELECT items.title, guid, feed, feed_title, pub_date, word_count, starred, unread from items where items.feed_title = '#{e feed_title}' order by pub_date asc\"\n @client.query(query)\n end",
"def set_feed_item\n @feed_item = FeedItem.find(params[:id])\n end",
"def show\n @update = Update.with_preloads.where(permalink: params[:id]).take!\n @previous = Update.where('created_at < ?', @update.created_at).order('created_at DESC').first\n @next = Update.where('created_at > ?', @update.created_at).order('created_at ASC').first\n @page_title = @update.title\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @update }\n end\n end",
"def show\n @item = @site.items.find(params[:id], :conditions => {:published => true})\n # if a page paramenter exists then we know the item was from that page\n # so we can narrow the search to that page, otherwise we need all the items\n # from the site but will paginate needs a page size so... 1,000,000\n page_size = 10 # 1 million results max... Needs rethinking\n \n # get next/previous items in current context if they exist\n @items = Item.search_from_params(get_search_params(params).merge(:published => true), @site.id ,page_size)\n index = @items.index(@item)\n\n @next_item = @item.next_by_id\n @previous_item = @item.previous_by_id\n \n add_crumb(\"Search\", items_path(get_search_params(params), :subdomain => @site.title))\n add_crumb @item.title\n store_location :items_return\n render :layout => \"site\"\n end",
"def rss\n render_rss_feed_for Idea.find(:all, :order => 'created_at DESC',\n :limit => 10), {\n :feed => {\n :title => 'OpenMind New Ideas',\n :link => url_for(:controller => 'ideas', :action => 'list', :only_path => false),\n :pub_date => :created_at\n },\n :item => {\n :title => :title,\n :description => :formatted_description,\n :link => Proc.new{|idea| url_for(:controller => 'ideas',\n :action => 'show', :id => idea.id)}\n }\n }\n end",
"def feed_items\n []\n end",
"def feed_item(list, title = @config[:title], identifier = '/feed/')\n Nanoc::Item.new(\n '<%= atom_feed(:articles => @item[:list]) %>',\n {:title => title, :extension => 'atom', :list => list},\n identifier\n )\nend",
"def index\n @feed_items = FeedItem.all\n end",
"def no_feed\n\n end",
"def show\n @page_title = @item.display_title\n logger.info \" Item price: #{@item.price}\"\n record_item_view!(@item)\n status_list = [::Item::Status::OPEN]\n sort_order = 'id desc'\n if auth_user && auth_user.parent_of?(@item.user)\n status_list << ::Item::Status::PENDING\n sort_order = 'status desc, id asc'\n end\n @other_items = Item.owned_by(@item.user).where([\"id != #{@item.id} AND status IN (?)\", status_list] ).order(sort_order).limit(40) if not @item.manageable_by_user?(auth_user)\n @favorite_item_ids = ::Items::FavoriteItem.where(user_id: auth_user.id, item_id: (@other_items.to_a.collect(&:id) + [@item.id]) ).collect(&:item_id) if auth_user\n @is_in_favorite_items = @favorite_item_ids.to_a.include?(@item.id)\n logger.info \"| favs (in? #{@is_in_favorite_items}): #{@favorite_item_ids.inspect}\"\n logger.info \"| permission to user #{auth_user.try(:user_name)}: #{@item.permission_to_user(auth_user)}\"\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n render json: @item.detailed_json({:is_follower_user_id => auth_user.try(:id)}, auth_user.try(:id) ).\n merge(:permission => @item.permission_to_user(auth_user), :comment_threads => make_buyer_based_item_comments_threads(@item),:other_items => @other_items, :favorite_item_ids => @favorite_item_ids.to_a, :is_in_favorite_items => @is_in_favorite_items )\n end\n end\n end",
"def show\n @mypost = Mypost.find(params[:id])\n\t@myposts = Mypost.all\n @feed_me_items = []\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mypost }\n end\n\t\n end",
"def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def newsfeed\n Post.newsfeed_for(self)\n end",
"def show\n @entries = @feed.entries.for_user(current_user.id, @@per_page).paginate(page: params[:page], per_page: @@per_page).set_read_attribute\n @unread_entries_count = @feed.entries.for_user(current_user.id,nil).where(reads: {read: false}).count\n end",
"def show\n if @user != current_user\n redirect_to :action => 'feed', :id => @user.id\n end\n end",
"def item_endpoint?(page)\n page == :item\n end",
"def show\n @feed_entry = FeedEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed_entry }\n end\n end",
"def show\n \t@user = User.find(params[:id])\n # Make microposts available for users show-action\n @feed_items = @user.microposts.paginate(page: params[:page])\n end",
"def show\n @news_item = find_news_item_by_leagcy ||\n find_news_item_by_id ||\n raise(ActiveRecord::RecordNotFound)\n end",
"def links\n return nil unless @item and self.type == :query and @item['entry']['link']\n @item['entry']['link']\n end",
"def m_has_shown\n @m_has_shown = Movie.where(:has_shown => true).order(\"created_at desc\").page\n end",
"def show_drafts; end",
"def show\n @feed = Feed.find(params[:id])\n @entries = EntryFeed.where(:feed_id => @feed.id)\n\n if @entries.blank?\n EntryFeed.create_from_feed(@feed)\n @entries = EntryFeed.where(:feed_id => @feed.id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @feed }\n end\n end",
"def show\n @populate_feed_info = PopulateFeedInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @populate_feed_info }\n end\n end",
"def show\n @playlist = Playlist.find(params[:id])\n \n options = { :feed => { :title => @playlist,\n :description => \"\",\n :language => \"en-us\" },\n :item => { :title => :name,\n :pub_date => :created_at }\n }\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @playlist.to_xml }\n format.rss { render_rss_feed_for @playlist.plays, \n options.update({:link => formatted_playlists_url(:rss)}) \n }\n format.atom { render_atom_feed_for @playlist.plays, \n options.update({:link => formatted_playlists_url(:atom)}) \n }\n format.enlarged { render :layout => 'enlarged'\n \n }\n end\n end",
"def parse_feed\n remove_previous_entries\n @items = @content[\"rss\"][\"channel\"][\"item\"]\n if !@items.nil?\n for item in @items do\n item[\"pubDate\"] ||= \"\"\n item[\"creator\"] ||= \"\"\n item[\"guid\"] ||= \"\"\n item[\"title\"] ||= \"\"\n item[\"description\"] ||= \"\"\n clean_content(item[\"encoded\"] ||= \"\")\n item[\"link\"] ||= \"\"\n params = { \n :pubdate => item[\"pubDate\"], \n :creator => item[\"creator\"], \n :guid => relative_link(item[\"guid\"]), \n :title => item[\"title\"], \n :description => item[\"description\"], \n :content => @content, \n :link => relative_link(item[\"link\"])\n }\n insert_entry(params)\n end\n end\n end",
"def show\n @item = Item.find_by_id(params[:id])\n chk = true\n if @item and (not @item.user.active or @item.deleted?) then chk = false end\n if chk and @item\n if @item.completed?\n redirect_to accepted_offers_item_path(@item)\n elsif !@item.completed? and params[:tab].blank?\n redirect_to trade_offers_item_path(@item, :section => params[:section], :scroll => params[:scroll], :offer_by => params[:offer_by])\n end\n @like_count = @item.likes.count\n @owner = @item.user\n if @item.category.present?\n @breadcrumb = @item.category\n end\n @comments = @item.comments.where(\"deleted = false\").includes(:user)\n begin\n if @item.category.present?\n search_result = Item.item_search(nil, @item.category_id, \"most offered\", nil,nil,1, session[:user_ll], nil,4)\n # debugger\n if search_result.blank? or (search_result.present? and search_result.results.count < 5)\n search_result = Item.item_search(nil, nil, \"most offered\",nil,nil, 1, session[:user_ll], nil,5)\n end\n else\n search_result = Item.item_search(nil, nil, \"most offered\",nil,nil, 1, session[:user_ll], nil,5)\n end\n similar_item = search_result.results\n @similar_items = similar_item.delete_if{|x| x.id == @item.id}\n if similar_item.count == 5\n @similar_items = similar_item.last.delete\n end\n rescue StandardError => e\n @similar_items = []\n end\n # render 'show'\n else\n redirect_to dead_link_path\n end\n end",
"def show\n dummy_item\n end",
"def show_nouser\n @feed = Feed.find_by_uid!(params[:feed])\n feed_uids = [@feed.uid] + @feed.children.pluck(:uid)\n\n @date = (_parse_date(params) || @feed.last_paper_date || Date.today).to_date\n @range = _parse_range(params) || 1\n @page = params[:page]\n\n if @range == :since_last\n # If we're not signed in, there's no sense\n # in which we can do \"since last\"\n @range = 1\n end\n\n @backdate = @date - (@range-1).days\n\n @recent_comments = _recent_comments(feed_uids)\n\n @papers = _range_query(feed_uids, @backdate, @date, @page)\n end",
"def initialize(feed, item)\n if (feed.feed_type == \"rss\")\n @feed_title = feed.channel.title\n @title = item.title\n @link = item.link\n @date = parse_time(item.date)\n @content = item.description\n @content = item.content_encoded if item.content_encoded\n @guid = item.guid.content\n @audio = nil\n if item.enclosure\n if item.enclosure.type == \"audio/mpeg\"\n @audio = item.enclosure.url\n elsif item.enclosure.type.start_with? \"image/\" # If there is an image in the enclosure\n unless @content.include? \"<img \" # and no images in the content\n # then include the enclosure image\n @content = \"<img src=\\\"#{item.enclosure.url}\\\" /><br/>\" + @content\n end\n end\n end\n elsif (feed.feed_type == \"atom\")\n @feed_title = feed.title.content\n @title = item.title.content\n @link = item.link.href\n if !item.published.nil?\n @date = parse_time(item.published.content)\n else\n @date = parse_time(item.updated.content)\n end\n if !item.content.nil?\n @content = CGI.unescapeHTML(item.content.to_s)\n else\n @content = CGI.unescapeHTML(item.summary.to_s)\n end\n @guid = item.id.to_s\n @audio = nil # TODO podcast support for Atom feeds?\n end\n end",
"def show\n @series = Series.find(params[:id])\n @feeds = Feed.where(series_id: params[:id])\n @feeds.each do |feed|\n @entries = Entry.where(feed_id: feed.id).order(:created_at).page params[:page]\n end\n \n end",
"def feed_for(name)\n find_articles(name) \n articles_to_list\n feed = @page.page_parts.where(name: 'feed').first\n process_with_filter(feed) \n end",
"def show\n render json: NewsEntry.find(params[:id]).to_json(include: [:feed])\n end",
"def index\n @places = @places.page params[:page]\n\n @feed_link = places_url(:format => :atom)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n format.atom { render :layout => false }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end",
"def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end",
"def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end",
"def index\n @items = Item.eager_load(:rss).paginate(page: params[:page], :per_page => 10).order(\"date DESC\")\n end",
"def show\n @page = Page.find(params[:id], :include => [ 'discussions' ])\n @secondary_title = @page.title\n @pages, @discussions = paginate :discussion, :order => 'created_at ASC',\n :conditions => [ 'page_id = ?', @page.id ], :per_page => per_page\n respond_to do |format|\n format.html\n format.rss { render :partial => 'discussions' }\n end\n end",
"def show\n @feed = Feed.find(params[:id])\n end",
"def show\n @feed = Feed.find(params[:id])\n end",
"def feed_urls\n nil\n end",
"def show\n set_item\n end",
"def show\n begin\n @feeds = @graph.get_connections( @page.page_id.to_i, \"feed?limit=10\")\n rescue Koala::Facebook::ClientError => exc\n redirect_to root_url, notice: \"Nous avons rencontre un probleme, veuillez reessayer.\"\n end\n end",
"def show\r\n @feed = Feed.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @rss_entry }\r\n end\r\n end",
"def title() @feed.read_attribute( :title ); end",
"def show\n @item = Item.find_by_id( params[:id] )\n @items_like_mine = @item.find_items_like_mine \n end",
"def find_news_item\n @news_item = @node.content\n end",
"def show\n if !@item.active && !@item.listed_category && !@item.listed_designer\n redirect_to category_path(@item.category_list.last, archive_item: @item.filemaker_id)\n else\n # @item_images = @item.images.show_list.order('image_type')\n @item_images = @item.images.detail_images.order('position')\n # impressionist(@item, \"item detail\")\n end\n end",
"def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @news_item.to_xml }\n end\n end",
"def item_link(item)\n if !item.new_record?\n if item.respond_to?(:name)\n content_tag(:li, link_to(item.name, [:cms, @available_locale, item]), class: 'current hide-for-small')\n elsif item.respond_to?(:headline)\n content_tag(:li, link_to(item.headline.truncate(30), [:cms, @available_locale, item]), class: 'current hide-for-small')\n elsif item.respond_to?(:title)\n content_tag(:li, link_to(item.title.truncate(30), [:cms, @available_locale, item]), class: 'current hide-for-small')\n end\n end\n end",
"def feed\n @feed_items = @repository.recent_feed_items\n respond_to do |format|\n format.html # feed.html.erb\n format.json { render json: @feed_items }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n @related = Article.visible.where(press_release: 0).sorted.limit(5)\n @related.reject!{|x| x == @article }\n\n if I18n.locale == :en\n @related.reject!{|x| x.title_en.to_s.strip.length == 0 }\n else\n @related.reject!{|x| x.title_no.to_s.strip.length == 0 }\n end\n end",
"def show\n set_meta_tags title: \"#{@item.name} | #{@place.is_restaurant? ? \"Categorías\" : \"Departamentos\"} #{@place.name}\",\n description: \"#{@item.name} | #{@place.is_restaurant? ? \"Categorías\" : \"Departamentos\"} #{@place.name}\"\n @products = @place.products.where(:item_ids.in => [@item.id]).paginate(page: params[:page], per_page: 30)\n end",
"def ill_item?(instance)\n instance['source'] == 'FOLIO' &&\n instance['discoverySuppress'] == true &&\n instance['staffSuppress'] == false\n end",
"def feed\n @data.feed ||= parsed_document.xpath(\"//link\").select{ |link|\n link.attributes[\"type\"] && link.attributes[\"type\"].value =~ /(atom|rss)/\n }.map { |link|\n absolutify_url(link.attributes[\"href\"].value)\n }.first rescue nil\n end",
"def has_feed?\n !feed.nil?\n end",
"def show\n @feed = Feed.find(params[:id])\n #@feeds = Feed.from_users_followed_by(current_user)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def item_page\n @item_page ||= ApiBucket::Base::Element.get(@doc, \"//ItemPage\").to_i\n end",
"def feed\n FeedItem.from_users_followed_by(self)\n end",
"def rss\n render_rss_feed_for Announcement.find(:all, :order => 'created_at DESC',\n :limit => 10), {\n :feed => {\n :title => 'OpenMind New Announcements',\n :link => announcements_url,\n :pub_date => :created_at\n },\n :item => {\n :title => :headline,\n :description => :formatted_description,\n :link => Proc.new{|announcement| \"#{announcements_url}##{announcement.id}\" }\n }\n }\n end",
"def questions_feed_url\n view_context.questions_url(:format => \"atom\")\n end",
"def show\n @action_item = ActionItem.find(params[:id])\n \n @action_item_comment = ActionItemComment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @action_item }\n end\n end",
"def index\n @feed_urls = current_account.feed_urls.paginate(page: params[:page]).order(id: :desc)\n end",
"def show\n\t @entry = @feed.entries.find_by(id: params[:id])\n @dash = Dashboard.find_by(user_id: @user.id, entry_id: @entry.id )\n @dash.update(read: \"TRUE\")\n @unread = @user.dashboards.where(\"feed_id = ?\", params[:feed_id]).order(entry_published: :desc)\n respond_to do |format|\n format.js\n format.html\n end\n end",
"def show\n @page_title = @podcast.title\n @page_description = @podcast.extrait\n @page_keywords = \"Podcasts, enseignements, Parole de Dieu, méditation, Jesus Christ\"\n\n set_meta_tags og: {\n title: @podcast.title,\n type: \"article\",\n url: request.url,\n image: rails_blob_path(@podcast.cover)\n }\n\n # adding acticle og\n set_meta_tags article: {\n published_time: @podcast.created_at,\n modified_time: @podcast.updated_at,\n section: @podcast.type_podcast.name,\n tag: \"MPPP\"\n }\n\n # adding twitter card\n set_meta_tags twitter: {\n title: @podcast.title,\n creator: \"MPPP\",\n card: @podcast.extrait,\n site: request.url,\n image: rails_blob_path(@podcast.cover)\n }\n track \"Viewed Podcast\", title: @podcast.title\n end",
"def index\n @posts = Post.limit 50\n @title = \"Weblog - last posts\"\n @updated = @posts.first.created_at unless @posts.empty?\n respond_to do |format|\n format.rss do\n redirect_to feeds_path(format: :atom),\n status: :moved_permanently\n end\n format.atom\n end\n end",
"def show\n @site = Site.find(params[:id])\n strFeedIds = @site.sitefeeds.collect(&:feedpost_id)\n #debugger\n @feedposts = Feedpost.where(:_id.in => strFeedIds).descending(:published).page params[:page]\n @relatedsites = Site.not_in(_id: [@site.id]).limit(3)\n\n #@posts = Post.where(:site_id => params[:id]).order_by(:created_at.desc).paginate(:per_page => 8, :page => params[:page])\n #@posts = get_site_posts(params[:id]).order_by([:user_id, :desc]).paginate(:per_page => 8, :page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.xml { render :xml => @site }\n end\n end",
"def recent_feed_items(limit = 100)\n feed_items.order('created_at DESC').limit(limit)\n end",
"def published() @feed.read_attribute(:published); end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end",
"def rss_url\n [@page.path, 'rss'] * '.'\n end",
"def show\n @feed = current_user.feeds.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def parse_feed_url\n url = sanitize_url(self.url)\n Feedbag.find(url)[0]\n end",
"def display_social_bookmarks?; true end",
"def show\n @page = Page.where(:permalink => params[:permalink]).first if params[:permalink]\n @page = Page.where(:permalink => params[:id]).first if params[:id]\n # @page = Page.where(:permalink => params[:id]).first\n @page = @home_page if @page.nil?\n \n @meta_title = @page.meta_title\n @meta_keywords = @page.meta_keywords\n @meta_description = @page.meta_description\n \n respond_to do |format|\n format.html\n format.xml { render :xml => @page }\n end\n end",
"def show\n @article = Article.where(\"link ='#{params[:title]}'\").first\n end"
] |
[
"0.7065571",
"0.6741975",
"0.66020906",
"0.62356824",
"0.6219078",
"0.6200962",
"0.6180708",
"0.6100122",
"0.60709983",
"0.6049007",
"0.6026695",
"0.5978764",
"0.5975321",
"0.5971491",
"0.5958351",
"0.5957793",
"0.5940805",
"0.5933831",
"0.5932071",
"0.5916692",
"0.59159124",
"0.58620363",
"0.5861602",
"0.58611584",
"0.5841014",
"0.58255213",
"0.5824884",
"0.58239007",
"0.5812699",
"0.579246",
"0.5787959",
"0.5777018",
"0.575763",
"0.5748529",
"0.5726803",
"0.5722704",
"0.5706802",
"0.5703322",
"0.5689357",
"0.56890416",
"0.5684587",
"0.5679058",
"0.56755924",
"0.56611836",
"0.56607306",
"0.56445646",
"0.563844",
"0.56328",
"0.5630219",
"0.56175995",
"0.5609616",
"0.56067187",
"0.5599784",
"0.5597359",
"0.55896986",
"0.5579791",
"0.5567564",
"0.5562264",
"0.5562264",
"0.5560594",
"0.5559078",
"0.5557656",
"0.5557656",
"0.554876",
"0.5545815",
"0.553884",
"0.5537921",
"0.55304",
"0.552868",
"0.5516833",
"0.5509592",
"0.5502623",
"0.54983586",
"0.54967076",
"0.549223",
"0.547659",
"0.5476007",
"0.54741305",
"0.5465069",
"0.5448942",
"0.5446799",
"0.5442507",
"0.5438095",
"0.54378444",
"0.54360795",
"0.54305565",
"0.54297566",
"0.54291695",
"0.54229313",
"0.5417144",
"0.5416826",
"0.5413662",
"0.5413306",
"0.54123855",
"0.54118395",
"0.5410533",
"0.5410281",
"0.54068327",
"0.53992903"
] |
0.55392957
|
66
|
GET /injurylocations GET /injurylocations.json
|
def index
@injurylocations = Injurylocation.all
@injurylocation = Injurylocation.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def locations\n get('locations')\n end",
"def index\n @investigationinjurylocations = Investigationinjurylocation.all\n end",
"def index\n locations = @project.locations.all\n render json: { locations: locations }\n end",
"def get_location\n as_json(get_results('/locations.json'))\n end",
"def index\n\t\tsurgery_locations = SurgeryLocation.all\n\t\tif surgery_locations.present?\n\t # response to the JSON\n\t render json: { success: true, response: surgery_locations.map{ |f| SurgeryLocationSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Surgery Location is not present.\" },:status=> 203\n\t end \n\tend",
"def index\n locations = Location.all\n render json: locations\n end",
"def index\n @locations = current_user.locations\n respond_with @locations\n end",
"def create\n @injurylocation = Injurylocation.new(injurylocation_params)\n\n respond_to do |format|\n if @injurylocation.save\n format.html { redirect_to injurylocations_path, notice: 'Injurylocation was successfully created.' }\n format.json { render :show, status: :created, location: @injurylocation }\n else\n format.html { render :new }\n format.json { render json: @injurylocation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def locations\n farm = Farm.find(params[:id])\n\n @locations = []\n # Find which locations this user is authorized to access\n if (current_user.is_hog_owner? || current_user.is_farm_owner? || current_user.is_admin?)\n @locations = farm.locations\n elsif current_user.is_barn_manager?\n @locations << current_user.owner.barn.location\n elsif current_user.is_site_manager?\n @locations << current_user.owner.location\n end\n\n @page_title = \"Sites\"\n @header_icon_class = \"icon-road\"\n @page_subtitle = \"\"\n \n respond_to do |format|\n format.html { render '/locations/index' }\n format.json { render json: @locations }\n end\n end",
"def index\r\n @locations = Location.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\n end",
"def index\n @user_locations = ::Users::UserLocation.where(user_id: auth_user.id).order('is_primary desc')\n @page_title = 'Your Addresses'\n\n respond_to do|format|\n format.html\n format.json { render json: @user_locations }\n end\n end",
"def get_json\n response = conn.get(@current_location)\n parsed = JSON.parse(response.body, symbolize_names: true)\n\n end",
"def index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end",
"def set_injurylocation\n @injurylocation = Injurylocation.find(params[:id])\n end",
"def index\n @locations = Location.all\n\n respond_with(@locations)\n end",
"def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\n end",
"def index\n @locations = Location.order(\"id desc\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\n @clinic_locations = ClinicLocation.all\n\n # respond_to do |f|\n # f.json { render :index, location: @clinic_locations }\n # end\n end",
"def location_primer\n render(json: location_list)\n end",
"def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def show\n\t\t@all_locations = Location.where(:faculty => params[:id])\n\t\trender :json => @all_locations\n\tend",
"def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end",
"def event_get_location_details\n @loc = Apis::HereApi.new(\"\").get_location_details(params[:locationid])\n render json: @loc\n end",
"def index\n @locations = Location.order(:country).order(:region).order(:city).page(params[:page])\n respond_with(@locations)\n end",
"def index\n code = :ok\n currentUser = {\n id: current_user.utilisateur.id,\n fullName: current_user.utilisateur.prenom_nom,\n }\n result = {\n signedIn: user_signed_in?,\n currentUser: currentUser,\n locations: Lieu.all\n }\n render json: result, status: code \n end",
"def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end",
"def index\n # @locations = Location.all\n\n #po dodaniu has_many @locations, :through => @firms\n @locations = current_user.locations if signed_in?\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\n @injuries = Injury.all\n end",
"def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end",
"def locations id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/locations?date=#{date}\"\n fetch uri\n end",
"def index\n @items_locations = ItemsLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items_locations }\n end\n end",
"def index\n candidate = UspsInPersonProofing::Applicant.new(\n address: search_params['street_address'],\n city: search_params['city'], state: search_params['state'],\n zip_code: search_params['zip_code']\n )\n response = proofer.request_facilities(candidate)\n if response.length > 0\n analytics.idv_in_person_locations_searched(\n success: true,\n result_total: response.length,\n )\n else\n analytics.idv_in_person_locations_searched(\n success: false, errors: 'No USPS locations found',\n )\n end\n render json: response.to_json\n end",
"def index\n @specific_locations = SpecificLocation.all\n end",
"def index\n @event_locations = EventLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_locations }\n end\n end",
"def locations(place)\n get :loc => place\n end",
"def show\n sighting = Sighting.find(params[:id])\n #render json: sighting.to_json(:include => {:bird => {:only =>[:name, :species]}, :location => {:only =>[:latitude, :longitude]}}, :except => [:updated_at])\n end",
"def show\n render json: Location.find(params[\"id\"])\n end",
"def locations\n # blank\n end",
"def query\n { :locations => [] }\n end",
"def get_institutions\r\n # Prepare query url.\r\n _path_url = '/institutions'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| Institution.from_hash(element) }\r\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def locations(query = {})\n get('location', query)\n end",
"def show\n @corp_location = CorpLocation.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corp_location }\n end\n end",
"def show\n @locations=@work.locations\n map\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end",
"def locations\n @client.get('/BikePoint')\n end",
"def vi_locations_list\n payload[:vi_locations].nil? ? nil : payload[:vi_locations]\n end",
"def index\n @emergency_locations = EmergencyLocation.all\n end",
"def show\n render :json => Location.find(params[:id])\n end",
"def show\n @location = Location.find(params[:id])\n render json: @locationProut\n end",
"def index\n @crash_locations = CrashLocation.all\n gon.locations = retrieve_locations\n end",
"def index\n\t\t@surgery_locations = devise_current_user.setting.surgery_locations.all\n\tend",
"def get_locations\n location_references =\n lighthouse_appointments.each_with_object({}) do |appt, acc|\n reference = appt.resource.participant.first.actor.reference\n location_id = reference.match(ID_MATCHER)[1]\n\n acc[location_id] ||= []\n acc[location_id] << appt\n end\n\n clinic_identifiers = location_references&.keys&.join(',')\n location_response = location_service.search(_id: clinic_identifiers, _count: '100')\n\n location_response&.resource&.entry\n end",
"def show_locations\n @all_encounters = PatientEncounter\n @all_locations = {}\n @all_encounters.each do |x|\n @all_locations[x.location.id] = x.location.name\n end\n end",
"def index\n @locations = @organization.locations.all\n\n @map = Cartographer::Gmap.new( 'map' )\n @map.zoom = :bound\n @map.icons << Cartographer::Gicon.new\n \n @organization.locations.each do |location|\n @map.markers << \n Cartographer::Gmarker.new(\n :name => 'location_'+Digest::MD5.hexdigest(location.name),\n :marker_type => \"Building\",\n :position => [location.lat, location.lng],\n :info_window_url => \"fixme.org\"\n )\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\n require 'geoip'\n @projects = Department.all_projects\n rip = request.remote_ip\n ip = rip == '127.0.0.1' ? '24.90.88.129' : rip\n geo = GeoIP.new('lib/GeoLiteCity.dat').city(ip) || GeoIP.new('lib/GeoLiteCity.dat').city('24.90.88.129')\n @my_place = geo.latitude.to_s + \", \" + geo.longitude.to_s\n redirect_to action: :list\n #respond_to do |format|\n #format.html # index.html.erb\n #format.json { render json: @projects }\n #end\n end",
"def index\n @locations = salor_user.get_locations(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def index\n @processed_locations = ProcessedLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @processed_locations }\n end\n end",
"def index\n @drop_locations = DropLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drop_locations }\n end\n end",
"def locations\n if params[:oblast].present? and params[:district].present?\n @locations = { :hospitals => Hospital.where(:oblast => params[:oblast], :district => params[:district]).map { |r|\n { id:r.id, name:r.name,address:r.display_address } \n } }\n elsif params[:oblast].present?\n @locations = { :districts => Hospital.select(\"district\").where(:oblast => params[:oblast]).order(:district).uniq.map { |r| r[:district] } }\n else \n @locations = { }\n end\n\n respond_with @locations\n end",
"def index\r\n @locations = Location.all\r\n @mv = MapsVersion.first\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def locations\n\t\t[]\n\tend",
"def index\n if can?(:>=, \"5\")\n @locations = Kitting::Location.where(\"customer_number = ? OR customer_number IS NULL\",session[:customer_number])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end",
"def show\n Project.hit 31\n @location = IphoneLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n format.xml { render xml: @location }\n end\n end",
"def index\n @current_locations = CurrentLocation.all\n end",
"def update\n respond_to do |format|\n if @injurylocation.update(injurylocation_params)\n format.html { redirect_to @injurylocation, notice: 'Injurylocation was successfully updated.' }\n format.json { render :show, status: :ok, location: @injurylocation }\n else\n format.html { render :edit }\n format.json { render json: @injurylocation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show_location\n\t\trecords = University.where(['state LIKE ?', \"%#{params[:location]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend",
"def get_locations\n splits = SplitLocationFinder.splits(params).where.not(course_id: @event.course_id)\n render json: splits, each_serializer: SplitLocationSerializer\n end",
"def get_locations\n splits = SplitLocationFinder.splits(params).where.not(course_id: @event.course_id)\n render json: splits, each_serializer: SplitLocationSerializer\n end",
"def locations\n locations_params = Hashie::Mash.new( {f: params.f} )\n response = make_request(LOCATIONS_BASE, locations_params)\n return not_available (response) unless response.status == 200\n response_body = Hashie::Mash.new(JSON.parse(response.body))\n response_body.data\n end",
"def index\n @patient_locations = PatientLocation.all\n end",
"def list_dubious_locations # :nologin:\n query = create_query(:Location, :all, :by => :name)\n show_selected_locations(query, :link_all_sorts => true,\n :action => :list_dubious_locations, :num_per_page => 1000)\n end",
"def getlocation\n \tlocafid = Windmill.where(no: params[:no])\nif locafid.present?\n \t\tlocafid = Windmill.find_by(no: params[:no])\n \t\trender json: [locafid.as_json(only: [:no, :latitude, :londitude,:location])]\nelse\n \t\trender json: {massage: 'windmill not found'}\n end\nend",
"def client_outlets\n @entries = Outlet.where(location_id: params[:location]) if request.xhr? \n end",
"def index\n @estates = Estate.all\n @json = @estates.to_gmaps4rails\n respond_with(@estates)\n \n end",
"def show\n @curpg = :admintools\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def index\n @region = Region.find_by_id params[:region_id]\n @locations = @region.locations.select(\"id,name,region_id\")\n\n respond_with @locations #Location.select(\"id,name\")\n end",
"def index\n @locations=Location.all\n end",
"def list_locations\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Locations\"\n \n if(@company.can_view(current_user))\n @locations = Location.where(company_id: @company.id).order(\"name\")\n else\n errPerms()\n end\n end",
"def get_related_locations(location_ids, output_directory)\n specific_locations = LOCATIONS.find_all { |loc| location_ids.include?(loc[:id]) }\n generate_ndjson(\"Location\", specific_locations, output_directory)\nend",
"def show\n respond_to do |format|\n format.html { @api_v1_location }\n format.json { render json: {results: @api_v1_location, message: 'Locations have loaded successfully.'} }\n end\n end",
"def set_investigationinjurylocation\n @investigationinjurylocation = Investigationinjurylocation.find(params[:id])\n end",
"def index\r\n @profile_locations = ProfileLocation.all\r\n end",
"def index\n @location_details = LocationDetail.all\n end",
"def get_all_locations\n @locations = []\n results = Location.all\n results.each do |loc|\n @locations << loc.to_hash\n end\n end",
"def geo\n\t\tciudad = params[:id]\n\t\t@ubication = City.where(id: ciudad)\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @ubication }\n\t\tend\n\tend",
"def find_surgery_location\n\t\t# Find the surgeon location based on the profile\n\t\t@surgery_locations = current_user.setting.surgery_locations.all\n\tend",
"def show\n @location_have_location = LocationHaveLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_have_location }\n end\n end",
"def location\n fetch('hey_arnold.locations')\n end"
] |
[
"0.707683",
"0.70538217",
"0.69565535",
"0.6797584",
"0.6729313",
"0.6706152",
"0.65481186",
"0.64846283",
"0.6391387",
"0.63740015",
"0.63456833",
"0.6335893",
"0.62675375",
"0.6259015",
"0.6255757",
"0.62306124",
"0.62120104",
"0.62052584",
"0.61991715",
"0.61971456",
"0.619189",
"0.61838585",
"0.6170568",
"0.6145371",
"0.6136051",
"0.61142373",
"0.6113761",
"0.6092414",
"0.6072183",
"0.6070456",
"0.6066404",
"0.606624",
"0.6051953",
"0.6046711",
"0.60366297",
"0.6034339",
"0.60335463",
"0.60306036",
"0.60163844",
"0.6009468",
"0.60078603",
"0.6005042",
"0.5968941",
"0.5968941",
"0.5968941",
"0.5968941",
"0.5968941",
"0.5968941",
"0.5968941",
"0.5968941",
"0.5968941",
"0.5968941",
"0.5968941",
"0.59525615",
"0.59470093",
"0.5939132",
"0.59334797",
"0.59244025",
"0.5915229",
"0.59115756",
"0.59081775",
"0.59011364",
"0.58939725",
"0.58921057",
"0.58897823",
"0.5882837",
"0.58649635",
"0.58646697",
"0.58472973",
"0.5843362",
"0.58324045",
"0.582824",
"0.58256435",
"0.5822806",
"0.5822029",
"0.58156097",
"0.5806912",
"0.58006245",
"0.57942516",
"0.57942516",
"0.5787926",
"0.5784133",
"0.5778244",
"0.5753973",
"0.57495713",
"0.5745342",
"0.5744675",
"0.57389",
"0.5732727",
"0.5718247",
"0.5716698",
"0.5694838",
"0.5692089",
"0.56913155",
"0.5689874",
"0.5687897",
"0.56815755",
"0.56811315",
"0.56808525",
"0.56750894"
] |
0.6872393
|
3
|
GET /injurylocations/1 GET /injurylocations/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @injurylocations = Injurylocation.all\n @injurylocation = Injurylocation.new\n end",
"def index\n locations = @project.locations.all\n render json: { locations: locations }\n end",
"def index\n @investigationinjurylocations = Investigationinjurylocation.all\n end",
"def index\n locations = Location.all\n render json: locations\n end",
"def locations\n get('locations')\n end",
"def create\n @injurylocation = Injurylocation.new(injurylocation_params)\n\n respond_to do |format|\n if @injurylocation.save\n format.html { redirect_to injurylocations_path, notice: 'Injurylocation was successfully created.' }\n format.json { render :show, status: :created, location: @injurylocation }\n else\n format.html { render :new }\n format.json { render json: @injurylocation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_location\n as_json(get_results('/locations.json'))\n end",
"def index\n\t\tsurgery_locations = SurgeryLocation.all\n\t\tif surgery_locations.present?\n\t # response to the JSON\n\t render json: { success: true, response: surgery_locations.map{ |f| SurgeryLocationSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Surgery Location is not present.\" },:status=> 203\n\t end \n\tend",
"def set_injurylocation\n @injurylocation = Injurylocation.find(params[:id])\n end",
"def index\r\n @locations = Location.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\n end",
"def index\n @locations = Location.order(\"id desc\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def show\n\t\t@all_locations = Location.where(:faculty => params[:id])\n\t\trender :json => @all_locations\n\tend",
"def show\n render json: Location.find(params[\"id\"])\n end",
"def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\n end",
"def index\n @user_locations = ::Users::UserLocation.where(user_id: auth_user.id).order('is_primary desc')\n @page_title = 'Your Addresses'\n\n respond_to do|format|\n format.html\n format.json { render json: @user_locations }\n end\n end",
"def index\n @clinic_locations = ClinicLocation.all\n\n # respond_to do |f|\n # f.json { render :index, location: @clinic_locations }\n # end\n end",
"def show\n @corp_location = CorpLocation.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corp_location }\n end\n end",
"def index\n @injuries = Injury.all\n end",
"def show\n Project.hit 31\n @location = IphoneLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n format.xml { render xml: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n render json: @locationProut\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def show\n render :json => Location.find(params[:id])\n end",
"def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end",
"def index\n @locations = current_user.locations\n respond_with @locations\n end",
"def show\n sighting = Sighting.find(params[:id])\n #render json: sighting.to_json(:include => {:bird => {:only =>[:name, :species]}, :location => {:only =>[:latitude, :longitude]}}, :except => [:updated_at])\n end",
"def index\n @locations = Location.all\n\n respond_with(@locations)\n end",
"def location_primer\n render(json: location_list)\n end",
"def index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end",
"def get_json\n response = conn.get(@current_location)\n parsed = JSON.parse(response.body, symbolize_names: true)\n\n end",
"def event_get_location_details\n @loc = Apis::HereApi.new(\"\").get_location_details(params[:locationid])\n render json: @loc\n end",
"def locations\n farm = Farm.find(params[:id])\n\n @locations = []\n # Find which locations this user is authorized to access\n if (current_user.is_hog_owner? || current_user.is_farm_owner? || current_user.is_admin?)\n @locations = farm.locations\n elsif current_user.is_barn_manager?\n @locations << current_user.owner.barn.location\n elsif current_user.is_site_manager?\n @locations << current_user.owner.location\n end\n\n @page_title = \"Sites\"\n @header_icon_class = \"icon-road\"\n @page_subtitle = \"\"\n \n respond_to do |format|\n format.html { render '/locations/index' }\n format.json { render json: @locations }\n end\n end",
"def index\n @items_locations = ItemsLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items_locations }\n end\n end",
"def index\n @locations = Location.order(:country).order(:region).order(:city).page(params[:page])\n respond_with(@locations)\n end",
"def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end",
"def show\n @curpg = :admintools\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def locations id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/locations?date=#{date}\"\n fetch uri\n end",
"def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end",
"def index\r\n @locations = Location.all\r\n @mv = MapsVersion.first\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def index\n @event_locations = EventLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_locations }\n end\n end",
"def index\n code = :ok\n currentUser = {\n id: current_user.utilisateur.id,\n fullName: current_user.utilisateur.prenom_nom,\n }\n result = {\n signedIn: user_signed_in?,\n currentUser: currentUser,\n locations: Lieu.all\n }\n render json: result, status: code \n end",
"def show\n @jurisdiction = Jurisdiction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jurisdiction }\n end\n end",
"def show\n respond_to do |format|\n format.html { @api_v1_location }\n format.json { render json: {results: @api_v1_location, message: 'Locations have loaded successfully.'} }\n end\n end",
"def show\n @locations=@work.locations\n map\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end",
"def index\n @specific_locations = SpecificLocation.all\n end",
"def index\n @region = Region.find_by_id params[:region_id]\n @locations = @region.locations.select(\"id,name,region_id\")\n\n respond_with @locations #Location.select(\"id,name\")\n end",
"def index\n require 'geoip'\n @projects = Department.all_projects\n rip = request.remote_ip\n ip = rip == '127.0.0.1' ? '24.90.88.129' : rip\n geo = GeoIP.new('lib/GeoLiteCity.dat').city(ip) || GeoIP.new('lib/GeoLiteCity.dat').city('24.90.88.129')\n @my_place = geo.latitude.to_s + \", \" + geo.longitude.to_s\n redirect_to action: :list\n #respond_to do |format|\n #format.html # index.html.erb\n #format.json { render json: @projects }\n #end\n end",
"def index\n candidate = UspsInPersonProofing::Applicant.new(\n address: search_params['street_address'],\n city: search_params['city'], state: search_params['state'],\n zip_code: search_params['zip_code']\n )\n response = proofer.request_facilities(candidate)\n if response.length > 0\n analytics.idv_in_person_locations_searched(\n success: true,\n result_total: response.length,\n )\n else\n analytics.idv_in_person_locations_searched(\n success: false, errors: 'No USPS locations found',\n )\n end\n render json: response.to_json\n end",
"def getlocation\n \tlocafid = Windmill.where(no: params[:no])\nif locafid.present?\n \t\tlocafid = Windmill.find_by(no: params[:no])\n \t\trender json: [locafid.as_json(only: [:no, :latitude, :londitude,:location])]\nelse\n \t\trender json: {massage: 'windmill not found'}\n end\nend",
"def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end",
"def get_institutions\r\n # Prepare query url.\r\n _path_url = '/institutions'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| Institution.from_hash(element) }\r\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n objid = params[:id]\n obj = PickupLocation.find_by_id(objid)\n if obj\n render json: {pickup_location: obj}, status: 200\n else\n render json: {}, status: 404\n end\n rescue => error\n render json: {}, status: 500\n end",
"def index\n # @locations = Location.all\n\n #po dodaniu has_many @locations, :through => @firms\n @locations = current_user.locations if signed_in?\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end",
"def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @location }\n end\n end",
"def show_locations\n @all_encounters = PatientEncounter\n @all_locations = {}\n @all_encounters.each do |x|\n @all_locations[x.location.id] = x.location.name\n end\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def index\n @locations = Location.all\n end",
"def show\n @location_have_location = LocationHaveLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_have_location }\n end\n end",
"def index\n @processed_locations = ProcessedLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @processed_locations }\n end\n end",
"def index\n @one_reg_institutions = OneRegInstitution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @one_reg_institutions }\n end\n end",
"def show\r\n @location = Location.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @location }\r\n end\r\n end",
"def index\n @drop_locations = DropLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drop_locations }\n end\n end",
"def show\n @loc = Loc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loc }\n end\n end",
"def show\n @location = Location.find(params[:id])\n @jobs = @location.jobs\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def update\n respond_to do |format|\n if @injurylocation.update(injurylocation_params)\n format.html { redirect_to @injurylocation, notice: 'Injurylocation was successfully updated.' }\n format.json { render :show, status: :ok, location: @injurylocation }\n else\n format.html { render :edit }\n format.json { render json: @injurylocation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @itemname = Itemname.find(params[:id])\n @locations = Location.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemname }\n end\n end",
"def index\n @patient_locations = PatientLocation.all\n end",
"def index\n @location_details = LocationDetail.all\n end",
"def show\n @campus_food = CampusFood.find(params[:id])\n\t@loc = params[:loc]\n\t\n\t@locations = Location.all(:conditions =>[ \"loc like ? \", \"%#{params[:loc]}%\"])\n\tif !@locations.empty?\n @lat = @locations[0].lat\n @lng = @locations[0].lng\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @locations }\n end\n end",
"def set_investigationinjurylocation\n @investigationinjurylocation = Investigationinjurylocation.find(params[:id])\n end",
"def index\n @emergency_locations = EmergencyLocation.all\n end",
"def locations(place)\n get :loc => place\n end",
"def show\n @location_url_map = LocationUrlMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_url_map }\n end\n end",
"def index\n @locations = @organization.locations.all\n\n @map = Cartographer::Gmap.new( 'map' )\n @map.zoom = :bound\n @map.icons << Cartographer::Gicon.new\n \n @organization.locations.each do |location|\n @map.markers << \n Cartographer::Gmarker.new(\n :name => 'location_'+Digest::MD5.hexdigest(location.name),\n :marker_type => \"Building\",\n :position => [location.lat, location.lng],\n :info_window_url => \"fixme.org\"\n )\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def show\n @items_location = ItemsLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @items_location }\n end\n end",
"def show\n Project.hit 4\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location, callback: params[:callback] }\n format.xml { render xml: @location }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json{ \n @incidents = Incident.order(\"id desc\")\n\n # We want to show many more if map\n per_page = params[:map].present? ? 500 : 25\n\n @incidents = @incidents.search(params[:q]) if params[:q].present?\n @incidents = @incidents.where(incident_type: \n params[:incident_type]) if params[:incident_type].present?\n @incidents = @incidents.paginate(page: params[:page], per_page: per_page)\n\n render json: {records: @incidents.as_json(methods: [:full_address, :translated_type]), \n types: Incident::TYPES.map{ |x| {value: x, name: Incident.translate_type(x)} },\n total_pages: @incidents.total_pages, total_entries: @incidents.total_entries, \n offset: @incidents.offset, per_page: @incidents.per_page} \n }\n end\n end",
"def find_location\n\t\t@surgery_location = SurgeryLocation.where(id:params[:id])[0]\n\t\trender json: {success: false, message: 'Invalid Surgery Location ID !'}, status: 400 if @surgery_location.nil?\n\tend",
"def geo\n\t\tciudad = params[:id]\n\t\t@ubication = City.where(id: ciudad)\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @ubication }\n\t\tend\n\tend",
"def index\n @locations = salor_user.get_locations(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def show\n @outdoor = Outdoor.find(params[:id])\n @json = Outdoor.find(params[:id]).to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outdoor }\n end\n end",
"def index\n @crash_locations = CrashLocation.all\n gon.locations = retrieve_locations\n end"
] |
[
"0.7053685",
"0.68887514",
"0.68667996",
"0.65881336",
"0.65324515",
"0.6518005",
"0.6496938",
"0.64603835",
"0.6446168",
"0.63539594",
"0.6329275",
"0.6304276",
"0.63042605",
"0.62813634",
"0.6275883",
"0.6268665",
"0.626854",
"0.6254408",
"0.62329596",
"0.6219998",
"0.61730474",
"0.6172443",
"0.6160423",
"0.61546385",
"0.6150706",
"0.61243796",
"0.61195487",
"0.61072564",
"0.6098867",
"0.60950905",
"0.60741436",
"0.6064479",
"0.60471827",
"0.60154325",
"0.60141903",
"0.6009003",
"0.60076654",
"0.60044515",
"0.5990901",
"0.597599",
"0.5973971",
"0.5960417",
"0.59571457",
"0.59541875",
"0.5953424",
"0.5952157",
"0.593074",
"0.5925983",
"0.59071183",
"0.59067744",
"0.58922553",
"0.58883286",
"0.58883286",
"0.58883286",
"0.58883286",
"0.58883286",
"0.58883286",
"0.58883286",
"0.58883286",
"0.58883286",
"0.5885746",
"0.5881836",
"0.5872344",
"0.5864217",
"0.58485216",
"0.5844055",
"0.5844055",
"0.5844055",
"0.5844055",
"0.5844055",
"0.5844055",
"0.5844055",
"0.5844055",
"0.5844055",
"0.5844055",
"0.5844055",
"0.5842344",
"0.5841991",
"0.58392733",
"0.5825549",
"0.58199173",
"0.5816046",
"0.5815024",
"0.5814019",
"0.580447",
"0.5794145",
"0.57870835",
"0.5783453",
"0.5782788",
"0.57720405",
"0.57715493",
"0.57682127",
"0.5766288",
"0.57657003",
"0.5765421",
"0.5761152",
"0.5758889",
"0.57560015",
"0.5754928",
"0.5749571",
"0.57426643"
] |
0.0
|
-1
|
POST /injurylocations POST /injurylocations.json
|
def create
@injurylocation = Injurylocation.new(injurylocation_params)
respond_to do |format|
if @injurylocation.save
format.html { redirect_to injurylocations_path, notice: 'Injurylocation was successfully created.' }
format.json { render :show, status: :created, location: @injurylocation }
else
format.html { render :new }
format.json { render json: @injurylocation.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @investigationinjurylocation = Investigationinjurylocation.new(investigationinjurylocation_params)\n\n respond_to do |format|\n if @investigationinjurylocation.save\n format.html { redirect_to @investigationinjurylocation.investigation, notice: 'Investigationinjurylocation was successfully created.' }\n format.json { render :show, status: :created, location: @investigationinjurylocation }\n else\n format.html { render :new }\n format.json { render json: @investigationinjurylocation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def injurylocation_params\n params.require(:injurylocation).permit(:name, :description)\n end",
"def index\n @injurylocations = Injurylocation.all\n @injurylocation = Injurylocation.new\n end",
"def create\n @injury = Injury.new(injury_params)\n\n respond_to do |format|\n if @injury.save\n format.html { redirect_to injuries_url, notice: 'Injury was successfully created.' }\n # format.json { render :show, status: :created, location: @injury }\n else\n format.html { render :new }\n format.json { render json: @injury.errors, status: :unprocessable_entity }\n end\n end\n end",
"def investigationinjurylocation_params\n params.require(:investigationinjurylocation).permit(:investigation_id, :injurylocation_id)\n end",
"def set_injurylocation\n @injurylocation = Injurylocation.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @injurylocation.update(injurylocation_params)\n format.html { redirect_to @injurylocation, notice: 'Injurylocation was successfully updated.' }\n format.json { render :show, status: :ok, location: @injurylocation }\n else\n format.html { render :edit }\n format.json { render json: @injurylocation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @injurytype = Injurytype.new(injurytype_params)\n\n respond_to do |format|\n if @injurytype.save\n format.html { redirect_to injurytypes_path, notice: 'Injurytype was successfully created.' }\n format.json { render :show, status: :created, location: @injurytype }\n else\n format.html { render :new }\n format.json { render json: @injurytype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @investigationinjurylocations = Investigationinjurylocation.all\n end",
"def create\n @itinerary = Itinerary.new(itinerary_params)\n @start_loc = Location.create(address: params[:start_loc], is_origin: true, itinerary_id: @itinerary.id)\n @end_loc = Location.create(address: params[:end_loc], is_origin: false, itinerary_id: @itinerary.id)\n @itinerary.locations.push(@start_loc)\n @itinerary.locations.push(@end_loc)\n\n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to @itinerary, notice: 'Itinerary was successfully created.' }\n format.json { render :show, status: :created, location: @itinerary }\n\n # origin = @itinerary.locations.new( address: params[:origin], is_origin: true )\n # origin.get_coords\n\n # destination = @itinerary.locations.new( address: params[:destination], is_origin: false )\n # destination.get_coords\n\n else\n format.html { render :new }\n format.json { render json: @itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @curpg = :admintools\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to :controller => \"locations\", :action => \"index\" }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @location = Location.new(params[:location])\r\n\r\n respond_to do |format|\r\n if @location.save\r\n format.json { render json: @location, status: :created, location: @location }\r\n else\r\n format.json { render json: @location.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @gig = current_user.gigs.new(gig_params)\n location = Location.find_or_create_by({\n postcode_address: params[:location][:postcode_address],\n street_address: params[:location][:street_address]\n })\n @gig.location = location\n respond_to do |format|\n if @gig.save\n format.html { redirect_to @gig, notice: 'Gig was successfully created.' }\n format.json { render :show, status: :created, location: @gig }\n else\n format.html { render :new }\n format.json { render json: @gig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\t\tsurgery_locations = SurgeryLocation.all\n\t\tif surgery_locations.present?\n\t # response to the JSON\n\t render json: { success: true, response: surgery_locations.map{ |f| SurgeryLocationSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Surgery Location is not present.\" },:status=> 203\n\t end \n\tend",
"def postLocation( location_id, type, country, language, name, formal_name, resolution, population, description, timezone, latitude, longitude, parent_town, parent_county, parent_province, parent_region, parent_neighbourhood, parent_district, postalcode, searchable_id, searchable_ids)\n params = Hash.new\n params['location_id'] = location_id\n params['type'] = type\n params['country'] = country\n params['language'] = language\n params['name'] = name\n params['formal_name'] = formal_name\n params['resolution'] = resolution\n params['population'] = population\n params['description'] = description\n params['timezone'] = timezone\n params['latitude'] = latitude\n params['longitude'] = longitude\n params['parent_town'] = parent_town\n params['parent_county'] = parent_county\n params['parent_province'] = parent_province\n params['parent_region'] = parent_region\n params['parent_neighbourhood'] = parent_neighbourhood\n params['parent_district'] = parent_district\n params['postalcode'] = postalcode\n params['searchable_id'] = searchable_id\n params['searchable_ids'] = searchable_ids\n return doCurl(\"post\",\"/location\",params)\n end",
"def create\n @regions = Region.all\n @location = Location.new(location_params)\n\n if params[:regions]\n @location_regions = Region.find(params[:regions])\n else\n @location_regions = []\n end\n\n @location.regions = @location_regions\n\n respond_to do |format|\n if @location.save\n @location.create_stat\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_construct_location_empty_form\n login('mary')\n post(:create_location,\n :where => '',\n :approved_where => '',\n :location => {\n :display_name => ''\n }\n )\n end",
"def create\n @location = Location.new(location_params)\n @location.save\n respond_with(@location)\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.json { render :show, status: :created }\n else\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n if @location.save \n render :json => { status: :created, location: @location }\n else\n render :json => { errors: @location.errors, status: :unprocessable_entity }\n end\n end",
"def create\n @location = Location.new(location_params)\n#binding.pry\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zombie_sighting = ZombieSighting.new(lat: params[:lat],\n lng: params[:lng])\n\n respond_to do |format|\n if @zombie_sighting.save\n format.html { redirect_to action: \"index\", notice: 'Zombie sighting was successfully created.' }\n format.json { render json: @zombie_sighting, status: :created, location: @zombie_sighting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zombie_sighting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n\tlogger.info \"location saved successfully\"\n\tlogger.info @location.to_json\n format.html { redirect_to @location, :notice => 'Location was successfully created.' }\n format.json { render :json => @location }\n else\n\tlogger.info \"error saving location\"\n format.html { render :action => \"new\" }\n format.json { render :json => @location.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_investigationinjurylocation\n @investigationinjurylocation = Investigationinjurylocation.find(params[:id])\n end",
"def create\n @interest = Interest.new(params[:interest])\n \n respond_to do |format|\n if @interest.save\n format.json { render :json => @interest,\n :status => :created, :location => @interest }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def create\n current_user.update(location_params)\n\n if current_user.save\n render action: 'show', status: :ok, location: current_user\n else\n render json: current_user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @record = Location.new(params[:location]) \n @record.entity_id = current_user.entity._id\n\n @record.save!\n respond_to do |format|\n format.html { head :no_content }\n format.json { render json: {} }\n end\n end",
"def create\n @location = @organization.locations.build(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to [@organization, @location], notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_locations(locations)\n File.open('location_data.json', 'w') do |file|\n file.puts locations\n end\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created }\n else\n format.html { redirect_to root_path, notice: 'Please fill in all fields!' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @locations = Location.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @location = Location.create(params[:location])\n end",
"def create\n @location = Location.new(params[:location].merge!(:user => current_user))\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'La habitación se ha guardado exitosamente.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n\t\t@project = Project.find(@location.project_id)\n respond_to do |format|\n if @location.save\n format.html { redirect_to @project, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n @location.user_id = current_user.id\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to locations_path, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n if @location.save\n flash[:notice] = 'Location was successfully created.'\n end\n respond_with(@location, location: locations_url) \n end",
"def update\n respond_to do |format|\n if @investigationinjurylocation.update(investigationinjurylocation_params)\n format.html { redirect_to @investigationinjurylocation.investigation, notice: 'Investigationinjurylocation was successfully updated.' }\n format.json { render :show, status: :ok, location: @investigationinjurylocation }\n else\n format.html { render :edit }\n format.json { render json: @investigationinjurylocation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @located_at = LocatedAt.new(located_at_params)\n\n respond_to do |format|\n if @located_at.save\n format.html { redirect_to @located_at, notice: 'Located at was successfully created.' }\n format.json { render :show, status: :created, location: @located_at }\n else\n format.html { render :new }\n format.json { render json: @located_at.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new\n @location.address = gym_params[:location]\n location = Location.limit(1).find_by_address(gym_params[:location])\n @location.save! if location.eql? nil\n location = Location.limit(1).find_by_address(gym_params[:location])\n @gym = Gym.new(gym_params.reject!{ |k| k == \"location\"})\n# raise @user.inspect\n @gym.location_id = location.id\n # @gym = Gym.new(gym_params)\n\n respond_to do |format|\n if @gym.save\n format.html { redirect_to @gym, notice: 'Gym was successfully created.' }\n format.json { render :show, status: :created, location: @gym }\n `echo \"Nome:#{@gym.name}\\n Gerente: #{@gym.manager.name}\\n Address:#{@gym.location.address}\" | mutt -s \"Gym was successfully created.\" #{@gym.manager.email}`\n else\n format.html { render :new }\n format.json { render json: @gym.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n end",
"def destroy\n @injurylocation.destroy\n respond_to do |format|\n format.html { redirect_to injurylocations_url, notice: 'Injurylocation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def new\n @location = Location.new\n @location.build_series\n @city = @location.build_city\n \n set_site_entities @location\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end",
"def create\n @tutor_location = TutorLocation.new(params[:tutor_location])\n\n respond_to do |format|\n if @tutor_location.save\n format.html { redirect_to @tutor_location, notice: 'Tutor location was successfully created.' }\n format.json { render json: @tutor_location, status: :created, location: @tutor_location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutor_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def coordinates\n location = Location.new(location_params)\n if location.save\n render json: location\n else\n render json: \"ERROR\"\n end\n end",
"def create\n @specific_location = SpecificLocation.new(specific_location_params)\n\n respond_to do |format|\n if @specific_location.save\n format.html { redirect_to @specific_location, notice: 'Specific location was successfully created.' }\n format.json { render :show, status: :created, location: @specific_location }\n else\n format.html { render :new }\n format.json { render json: @specific_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @emergency_location = EmergencyLocation.new(emergency_location_params)\n\n respond_to do |format|\n if @emergency_location.save\n format.html { redirect_to @emergency_location, notice: 'Emergency location was successfully created.' }\n format.json { render :show, status: :created, location: @emergency_location }\n else\n format.html { render :new }\n format.json { render json: @emergency_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n\t\n\t\n\t\n respond_to do |format|\n if @location.save\n format.html { redirect_to admin_locations_url(:site => current_site.id), notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: admin_locations_url(:site => current_site.id) }\n else\n \n \tset_site_entities @location\n \t\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n \n @location.location = current_location\n @location.location_type = \"shelf\"\n \n respond_to do |format|\n if @location.save\n format.html { redirect_to current_location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(\n name: location_params[:name],\n address_line_1: location_params[:lineOne],\n address_line_2: location_params[:lineTwo],\n lat: location_params[:lat],\n lng: location_params[:lng]\n )\n if @location.save\n render json: @location\n else\n render json: {message: 'creation failed'}\n end\n end",
"def create\n @loc = current_user.locs.new(params[:loc])\n\n respond_to do |format|\n if @loc.save\n format.html { redirect_to @loc, notice: 'Loc was successfully created.' }\n format.json { render json: @loc, status: :created, location: @loc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @loc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def injury_params\n params.require(:injury).permit(:user_id, :location, :structure, :when, :comment, :therapeute, :dateperf, :datematch, :datetrain)\n end",
"def location_params\n params.require(:location).permit(:name, :regions)\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, flash: {success: \"Successfully created #{@location.name} location!\" }}\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def location_params\n params.require(:location).permit(:name, :website, :phone, :email,\n :address_1, :address_2, :city, :zip, :state, :handicap_status,\n :hunting_area_size, :terrain, :submitter_notes, :featured_image,\n species_ids: [], weapon_type_ids: [], category_ids: [])\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to locations_path, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service_location = ServiceLocation.new(service_location_params)\n if @service_location.save\n render json: @service_location, status: :created, location: @service_location\n else\n render json: @service_location.errors, status: :unprocessable_entity\n end \n end",
"def create\r\n @discounts_on_location = DiscountsOnLocation.new(params[:discounts_on_location])\r\n\r\n respond_to do |format|\r\n if @discounts_on_location.save\r\n format.html { redirect_to @discounts_on_location, notice: 'Discounts on location was successfully created.' }\r\n format.json { render json: @discounts_on_location, status: :created, location: @discounts_on_location }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @discounts_on_location.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @location = Location.new(params[:location])\n\n respond_to do |format|\n if @location.save\n @locations = Location.index_locations\n format.html { redirect_to(@location, :notice => 'Location was successfully created.') }\n format.xml { render :xml => @location, :status => :created, :location => @location }\n format.js\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.'}\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @instructor = Instructor.new(instructor_params)\n\n instructor_geolocation = InstructorGeolocation.new\n instructor_geolocation.address = params[:geolocation]\n\n instructor_geolocation.longitude = params[:lng]\n instructor_geolocation.latitude = params[:lat]\n instructor_geolocation.street = params[:route]\n instructor_geolocation.street_number = params[:street_number]\n instructor_geolocation.zip = params[:postal_code]\n instructor_geolocation.city = params[:locality]\n instructor_geolocation.country = params[:country]\n instructor_geolocation.state = params[:administrative_area_level_1]\n\n @instructor.user_id = current_user.id\n\n respond_to do |format|\n if @instructor.save\n instructor_geolocation.instructor_id = @instructor.id\n if instructor_geolocation.save\n format.html { redirect_to @instructor, notice: 'Instructor was successfully created.' }\n format.json { render :show, status: :created, location: @instructor }\n else\n format.html { render :new }\n format.json { render json: @instructor_geolocation.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new }\n format.json { render json: @instructor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new location_params\n @location.target = current_user\n respond_to do |format| \n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @processed_location = ProcessedLocation.new(params[:processed_location])\n\n respond_to do |format|\n if @processed_location.save\n format.html { redirect_to @processed_location, notice: 'Processed location was successfully created.' }\n format.json { render json: @processed_location, status: :created, location: @processed_location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @processed_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient_location = PatientLocation.new(patient_location_params)\n\n respond_to do |format|\n if @patient_location.save\n format.html { redirect_to @patient_location, notice: 'Patient location was successfully created.' }\n format.json { render :show, status: :created, location: @patient_location }\n else\n format.html { render :new }\n format.json { render json: @patient_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user=User.find_by_id(params[:user_id])\n @location = Location.new(params[:location])\n @location.user_id = @user.uid\n @location.name = @user.name\n \n respond_to do |format|\n \n if @location.save\n format.html { redirect_to user_locations_path(@user), notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render action: 'show', status: :created, location: @location }\n else\n format.html { render action: 'new' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n tag = @user.tags.new(:location => params[:location])\n\n if tag.save\n render :status => 200,\n :json => tag_as_hash(tag).merge(status: 200)\n else\n render :status => 400,\n :json => {\n status: 400,\n message: \"Bad request\",\n errors: tag.errors,\n }\n end\n end",
"def create\n @location = Geolocation.new(params[:geolocation])\n @scene = Scene.new(:title => params[:title])\n @location.scenes << @scene\n @location.save\n @scene.save\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully create.'}\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\"}\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dropoff_location = DropoffLocation.new(dropoff_location_params)\n\n respond_to do |format|\n if @dropoff_location.save\n format.html { redirect_to @dropoff_location, notice: 'Dropoff location was successfully created.' }\n format.json { render :show, status: :created, location: @dropoff_location }\n else\n format.html { render :new }\n format.json { render json: @dropoff_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident = Incident.new(incident_params)\n\n if @incident.save\n render json: @incident, status: :created, location: @incident\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end",
"def create\n @event_location = EventLocation.new(event_location_params)\n\n respond_to do |format|\n if @event_location.save\n format.html { redirect_to @event_location, notice: 'Event location was successfully created.' }\n format.json { render json: @event_location, status: :created, location: @event_location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @location = @organization.locations.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end",
"def location_primer\n render(json: location_list)\n end",
"def location_params\n params.require(:location).permit(:postal_code, :date, :postal_code)\n end",
"def create\n @sign = Sign.new(params[:sign])\n @location = Location.find(@sign.location_id)\n\n respond_to do |format|\n if @sign.save\n format.html { redirect_to location_index_path(@location.name.downcase), notice: 'Sign was successfully created.' }\n format.json { render json: @sign, status: :created, location: @sign }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_location = auth_user.primary_user_location || auth_user.user_locations.last || ::Users::UserLocation.new\n loc_params = params[resource_param_name]\n if loc_params.present?\n @user_location.attributes = loc_params.select{|k,v| ![:id].include?(k) }\n @user_location.user_id = auth_user.id\n end\n\n if (user_locations = params[:user_locations] || params['user_locations']).present?\n new_user_locations = user_locations.collect do|p|\n loc = ::Users::UserLocation.new(p)\n loc.user_id = auth_user.id\n loc\n end\n if new_user_locations.present?\n ::Users::UserLocation.where(user_id: auth_user.id).delete_all\n auth_user.user_locations = new_user_locations\n auth_user.save\n @user_location = new_user_locations.first\n end\n end\n logger.info \"| valid location? #{@user_location.valid?} : #{@user_location.errors.full_messages}\"\n respond_to do |format|\n if @user_location.save\n\n save_phone_number\n\n format.html { redirect_to next_after_save, notice: 'Address was successfully created.' }\n format.json { render json: {success: true, user_location: @user_location.as_json }, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: {success: false, errors: @user_location.errors.messages}, status: :unprocessable_entity }\n end\n end\n end",
"def location_params\n params.require(:location).permit(:latitude, :longitude, :address, :description, :title, :user_ids => [])\n end",
"def create\n @location_have_location = LocationHaveLocation.new(params[:location_have_location])\n\n respond_to do |format|\n if @location_have_location.save\n format.html { redirect_to @location_have_location, notice: 'Location have location was successfully created.' }\n format.json { render json: @location_have_location, status: :created, location: @location_have_location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location_have_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if signed_in?\n @user = current_user\n end\n @location = Location.friendly.find_or_create_by(location_params)\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location}\n format.json { render action: 'show', status: :created, location: @location }\n UserMailer.location_email(@location, @user).deliver_now\n else\n format.html { render action: 'new' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location_perk = LocationPerk.new(location_perk_params)\n\n respond_to do |format|\n if @location_perk.save\n format.html { redirect_to @location_perk, notice: 'Location perk was successfully created.' }\n format.json { render :show, status: :created, location: @location_perk }\n else\n format.html { render :new }\n format.json { render json: @location_perk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n @location.user_id=current_user.id\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render action: 'show', status: :created, location: @location }\n else\n format.html { render action: 'new' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @geocoded_location = GeocodedLocation.new(geocoded_location_params)\n\n respond_to do |format|\n if @geocoded_location.save\n format.html { redirect_to :root, notice: 'Geocoded location was successfully created.' }\n format.json { render :show, status: :created, location: @geocoded_location }\n else\n format.html { render :new }\n format.json { render json: @geocoded_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @intervenant = Intervenant.new(intervenant_params)\n\n respond_to do |format|\n if @intervenant.save\n format.html { redirect_to @intervenant, notice: 'Intervenant was successfully created.' }\n format.json { render :show, status: :created, location: @intervenant }\n else\n format.html { render :new }\n format.json { render json: @intervenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(location_params)\n @location.user_id=current_user.id\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Ubicacion creada correctamente!' }\n format.json { render action: 'show', status: :created, location: @location }\n else\n format.html { render action: 'new' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n location = GeoIP.new('lib/GeoLiteCity.dat').city(current_user.current_sign_in_ip)\n # location = GeoIP.new('lib/GeoLiteCity.dat').city('110.136.133.185')\n idea_params[:lat].blank? ? idea_params[:lat] << location.latitude.to_s : idea_params[:lat]\n idea_params[:long].blank? ? idea_params[:long] << location.longitude.to_s : idea_params[:long]\n idea_params[:region_name].blank? ? idea_params[:region_name] << location.region_name : idea_params[:region_name]\n idea_params[:country].blank? ? idea_params[:country] << location.country_name : idea_params[:country]\n idea_params[:city].blank? ? idea_params[:city] << location.city_name : idea_params[:city]\n @idea = Idea.new(idea_params)\n\n respond_to do |format|\n if @idea.save\n format.html { redirect_to @idea, notice: 'Idea was successfully created.' }\n format.json { render action: 'show', status: :created, location: @idea }\n else\n format.html { render action: 'new' }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.new(params[:location])\n @location.user = current_user\n respond_to do |format|\n if @location.save\n format.html { redirect_to(@location, :notice => 'Location was successfully created.') }\n format.xml { render :xml => @location, :status => :created, :location => @location }\n format.json { render :text => @location.to_json }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n format.json { render :text => @location.to_json }\n end\n end\n end",
"def create\n @pigeon = current_user.pigeons.new(pigeon_params)\n\n respond_to do |format|\n if @pigeon.save\n format.html { redirect_to @pigeon, notice: 'Pigeon was successfully created.' }\n format.json { render :show, status: :created, location: @pigeon }\n else\n format.html { render :new }\n format.json { render json: @pigeon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def data_entry_params\n\t\t\tparams.require(:location).permit(:name, :description, :address1, :address2, :city_village, :state_province, :postal_code, :country, :latitude, :longitude, :creator, :date_created, :country_district, :neighborhood_cell, :region, :subregion, :township_division, :retired, :retired_by, :date_retired, :retire_reason, :parent_location, :uuid)\n \n end",
"def create\n @corp_location = CorpLocation.new(corp_location_params)\n\n respond_to do |format|\n if @corp_location.save\n format.html { redirect_to @corp_location, notice: 'Corp location was successfully created.' }\n format.json { render json: @corp_location, status: :created, location: @corp_location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @corp_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @popular_location = PopularLocation.new(popular_location_params)\n\n respond_to do |format|\n if @popular_location.save\n format.html { redirect_to @popular_location, notice: 'Popular location was successfully created.' }\n format.json { render :show, status: :created, location: @popular_location }\n else\n format.html { render :new }\n format.json { render json: @popular_location.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.70700353",
"0.6621055",
"0.6541455",
"0.64135724",
"0.63652897",
"0.6237003",
"0.60907704",
"0.6078286",
"0.60781884",
"0.60401905",
"0.60296065",
"0.60133",
"0.5990164",
"0.5979837",
"0.5975455",
"0.59443134",
"0.5914143",
"0.5912503",
"0.59022427",
"0.589973",
"0.5888254",
"0.5886001",
"0.58418673",
"0.57846075",
"0.57493514",
"0.5748531",
"0.57407296",
"0.5717389",
"0.57159585",
"0.57143223",
"0.5714018",
"0.5709916",
"0.5688662",
"0.5682392",
"0.5677037",
"0.5664897",
"0.5662022",
"0.5662022",
"0.5662022",
"0.5662022",
"0.5644915",
"0.5639079",
"0.56301826",
"0.5612169",
"0.56109047",
"0.5608556",
"0.56067413",
"0.5598657",
"0.5590438",
"0.5570412",
"0.55617726",
"0.55607635",
"0.5551931",
"0.5549563",
"0.5545131",
"0.5534276",
"0.5532439",
"0.55305856",
"0.5521286",
"0.5520479",
"0.551905",
"0.5511468",
"0.5511468",
"0.5511468",
"0.5511468",
"0.5511468",
"0.5511468",
"0.5511468",
"0.5506845",
"0.549856",
"0.54968613",
"0.54949474",
"0.54942006",
"0.54938906",
"0.5483701",
"0.5483399",
"0.54777336",
"0.5477331",
"0.5474461",
"0.5461555",
"0.5460121",
"0.5458947",
"0.54575306",
"0.5450961",
"0.54470825",
"0.5439802",
"0.5436724",
"0.543573",
"0.54326874",
"0.54234153",
"0.54230565",
"0.5418457",
"0.54162997",
"0.5414158",
"0.5412999",
"0.54053307",
"0.54017335",
"0.53894436",
"0.5383895",
"0.5383593"
] |
0.7735785
|
0
|
PATCH/PUT /injurylocations/1 PATCH/PUT /injurylocations/1.json
|
def update
respond_to do |format|
if @injurylocation.update(injurylocation_params)
format.html { redirect_to @injurylocation, notice: 'Injurylocation was successfully updated.' }
format.json { render :show, status: :ok, location: @injurylocation }
else
format.html { render :edit }
format.json { render json: @injurylocation.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end",
"def update\r\n @location = Location.find(params[:id])\r\n \r\n respond_to do |format|\r\n if @location.update_attributes(params[:location])\r\n format.json { head :no_content }\r\n else\r\n format.json { render json: @location.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @investigationinjurylocation.update(investigationinjurylocation_params)\n format.html { redirect_to @investigationinjurylocation.investigation, notice: 'Investigationinjurylocation was successfully updated.' }\n format.json { render :show, status: :ok, location: @investigationinjurylocation }\n else\n format.html { render :edit }\n format.json { render json: @investigationinjurylocation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @injury.update(injury_params)\n format.html { redirect_to injuries_url, notice: 'Injury was successfully updated.' }\n # format.json { render :show, status: :ok, location: @injury }\n else\n format.html { render :edit }\n format.json { render json: @injury.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @curpg = :admintools\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to :controller => \"locations\", :action => \"index\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n logger.info params[:location].to_json\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, :notice => 'Location was successfully updated.' }\n format.json { render :json => @location, :status => :updated, :location => @location }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @location.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @record = Location.find(params[:id])\n @record.update_attributes(params[:location]) \n respond_to do |format|\n# format.html\n format.json {\n render json: {}\n }\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n \n @previousMap = Location.WhereAmI(@location.region_id)\n\n #binding.pry\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @previousMap, notice: 'Location was successfully updated.' }\n format.json { respond_with_bip(@location) }\n else\n format.html { render action: \"edit\" }\n format.json { respond_with_bip(@location) }\n end\n end\n end",
"def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end",
"def update\n\t\t# updating the surgery location attribute\n\t\tif @surgery_location.update(surgery_location_params)\n\t\t# response to the JSON\n\t\t\trender json: { success: true,message: \"Surgery Location Successfully Updated.\", response: SurgeryLocationSerializer.new(@surgery_location).as_json(root: false) },:status=>200\n\t else\n\t render :json=> { success: false, message: \"Surgery Location is not available\" },:status=> 404\n\t end\n\tend",
"def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n\t\t@project = Project.find(@location.project_id)\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @project, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @injury.update(injury_params)\n format.html { redirect_to @injury, notice: 'Injury was successfully updated.' }\n format.json { render :show, status: :ok, location: @injury }\n else\n format.html { render :edit }\n format.json { render json: @injury.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.friendly.find(params[:id])\n respond_to do |format|\n if @location.update_attributes!(location_params)\n format.html { redirect_to @location, notice: 'location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n \n #abort\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to :back, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n set_site_entities @location\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.json { head :no_content }\n else\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patent = Patent.find(params[:id])\n\n respond_to do |format|\n if params[:patent][:research_areas]\n research_area = ResearchArea.find(params[:patent][:research_areas].to_i)\n @patent.research_areas << research_area\n @patent.save\n format.json { render json: research_area }\n elsif @patent.update_attributes(params[:patent])\n format.html { redirect_to @patent, notice: 'Patent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location.update(location_params)\n if @location.dt_devolucao.nil?\n else\n @vehicle = Vehicle.find_by(id: @location.vehicle_id)\n @client = Client.find_by(id: @location.client_id)\n \n @vehicle.update_attribute(:status, 'DISPONÍVEL')\n @client.update_attribute(:status, 'DISPONÍVEL')\n end\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_location.update(api_v1_location_params)\n format.html { redirect_to @api_v1_location, notice: 'Location was successfully updated.' }\n format.json { render json: { location: @api_v1_location, message: 'Location was successfully updated.' } }\n else\n format.html { render :edit }\n format.json { render json: { results: @api_v1_location.errors, message: 'Location was NOT successfully update.' } }\n end\n end\n end",
"def update\n @location = Location.new\n @location.address = gym_params[:location]\n location = Location.limit(1).find_by_address(gym_params[:location])\n @location.save! if location.eql? nil\n location = Location.limit(1).find_by_address(gym_params[:location])\n\n respond_to do |format|\n if @gym.update(gym_params.reject!{ |k| k == \"location\"})\n @gym.location_id = location.id\n @gym.save!\n format.html { redirect_to @gym, notice: 'Gym was successfully updated.' }\n format.json { render :show, status: :ok, location: @gym }\n `echo \"Nome:#{@gym.name}\\n Gerente: #{@gym.manager.name}\\n Address:#{@gym.location.address}\" | mutt -s \"Gym was successfully updated.\" #{@gym.manager.email}`\n else\n format.html { render :edit }\n format.json { render json: @gym.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to [@organization, @location], notice: 'Location was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pigeon.update(pigeon_params)\n format.html { redirect_to @pigeon, notice: 'Pigeon was successfully updated.' }\n format.json { render :show, status: :ok, location: @pigeon }\n else\n format.html { render :edit }\n format.json { render json: @pigeon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @specific_location.update(specific_location_params)\n format.html { redirect_to @specific_location, notice: 'Specific location was successfully updated.' }\n format.json { render :show, status: :ok, location: @specific_location }\n else\n format.html { render :edit }\n format.json { render json: @specific_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to user_locations_path, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n enrollment.update!(\n selected_location_details: update_params.as_json,\n issuer: current_sp&.issuer,\n )\n add_proofing_component\n\n render json: { success: true }, status: :ok\n end",
"def update\n @location_have_location = LocationHaveLocation.find(params[:id])\n\n respond_to do |format|\n if @location_have_location.update_attributes(params[:location_have_location])\n format.html { redirect_to @location_have_location, notice: 'Location have location was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location_have_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @itinerary.update(itinerary_params)\n format.html { redirect_to @itinerary, notice: 'Itinerary was successfully updated.' }\n format.json { render :show, status: :ok, location: @itinerary }\n\n if params[:origin]\n @itinerary.locations[0].address = params[:origin]\n @itinerary.locations[0].get_coords\n end\n if params[:destination]\n @itinerary.locations[0].address = params[:destination]\n @itinerary.locations[0].get_coords\n end\n\n else\n format.html { render :edit }\n format.json { render json: @itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @item.update(item_params)\n render status: 201, :json => @item, :include =>[{:location =>{:except=>[:id, :created_at, :updated_at]}}, {:food =>{:except =>[:id, :created_at, :updated_at]}}], :except => [:created_at, :updated_at, :food_id, :location_id]\n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n\n \n end",
"def update\n @locations = []\n @errors = []\n @hide_map = true\n if params.has_key? :id\n location = Location.find(params[:id])\n @locations = [ location ]\n location_params = params.clone\n [:created_at, :id, :updated_at, :category, :subcategories, :markerVisible, :action, :controller, :location].each do |param|\n location_params.delete param\n end\n location.update_attributes location_params\n @errors = location.errors\n elsif params.has_key? :locations\n params[:locations][:location].each do |data|\n l = Location.find data[0]\n if not l.update_attributes data[1]\n pp l.errors\n @errors.push l.errors\n end\n @locations.push l\n end\n end\n\n respond_to do |format|\n if @errors.empty?\n format.html { redirect_to :locations, :notice => 'Locations successfully updated.'}\n format.json { head :no_content }\n else\n format.html { render :action =>\"edit\" }\n format.json { render :json => @errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @injurytype.update(injurytype_params)\n format.html { redirect_to injurytypes_path, notice: 'Injurytype was successfully updated.' }\n format.json { render :show, status: :ok, location: @injurytype }\n else\n format.html { render :edit }\n format.json { render json: @injurytype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n if @outside_request.update_attributes(params[:outside_request])\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \\\"edit\\\" }\n format.json { render json: @outside_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @intervenant.update(intervenant_params)\n format.html { redirect_to @intervenant, notice: 'Intervenant was successfully updated.' }\n format.json { render :show, status: :ok, location: @intervenant }\n else\n format.html { render :edit }\n format.json { render json: @intervenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @microlocation.update_attributes(microlocation_params)\n format.html { redirect_to [@venue, @address, @microlocation], notice: 'Microlocation was successfully updated.' }\n format.json { render :show, status: :ok, location: @microlocation }\n else\n format.html { render :edit }\n format.json { render json: @microlocation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @regions = Region.all\n if params[:regions]\n @location_regions = Region.find(params[:regions])\n else\n @location_regions = []\n end\n @location.regions = @location_regions\n\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @apartment_geopoint.update(apartment_geopoint_params)\n format.html { redirect_to @apartment_geopoint, notice: 'Apartment geopoint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apartment_geopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sign = Sign.find(params[:id])\n @location = Location.find(@sign.location_id)\n\n respond_to do |format|\n if @sign.update_attributes(params[:sign])\n format.html { redirect_to location_index_path(@location.name.downcase), notice: 'Sign was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @corp_location = CorpLocation.get(params[:id])\n\n respond_to do |format|\n if @corp_location.update(corp_location_params)\n format.html { redirect_to @corp_location, notice: 'Corp location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @corp_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@items_location = ItemsLocation.find(params[:id])\n\n respond_to do |format|\n #if @items_location.update_attributes(params[:items_location])\n # format.html { redirect_to @items_location, notice: 'Items location was successfully updated.' }\n # format.json { head :no_content }\n #else\n # format.html { render action: \"edit\" }\n # format.json { render json: @items_location.errors, status: :unprocessable_entity }\n #end\n end\n end",
"def update\n respond_to do |format|\n if @emergency_location.update(emergency_location_params)\n format.html { redirect_to @emergency_location, notice: 'Emergency location was successfully updated.' }\n format.json { render :show, status: :ok, location: @emergency_location }\n else\n format.html { render :edit }\n format.json { render json: @emergency_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dog_poly.update(dog_poly_params)\n format.html { redirect_to @dog_poly, notice: 'Dog poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @dog_poly }\n else\n format.html { render :edit }\n format.json { render json: @dog_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clinic_location.update(clinic_location_params)\n format.html { redirect_to @clinic_location, notice: 'Clinic location was successfully updated.' }\n format.json { render :show, status: :ok, location: @clinic_location }\n else\n format.html { render :edit }\n format.json { render json: @clinic_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_location\n\n respond_to do |format|\n if @location.update_attributes(location_params)\n format.html { redirect_to @location, flash: {success: \"Successfully updated #{@location.name} location!\" }}\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n @locations = Location.index_locations\n format.html { redirect_to(@location, :notice => 'Location was successfully updated.') }\n format.xml { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n \n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patient_location.update(patient_location_params)\n format.html { redirect_to @patient_location, notice: 'Patient location was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient_location }\n else\n format.html { render :edit }\n format.json { render json: @patient_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_field.update(api_v1_initiative_field_params)\n format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_field }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_field.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @location.update_attribute(params[:geolocation])\n format.html { redirect_to @location, notice: 'Location was successfully updated.'}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @located_at.update(located_at_params)\n format.html { redirect_to @located_at, notice: 'Located at was successfully updated.' }\n format.json { render :show, status: :ok, location: @located_at }\n else\n format.html { render :edit }\n format.json { render json: @located_at.errors, status: :unprocessable_entity }\n end\n end\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n @geopoint = Geopoint.find(params[:id])\n\n respond_to do |format|\n if @geopoint.update_attributes(params[:geopoint])\n format.html { redirect_to @geopoint, notice: 'Geopoint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @geopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @floor = Floor.find(params[:id])\n params[:floor][:location_id] = params[:floor][:loc_id]\n params[:floor].delete :loc_id\n respond_to do |format|\n if @floor.update_attributes(params[:floor])\n format.html { redirect_to floors_path, notice: 'Floor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location.update(location_params)\n puts \"\\nUPDATE: #{@location.inspect}\"\n format.html { redirect_to @location, notice: \"Location was successfully updated.\" }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts \"Location::update (params): \" + location_params.inspect\n \n if @location.update(location_params)\n render :json => {status: :ok, location: @location }\n else\n render :json => {errors: @location.errors, status: :unprocessable_entity }\n end\n end",
"def update\n @locations = Location.where(\"status <> 'NORMAL'\").order(\"state, township desc\")\n respond_to do |format|\n if @aid_offer.update(aid_offer_params)\n format.html { redirect_to @aid_offer, notice: 'Aid offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @aid_offer }\n else\n format.html { render :edit }\n format.json { render json: @aid_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meeting_location = MeetingLocation.find(params[:id])\n\n respond_to do |format|\n if @meeting_location.update_attributes(params[:meeting_location])\n format.html { redirect_to @meeting_location, notice: 'Meeting location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meeting_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @work.extra = process_extra if params[:work][:extra_keys] && params[:work][:extra_keys]!= \"\"\n respond_to do |format|\n if @work.update_attributes(params[:work].except(:extra_keys, :extra_values))\n Work.create_locations(@work) if @work.places#.changed?\n Location.destroy_unused\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @business_geopoint.update(business_geopoint_params)\n format.html { redirect_to @business_geopoint, notice: 'Business geopoint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @business_geopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_meeting_location = UserMeetingLocation.find(params[:id])\n\n respond_to do |format|\n if @user_meeting_location.update_attributes(params[:user_meeting_location])\n format.html { redirect_to user_meeting_locations_path, notice: 'User meeting location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_meeting_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location = Location.find(params[:id])\n\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to locations_path, notice: 'Adres pomyślnie zaktualizowany.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @loc = current_user.locs.find(params[:id])\n\n respond_to do |format|\n if @loc.update_attributes(params[:loc])\n format.html { redirect_to @loc, notice: 'Loc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @loc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_location = EventLocation.find(params[:id])\n\n respond_to do |format|\n if @event_location.update_attributes(event_location_params)\n format.html { redirect_to @event_location, notice: 'Event location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @processed_location = ProcessedLocation.find(params[:id])\n\n respond_to do |format|\n if @processed_location.update_attributes(params[:processed_location])\n format.html { redirect_to @processed_location, notice: 'Processed location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @processed_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def update\n \n @job_location.update(job_location_params)\n \n end",
"def update\n respond_to do |format|\n if @observation_field.update(params[:observation_field])\n format.html { redirect_to(@observation_field, :notice => 'ObservationField was successfully updated.') }\n format.json { render :json => @observation_field }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => {:errors => @observation_field.errors.full_messages}, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location_detail.update(location_detail_params)\n format.html { redirect_to @location_detail, notice: 'Location detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @location_detail }\n else\n format.html { render :edit }\n format.json { render json: @location_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n location = Location.find_or_create_by({\n postcode_address: params[:location][:postcode_address],\n street_address: params[:location][:street_address]\n })\n @gig.location = location\n respond_to do |format|\n if @gig.update(gig_params)\n format.html { redirect_to @gig, notice: 'Gig was successfully updated.' }\n format.json { render :show, status: :ok, location: @gig }\n else\n format.html { render :edit }\n format.json { render json: @gig.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def update\n respond_to do |format|\n if @latstraps1.update(latstraps1_params)\n format.html { redirect_to \"/latstraps1s\"}\n format.json { render :show, status: :ok, location: @latstraps1 }\n else\n format.html { render :edit }\n format.json { render json: @latstraps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @curriculum = Curriculum.find(params[:id])\n @curriculum.update_attributes(params[:curriculum])\n\n respond_with @curriculum, :location => [:admin, @course, @curriculum]\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n if @early_pregnancy.update_attributes(params[:early_pregnancy])\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n respond_to do |format|\n if @location_perk.update(location_perk_params)\n format.html { redirect_to @location_perk, notice: 'Location perk was successfully updated.' }\n format.json { render :show, status: :ok, location: @location_perk }\n else\n format.html { render :edit }\n format.json { render json: @location_perk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @politically_exposed_person.update(politically_exposed_person_params)\n format.html { redirect_to politically_exposed_people_url,\n notice: 'Politically exposed person was successfully updated.' }\n format.json { render :show, status: :ok, location: @politically_exposed_person }\n else\n format.html { render :edit }\n format.json { render json: @politically_exposed_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_mentorship_interest.update(api_v1_mentorship_interest_params)\n format.html { redirect_to @api_v1_mentorship_interest, notice: 'Mentorship interest was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_mentorship_interest }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_mentorship_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @physician.update(survey_params)\n head :no_content\n else\n render json: @physician.errors, status: :unprocessable_entity\n end\n end",
"def update\n\t\t# updating the surgery location attribute\n\t\t@surgery_location.update(surgery_location_params)\n\t\t# redirect to the surgerylocations index page\n\t\tredirect_to surgery_locations_path\n\tend",
"def update\n @missing_person = MissingPerson.find(params[:id])\n\n respond_to do |format|\n if @missing_person.update_attributes(params[:missing_person])\n format.html { redirect_to @missing_person, notice: 'Missing person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @missing_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if @callout.update(callout_params)\n format.html { redirect_to @callout, notice: 'Callout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @callout.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6928675",
"0.6590127",
"0.6535516",
"0.63895977",
"0.636359",
"0.6359285",
"0.6354006",
"0.6349617",
"0.6347368",
"0.63206893",
"0.6289312",
"0.62445134",
"0.62128",
"0.62029785",
"0.6196315",
"0.6193008",
"0.6151019",
"0.615026",
"0.6142713",
"0.61333203",
"0.6132148",
"0.6131972",
"0.6127165",
"0.61260307",
"0.61195344",
"0.6119316",
"0.61155343",
"0.6106387",
"0.6102343",
"0.6099967",
"0.60973823",
"0.60790706",
"0.6070312",
"0.60687524",
"0.6065417",
"0.6064308",
"0.60581774",
"0.6046255",
"0.6046255",
"0.6046255",
"0.6046255",
"0.6045856",
"0.6044736",
"0.6019655",
"0.6018026",
"0.60062975",
"0.6005023",
"0.5999748",
"0.59959537",
"0.5994792",
"0.5988224",
"0.5986761",
"0.59843755",
"0.5977374",
"0.5974878",
"0.59745014",
"0.5967707",
"0.5961805",
"0.59590214",
"0.59571815",
"0.5955871",
"0.5950792",
"0.59454376",
"0.59454376",
"0.5934598",
"0.5932594",
"0.59312916",
"0.59307414",
"0.59157664",
"0.5913822",
"0.5910528",
"0.590805",
"0.5906219",
"0.59055394",
"0.5902268",
"0.5897657",
"0.58883184",
"0.5887859",
"0.5878539",
"0.5869013",
"0.5862413",
"0.58608276",
"0.58607924",
"0.5856426",
"0.5854171",
"0.58504266",
"0.5847134",
"0.5841445",
"0.58404523",
"0.5833275",
"0.5831505",
"0.5831231",
"0.5830156",
"0.5827934",
"0.58277875",
"0.5827282",
"0.5825866",
"0.5823163",
"0.5823057",
"0.58229333"
] |
0.7007172
|
0
|
DELETE /injurylocations/1 DELETE /injurylocations/1.json
|
def destroy
@injurylocation.destroy
respond_to do |format|
format.html { redirect_to injurylocations_url, notice: 'Injurylocation was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n render json: Location.delete(params[\"id\"])\n end",
"def destroy\n @investigationinjurylocation.destroy\n respond_to do |format|\n format.html { redirect_to investigationinjurylocations_url, notice: 'Investigationinjurylocation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @location = Location.find(params[:id])\r\n @location.destroy\r\n\r\n respond_to do |format|\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @record = Location.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @corp_location = CorpLocation.get(params[:id])\n @corp_location.destroy\n\n respond_to do |format|\n format.html { redirect_to corp_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n #@client = Client.find(@location.client_ids)\n #@contact = Contact.find(@location.contact_ids)\n \n @location.destroy\n\n respond_to do |format|\n \n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@items_location = ItemsLocation.find(params[:id])\n #@items_location.destroy\n\n respond_to do |format|\n format.html { redirect_to items_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @specific_location.destroy\n respond_to do |format|\n format.html { redirect_to specific_locations_url, notice: 'Specific location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @discounts_on_location = DiscountsOnLocation.find(params[:id])\r\n @discounts_on_location.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to discounts_on_locations_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @api_v1_location.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_locations_url, notice: 'Location was successfully destroyed.' }\n format.json { render json: { results: @api_v1_location, message: 'Location was successfully destroyed.' } }\n end\n end",
"def destroy\n @storage_location = StorageLocation.find(params[:id])\n @storage_location.destroy\n\n respond_to do |format|\n format.html { redirect_to storage_locations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @apartment_geopoint.destroy\n respond_to do |format|\n format.html { redirect_to apartment_geopoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = $User.get_location(params[:id])\n @location.kill\n GlobalData.reload(:locations)\n respond_to do |format|\n format.html { redirect_to('/locations') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @totem_location.destroy\n respond_to do |format|\n format.html { redirect_to totem_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @location = Location.find(params[:id])\r\n RemovedLocation.create(server_id: Integer(params[:id]))\r\n directory = Rails.root.join('app','assets','locations');\r\n\r\n path = File.join(directory, @location.image)\r\n File.delete(path)\r\n @location.destroy\r\n mv = MapsVersion.first\r\n mv.version = mv.version+1\r\n mv.save\r\n respond_to do |format|\r\n format.html { redirect_to locations_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to geolocation_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @records_location = RecordsLocation.find(params[:id])\n @records_location.destroy\n\n respond_to do |format|\n format.html { redirect_to records_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sign = Sign.find(params[:id])\n @location = Location.find(@sign.location_id)\n @sign.destroy\n\n respond_to do |format|\n format.html { redirect_to location_index_path(@location.name.downcase) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accession_location_entry = AccessionLocationEntry.find(params[:id])\n @accession_location_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to accession_location_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @franchise.destroy\n respond_to do |format|\n format.html { redirect_to client_location_franchises_path(@client, @location) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @geographic_item.destroy\n respond_to do |format|\n format.html { redirect_to geographic_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uriy.destroy\n respond_to do |format|\n format.html { redirect_to uriys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ge_city_api.destroy\n respond_to do |format|\n format.html { redirect_to ge_city_apis_url, notice: 'Ge city api was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient_location.destroy\n respond_to do |format|\n format.html { redirect_to patient_locations_url, notice: 'Patient location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_have_location = LocationHaveLocation.find(params[:id])\n @location_have_location.destroy\n\n respond_to do |format|\n format.html { redirect_to location_have_locations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @loc = current_user.locs.find(params[:id])\n @loc.destroy\n\n respond_to do |format|\n format.html { redirect_to locs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @geopoint = Geopoint.find(params[:id])\n @geopoint.destroy\n\n respond_to do |format|\n format.html { redirect_to geopoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clinic_location.destroy\n respond_to do |format|\n format.html { redirect_to clinic_locations_url, notice: 'Clinic location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @traceroute.destroy\n respond_to do |format|\n format.html { redirect_to traceroutes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @traceroute.destroy\n respond_to do |format|\n format.html { redirect_to traceroutes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @location = Location.find(params[:location_id])\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @processed_location = ProcessedLocation.find(params[:id])\n @processed_location.destroy\n\n respond_to do |format|\n format.html { redirect_to processed_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_geopoint.destroy\n respond_to do |format|\n format.html { redirect_to business_geopoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to trip_locations_path, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @location.destroy\n render :json => { status: :deleted, head: :no_content }\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @event_location = EventLocation.find(params[:id])\n @event_location.destroy\n\n respond_to do |format|\n format.html { redirect_to event_locations_url }\n format.json { head :no_content }\n end\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def destroy\n @occupant = Occupant.find(params[:id])\n @occupant.destroy\n\n respond_to do |format|\n format.html { redirect_to occupants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @locations = nil\n\n if params.has_key? :id\n location = Location.find params[:id]\n @locations = [ location ]\n elsif params.has_key? :ids\n @locations = Location.find params[:ids].split(\",\")\n end\n\n if not @locations.empty?\n @locations.each do |l|\n l.destroy\n end\n end\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meeting_location = MeetingLocation.find(params[:id])\n @meeting_location.destroy\n\n respond_to do |format|\n format.html { redirect_to meeting_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dropoff_location.destroy\n respond_to do |format|\n format.html { redirect_to dropoff_locations_url, notice: 'Dropoff location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @injurytype.destroy\n respond_to do |format|\n format.html { redirect_to injurytypes_url, notice: 'Injurytype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @emergency_location.destroy\n respond_to do |format|\n format.html { redirect_to emergency_locations_url, notice: 'Emergency location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @checklocation = Checklocation.find(params[:id])\n @checklocation.destroy\n\n respond_to do |format|\n format.html { redirect_to checklocations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n set_location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, flash: {success: \"Successfully deleted #{@location.name} location!\" }}\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_meeting_location = UserMeetingLocation.find(params[:id])\n @user_meeting_location.destroy\n\n respond_to do |format|\n format.html { redirect_to user_meeting_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @muster_location.destroy\n respond_to do |format|\n format.html { redirect_to muster_locations_url, notice: 'Muster location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_initiative_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiative_updates_url, notice: 'Initiative update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @county = County.find(params[:id])\n @county.destroy\n\n respond_to do |format|\n format.html { redirect_to counties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_time.destroy\n respond_to do |format|\n format.html { redirect_to location_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_granularity.destroy\n respond_to do |format|\n format.html { redirect_to location_granularities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @city.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_detail.destroy\n respond_to do |format|\n format.html { redirect_to location_details_url, notice: 'Location detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @locid = params[:id]\n Location.destroy(@locid)\n end",
"def destroy\n @location = current_user.locations.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ms_location.destroy\n respond_to do |format|\n format.html { redirect_to ms_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return unless admin?\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n puts \"\\nDESTROY: #{@location.inspect}\"\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: \"Location was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutor_location = TutorLocation.find(params[:id])\n @tutor_location.destroy\n\n respond_to do |format|\n format.html { redirect_to tutor_locations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/locations', notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moonwalk.destroy\n respond_to do |format|\n format.html { redirect_to moonwalks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ministry_location = @ministry.ministry_locations.find(params[:id])\n @ministry_location.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministry_path(@ministry)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item_location.destroy\n respond_to do |format|\n format.html { redirect_to item_locations_url, notice: 'Item location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t @location = Location.find(params[:id])\n\t @location.destroy\n\n\t respond_to do |format|\n\t format.html { redirect_to locations_url }\n\t format.json { head :no_content }\n\t end\n\t end",
"def destroy\n @stationeryrequest = Stationeryrequest.find(params[:id])\n @stationeryrequest.destroy\n\n respond_to do |format|\n format.html { redirect_to stationeryrequests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location = apply_scopes(Location).find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_locations_url(:site => current_site.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @locationmap = Locationmap.find(params[:id])\n @locationmap.destroy\n\n respond_to do |format|\n format.html { redirect_to locationmaps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @backend_location.destroy\r\n respond_to do |format|\r\n format.html { redirect_to backend_locations_url, notice: 'Location was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete\n CONNECTION.execute(\"DELETE FROM locations WHERE id = #{self.id};\")\n end",
"def destroy\n @hospitalization = Hospitalization.find(params[:id])\n @hospitalization.destroy\n\n respond_to do |format|\n format.html { redirect_to client_hospitalizations_url(@client) }\n format.json { head :ok }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.7169746",
"0.70201606",
"0.69014966",
"0.6846182",
"0.683516",
"0.6805017",
"0.6783422",
"0.6693135",
"0.6686494",
"0.6681633",
"0.66808337",
"0.6662069",
"0.66606796",
"0.6659907",
"0.66580576",
"0.66580576",
"0.665664",
"0.6656152",
"0.6656152",
"0.6656152",
"0.6656152",
"0.6656152",
"0.6656152",
"0.6656152",
"0.6656152",
"0.66468066",
"0.6642411",
"0.6638596",
"0.6624786",
"0.662267",
"0.6610203",
"0.6610203",
"0.6610203",
"0.6610203",
"0.66087544",
"0.6608741",
"0.660673",
"0.659939",
"0.65919477",
"0.6586931",
"0.65771717",
"0.65763235",
"0.65750575",
"0.6574846",
"0.6574288",
"0.6574288",
"0.6572285",
"0.65654683",
"0.6554083",
"0.65487874",
"0.6544871",
"0.65442425",
"0.6541289",
"0.65397453",
"0.65368193",
"0.65327966",
"0.65302706",
"0.65274894",
"0.65251297",
"0.65031385",
"0.6500314",
"0.6498896",
"0.6491582",
"0.6485092",
"0.6478634",
"0.64744896",
"0.647438",
"0.6463966",
"0.64589053",
"0.64544713",
"0.64540684",
"0.64518434",
"0.6451435",
"0.6450317",
"0.6437012",
"0.6436803",
"0.642694",
"0.64263344",
"0.6425549",
"0.64229",
"0.64221853",
"0.6421836",
"0.6415193",
"0.64138365",
"0.64133227",
"0.64133227",
"0.6408274",
"0.640784",
"0.6407654",
"0.64070135",
"0.64056796",
"0.6405102",
"0.64029354",
"0.63955534",
"0.639532",
"0.639532",
"0.639532",
"0.639532",
"0.639532",
"0.639532"
] |
0.7359374
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_injurylocation
@injurylocation = Injurylocation.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def injurylocation_params
params.require(:injurylocation).permit(:name, :description)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
O(n) p my_min([ 0, 3, 5, 4, 5, 10, 1, 90 ]) p efficient_my_min([ 0, 3, 5, 4, 5, 10, 1, 90 ])
|
def largest_contiguous_subsum(list)
new_arr = []
(0...list.length).each do |idx1| #O(n)
(0...list.length).each do |idx2| #O(n)
if idx2 >= idx1 #O(1)
new_arr << list[idx1..idx2].sum #O(1)
end
end
end
return new_arr.max #O(n)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend",
"def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end",
"def my_better_min(list)\n min = list[0] #1\n\n list.each_with_index do |ele_1, i| #n\n if ele_1 < min # 1 *n\n min = ele_1 #1 *n\n end\n end\n\n min #1\n # (i...list.length).each do |j|\n # if list[i] list[j]\nend",
"def faster_my_min(arr) # O(n)\n min = arr[0]\n arr.each do |ele|\n min = ele if ele < min\n end\n min\nend",
"def my_min(list)\r\n list.inject { |min,ele| min < ele ? min : ele }\r\n \r\n # Time : O(n)\r\n # Space : O(1)\r\nend",
"def my_min(arr) #O(n2)\n min = arr.first\n arr.each_with_index do |el_1 , i|\n (i+1...arr.length).each do |el_2|\n if arr[el_2] < el_1 && arr[el_1] < min \n min = arr[el_2]\n end \n end \n end \n min \n end",
"def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend",
"def my_min(array)\n min_val = array.first\n array.each_with_index do |el1, idx1| # O(n)\n array.each_with_index do |el2, idx2| # O(n)\n if idx1 < idx2 # O(1)\n if el1 < el2# O(1)\n if el1 < min_val# O(1)\n min_val = el1# O(1)\n end\n else\n if el2 < min_val# O(1)\n min_val = el2# O(1)\n end\n end\n end\n end\n end\n min_val\n end",
"def my_min_2(nums) # O(n)\n smallest = 0\n nums.each do |num|\n smallest = num if num < smallest\n end\n smallest\nend",
"def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend",
"def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend",
"def better_min(array)\n min_val = array.first\n\n array.each do |el| #O(n)\n if el < min_val\n min_val = el\n end\n end\n min_val\n end",
"def my_min_fast(list)\n smallest = list.first\n\n list[1..-1].each { |n| smallest = n if n < smallest }\n smallest\nend",
"def my_min_v2(arr) # O(n)\n num = arr[0]\n arr.each { |int| num = int if int < num }\n num\nend",
"def my_min(arr) #linear\n arr.reduce do |smallest, num|\n if smallest < num\n smallest\n else\n smallest = num\n end\n end\nend",
"def my_min(arr)\n\n smallest_value = arr[0]\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n # smallest_value = ele1 if ele1 < smallest_value\n if arr.all?{|ele2| ele1 <= ele2 } #O(n)\n smallest_value = ele1\n end\n end\n\n smallest_value\n\nend",
"def better_my_min(array)\n array.inject do |acc, ele|\n if acc <= ele\n acc\n else\n ele\n end\n end\n end",
"def my_min(list)\n i = 0\n min = list[0]\n while i < list.length - 1\n if list[i + 1] < min\n min = list[i + 1]\n end\n i += 1\n end\n min\nend",
"def my_min_2(list) # n\n min_value = list.first\n i = 0\n while i < list.length\n min_value = list[i] if list[i] < min_value\n i += 1\n end\n min_value\nend",
"def my_min(list)\n min = list[0]\n (0...list.length).each do |i| \n min = list[i] if list[i] < min\n end\n min\nend",
"def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def my_min(list)\n min = list[0]\n (1...list.length).each do |i| \n min = list[i] if list[i] < min \n end\n min\nend",
"def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def my_min(list)\n min = 0\n list.each do |ele|\n list.each do |ele2|\n min = ele if ele < ele2 && ele < min\n end\n end\n min\nend",
"def my_min_improved(arr)\n min = arr[0]\n\n arr.each do |el|\n min = el if el < min\n end\n\n return min\nend",
"def better_my_min(array)\n smallest = array[0]\n array[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min(array) # O(n) - Linear\n counter = array[0]\n\n (1...array.length).each do |i|\n if counter > array[i]\n counter = array[i]\n end\n end\n counter\nend",
"def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend",
"def my_min_linear(list)\n smallest_number = list.first\n \n list.each do |num|\n smallest_number = num if num < smallest_number\n end\n\n smallest_number\nend",
"def my_min_fast(arr)\n smallest = arr[0]\n arr.each do |ele|\n if ele < smallest\n smallest = ele\n end\n end\n return smallest\nend",
"def my_min2(list)\n min = 0\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def my_min(arr)\n min = arr.first\n (0...arr.length).each do |idx1|\n (idx1...arr.length).each do |idx2|\n if (idx2 != idx1) && (arr[idx1] < arr[idx2]) && (arr[idx1] < min)\n min = arr[idx1]\n end\n\n end\n end\n min\n\nend",
"def my_min(arr)\n smallest = nil\n\n arr.each do |n|\n smallest = n if smallest.nil? || n < smallest\n end\n\n smallest\nend",
"def my_min_2(list)\n min = nil\n\n list.each do |num|\n min = num if min.nil? || num < min\n end\n\n min\nend",
"def my_min(arry)\n mini = arry.first\n arry.each do |ele|\n if ele < mini\n mini = ele\n end\n end\n mini\nend",
"def my_min(arr)\n min = arr[0]\n (0...arr.size).each do |i1|\n (i1 + 1...arr.size).each do |i2|\n min = arr[i2] if arr[i2] < min\n end\n end\n min\nend",
"def my_min(arr)\n min = arr[0]\n (1...arr.length).each do |i|\n if arr[i] < min\n min = arr[i]\n end\n end\n min\nend",
"def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller << el2 if el2 < el\n end\n return el if equal_or_smaller.empty?\n end\nend",
"def my_min2(arr)\n minimum = arr.first\n arr.each do |num|\n minimum = num if num < minimum\n end\n minimum\nend",
"def good_my_min(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min_2(list)\n min = list.first\n list.each do |num|\n if num < min \n min = num\n end\n end\n min\nend",
"def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min2(array)\n min = array.first\n array.each do |el|\n min = [el, min].min\n end\n min\nend",
"def my_min_2(list)\n smallest = 0\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min_linear(array)\n min = array[0]\n\n array.each do |num|\n min = num if num < min\n end\n min\nend",
"def my_min(arr)\n output = arr.first\n \n (1...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n output = arr[j] if arr[j] < output\n end\n end\n \n output\nend",
"def linear_my_min(arr)\n # arr.inject do |min, ele|\n # min > ele \n # end\n # arr.first \n\n min = arr.first \n\n arr.each do |ele|\n min = ele if ele < min \n end\n min \n\nend",
"def my_min(list)\n min = list.first \n\n list.each do |el|\n if el < min \n min = el \n end\n end\n min\nend",
"def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend",
"def my_min(list)\r\n smallest = list.first\r\n list.each do |ele|\r\n smallest = ele if ele < smallest\r\n end\r\n return smallest\r\nend",
"def my_min(arr)\n l = arr.length - 1 # constant\n # min = 0 # is this more efficient than swapping? \n (0...l).each do |i| # n times1\n if arr[i] < arr[i+1] # 1\n arr[i], arr[i+1] = arr[i+1], arr[i] # 1\n end\n end\n\n arr.last # 1\nend",
"def best_my_min(arr)\n smallest = arr.shift\n arr.each do |el|\n smallest = el unless el > smallest\n end\n smallest\nend",
"def my_min(list)\r\n smallest = 0\r\n \r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 > idx1 \r\n if ele1 < smallest\r\n smallest = ele1\r\n end\r\n if ele2 < smallest\r\n smallest = ele2\r\n end\r\n end\r\n end\r\n end\r\n\r\n smallest\r\nend",
"def my_min2(arr)\n min = arr.first\n arr.each { |el| min = el if el < min }\n min\nend",
"def my_min_once(arr)\n min = arr.first \n\n (0...arr.count).each do |i|\n min = arr[i] if arr[i] < min \n end\n\n min \nend",
"def my_min2(array)\n lowest_num = array.first\n array.each do |el1|\n next if lowest_num == el1\n if el1 < lowest_num\n lowest_num = el1\n end\n end\n lowest_num\nend",
"def my_min2(list)\n min = list[0]\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def my_min(list)\n smallest_num = nil\n list.each do |num|\n if smallest_num == nil || smallest_num > num\n smallest_num = num\n end\n end\n smallest_num\nend",
"def my_min2(array)\n minimum = array.first\n array.each_index do |idx|\n if array[idx] < minimum\n minimum = array[idx]\n end\n end\n minimum\nend",
"def my_min2(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min(arr)\n min = arr.first\n\n arr.each do |el|\n min = el if el < min\n end\n\n min\nend",
"def my_min(list)\n list.each do |el|\n smallest = true\n list.each do |second_el|\n if second_el < el\n smallest = false\n end\n end\n if smallest == true\n return el\n end\n end\nend",
"def my_min2(arr)\n min = arr.first \n arr.each {|ele| min = ele if ele < min }\n min\nend",
"def my_min2(list)\n smallest_number = list.first\n list.each do |num|\n smallest_number = num if num <= smallest_number\n end\n smallest_number\nend",
"def my_min(arr)\n arr.inject{|acc, el| el < acc ? acc = el : acc }\nend",
"def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend",
"def my_min_iterative(array)\n minimum = nil\n\n array.each { |element| minimum = element if minimum.nil? || element < minimum }\n\n minimum\nend",
"def my_min2(arr)\r\n min = arr[0]\r\n arr.each { |num| min = num if num < min }\r\n min\r\nend",
"def my_min_phase_2(list)\n min = list[0]\n (1...list.length).each do |i|\n min = list[i] if list[i] < min\n end\n min\nend",
"def my_min2(int_list)\n min = 0\n\n int_list.each do |int|\n min = int if int < min\n end\n\n min\nend",
"def my_min2(array)\n min = array.first\n array.each {|item| min = item if item <= min}\n return min\nend",
"def my_min(array)\n\n smallest = array.first\n array.each_with_index do |el, i|\n smallest = el if el < smallest\n end\n smallest\n\nend",
"def my_min2(array)\n array.inject { |acc, ele| acc < ele ? acc : ele}\nend",
"def my_min_v2(array)\n minimum = array.first\n\n array[1..-1].each do |element|\n minimum = element if minimum > element\n end\n\n minimum\nend",
"def my_min(list)\r\n smaller_ele = []\r\n list.each do |ele1|\r\n list.each do |ele2|\r\n smaller_ele << [ele1,ele2].min \r\n end\r\n end\r\n return smaller_ele.min\r\nend",
"def my_min(arr)\n min = arr[0]\n arr.each do |num|\n if num < min\n min = num\n end\n end\n min\n\nend",
"def phase_1_min(list)\n smallest = 0\n list.each_with_index do |num1, indx1|\n list.each_with_index do |num2, indx2|\n next if indx1 == indx2\n smallest = num1 if num1 < num2 && num1 < smallest\n end\n end\n smallest\nend",
"def my_min2(arr)\n smallest = arr[0]\n arr[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min2(arr)\n minimum = arr[0]\n arr[1..-1].each do |el|\n minimum = el if el < minimum\n end\n minimum\nend",
"def find_min(*nums)\n nums.reduce do | acc, current_value |\n if acc > current_value\n current_value\n else\n acc\n end\n end\nend",
"def my_min_2(list) \n min = list.first \n list.each {|num| min = num if min > num }\n min\nend",
"def my_min_2(arr)\n least = arr[0]\n\n arr.each do |i|\n arr.each do |y|\n if i < y && i < least\n least = i\n end\n end\n end\n\n least\n\n\nend",
"def find_min2(array)\n min = array[0]\n \n array.each do |num|\n if num < min\n min = num\n end\n end\n \n return min\nend",
"def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end",
"def my_min(list)\n min = list[0]\n\n list.each do |ele| \n case min <=> ele\n when 1\n min = ele\n when 0\n next\n when -1\n min = min \n end\n end\n\n min\nend",
"def my_min2(arr)\n timestart = Time.now\n smallest = arr[0]\n (1...arr.length).each do |idx|\n smallest = arr[idx] if smallest > arr[idx]\n end\n p (Time.now - timestart) * 1000\n smallest\nend",
"def my_min2 # O(n) time complexity\n smallest = self.first\n self.each do |num|\n sleep(1)\n smallest = num if num < smallest \n end\n smallest\n end",
"def find_min_brute(nums)\n smallest = nums[0]\n nums.each do |n|\n (smallest = n) if n < smallest \n end\n return smallest\nend",
"def find_min(arr)\n min = arr.first\n (1...arr.length).each do |idx|\n min = arr[idx] if arr[idx] < min\n end\n min\nend",
"def find_min_value(array)\n min_element = 10000000\n array.length.times { |index|\n if min_element > array[index]\n min_element = array[index]\n end\n }\n return min_element# Add your solution here\nend",
"def find_min(nums)\n nums.rotate(rand(1..10)).min\nend",
"def my_min2(arr)\n smallest = arr.first\n\n arr.each do |i|\n smallest = i if smallest > i\n end\n\n smallest\nend",
"def my_min1(arr)\n arr.each do |el1| #O(n)\n if arr.all? {|el2| el1 <= el2 } #O(n + 1)\n return el1\n end\n end \nend",
"def my_min2(list)\n result = list.first\n list.each do |el|\n result = el if el < result\n end\n result\n\nend",
"def my_min(array)\n\t\n\tarray.min\n\t\nend",
"def min(list)\n tiny = list[0]\n list.each do |n|\n if n < tiny\n tiny = n\n end\n end\n puts tiny\nend",
"def my_min_once\n min = first\n each do |num|\n if num < min\n min = num\n end\n end\n min\n end",
"def my_min_n2(arr)\n arr.each_with_index do |comp_el, idx|\n im_the_smallest = true\n (idx + 1).upto(arr.length - 1) do |j|\n im_the_smallest = false if comp_el > arr[j]\n end\n return comp_el if im_the_smallest == true\n end\nend",
"def my_min(array)\n sorted = false\n until sorted\n sorted = true\n\n array.each_index do |idx|\n next if idx + 1 == array.length\n if array[idx] > array[idx + 1]\n array[idx], array[idx + 1] = array[idx + 1], array[idx]\n sorted = false\n end\n end\n end\n\n array.first\nend",
"def my_min(array)\n min = array.first\n array.each {|el| min = el if min > el}\n min\nend",
"def find_min(arr)\n smallest_value = arr.first\n for value in arr\n if value <= smallest_value\n smallest_value = value\n end\n end\n smallest_value\nend"
] |
[
"0.8237659",
"0.8180464",
"0.81215715",
"0.81071955",
"0.8085318",
"0.8051608",
"0.8040617",
"0.8039413",
"0.803129",
"0.8018156",
"0.7984005",
"0.7980396",
"0.7976151",
"0.7956369",
"0.78611493",
"0.7860215",
"0.7848876",
"0.78371584",
"0.7833844",
"0.7820214",
"0.78129673",
"0.7798429",
"0.7790214",
"0.77616316",
"0.7725686",
"0.77182007",
"0.77015233",
"0.76862514",
"0.7685986",
"0.76829827",
"0.7663927",
"0.76350546",
"0.7628827",
"0.7625391",
"0.76234204",
"0.7622756",
"0.7589466",
"0.7586078",
"0.75839376",
"0.7581993",
"0.7580796",
"0.75781167",
"0.75641525",
"0.75627756",
"0.75550675",
"0.755198",
"0.7546038",
"0.7536411",
"0.7529905",
"0.7528848",
"0.75274783",
"0.7518441",
"0.75175685",
"0.7494072",
"0.7492931",
"0.7491937",
"0.74898803",
"0.74891055",
"0.7476309",
"0.7463637",
"0.7462122",
"0.7461249",
"0.7458887",
"0.74585634",
"0.7458241",
"0.7446561",
"0.7444042",
"0.74319416",
"0.74307775",
"0.7427958",
"0.7408114",
"0.7406939",
"0.74042356",
"0.7402123",
"0.73980296",
"0.7388988",
"0.7386505",
"0.73829544",
"0.73565835",
"0.7356014",
"0.7349777",
"0.7348461",
"0.73298615",
"0.73270565",
"0.7326259",
"0.7319008",
"0.7312535",
"0.7309619",
"0.7309604",
"0.73055416",
"0.7285821",
"0.728457",
"0.7283511",
"0.7283394",
"0.72803485",
"0.7275065",
"0.72637534",
"0.723725",
"0.7233499",
"0.7228826",
"0.7228552"
] |
0.0
|
-1
|
=> 8 possible subsums [5] => 5 [5, 3] => 8 > we want this one [5, 3, 7] => 1 [3] => 3 [3, 7] => 4 [7] => 7
|
def efficient_contiguous_subsum(list)
current_sum = list[0] #0
largest_sum = list[0] #5
# debugger
(1...list.length).each do |i|
if current_sum + list[i] > 0
current_sum += list[i]
largest_sum = current_sum if current_sum > largest_sum
else
current_sum = 0
end
end
largest_sum
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sub_sums(list)\n num = []\n list.length.times do |start|\n (start...list.length).each do |length|\n sub_array = list[start..(start + length)]\n num << sub_array.inject(:+)\n end\n end\n num.max\n end",
"def largest_continous_subsum\n largest = 0\n subsets = []\n\n i = 0\n while i < self.length\n j = i\n while j < self.length\n subsets << self[i..j]\n j += 1\n end\n i += 1\n end\n\n subsets.each do |pair|\n if largest < pair.reduce(:+)\n largest = pair.reduce(:+)\n end\n end\n largest\n\n end",
"def subs_sums(arr)\n new_arr = []\n i = 0 \n while i < arr.length \n x = i \n sub_arr = []\n\n while x < arr.length \n sub_arr << arr[i..x]\n x += 1\n end\n new_arr += sub_arr\n i += 1 \n end\n\n big = arr.min \n\n new_arr.each do |sub_arr|\n \n if sub_arr.sum > big\n big = sub_arr.sum\n end\n end\n big\nend",
"def sub_sum(list)\n sub_arrs = []\n # byebug\n list.each_index do |i|\n list.each_index do |j|\n if j >= i\n sub_arrs << list[i..j]\n end\n end\n end\n size = []\n sub_arrs.each do |arr|\n size << arr.inject(&:+)\n end\n size.max\nend",
"def largest_cont_subsum(list)\n pairs = []\n\n list.each.with_index do |n_1, i_1|\n (i_1...list.length).each do |i_2|\n pairs << list[i_1..i_2]\n end\n end\n sums = []\n pairs.each do |pair|\n sums << pair.sum\n end\n sums.length\nend",
"def largest_sub_sum(array)\n subsets = []\n i = 0\n while i < array.length\n j = i\n while j < array.length\n subsets << array[i..j]\n j += 1\n end\n i += 1\n end\n result = nil\n subsets.map {|subset| subset.inject(:+)}.each do |sum|\n result = sum if result.nil? || result < sum\n end\n result\nend",
"def solve_again_with_more_issues(array, sum)\n array.combination(2).find_all do |one, two|\n one + two == sum\n end.size\nend",
"def contig_subarrs_that_sum_to_k(k, arr) # so this problem worked with contiguous subarrays that sum to a value k\n # for example, arr[j] - arr[i] vs. arr[j]\n # if you do a running sum, any difference that equals k is what we're looking for.\n # then we can increment a counter, we can save j - i for a max size, or we can even grab the subarray.\n running_sum = 0\n arr.each_with_index do |el, index|\n end\nend",
"def contig_subsum(array)\n sub_arrays = []\n i = 0\n j = 0\n while i < array.length do\n while j < array.length do\n sub_arrays << array[i..j]\n j += 1\n end\n i += 1\n j = i\n end\n\n max_sum = 0\n arr = []\n\n sub_arrays.each do |sub|\n arr << sub.inject(:+)\n end\n\n arr.uniq.sort.last\n\nend",
"def sub_sum(list)\n subs = []\n\n list.each_with_index do |el1, i|\n # debugger\n (0...list.length - i).each do |len|\n subs << list[i..i + len]\n end\n\n end\n\n subs.map! do |subset|\n subset.inject(:+)\n end\n\n subs.max\nend",
"def largest_contiguous_subsum_1(list)\r\n subarrays = [] #1\r\n list.each_with_index do |ele1, i| #n\r\n list[i...list.length].each_with_index do |ele2,i2| #(n-1)\r\n subarrays << list[i..i2+i] #k \r\n end\r\n end # n^2\r\n subarrays.map { |subarray| subarray.sum}.max # n^x\r\nend",
"def sub_sum(list) #quadratic\n subsets = []\n i = 0\n while i < list.length\n j = i\n while j < list.length\n subsets << list[i..j].reduce(:+)\n j += 1\n end\n i += 1\n end\n subsets.sort.last\nend",
"def largest_contiguous_subsum_v1(arr)\n subs = [] # ( +2 )\n\n (0...arr.length).each do |idx1| # ( n )\n (idx1..arr.length - 1).each do |idx2| # ( n )\n subs << arr[idx1..idx2].sum # ( n * ( 1 + ))\n end\n end\n\n subs.max # ( n )\nend",
"def sub_sum2(array)\n arr = []\n sum = 0\n array.each do |el|\n arr << [el] \n end\n array.each do |el|\n array.shift\n arr << array\n end\n # p arr\n result = 0\n arr.each do |set|\n if set.reduce(:+) > result\n result = set.reduce(:+)\n end \n end \n result\nend",
"def largest_sub_sum(array) #technically I believe this is a n^3 operation since you are first doing a n^2 with the nested loop and then multiplying by n at the end (the map/ another loop) -- hence the n^3\n answer_subs = []\n\n (0...array.length).each do |i|\n ((i + 1)...array.length).each do |j|\n answer_subs << [array[i]]\n answer_subs << [array[j]]\n answer_subs << array[i..j] #should have every combo in subs now\n end\n end\n answer_subs.sort.uniq.map{|sub| sub.reduce(:+)}.max\n # .map {|sub| sub.reduce(:+)}.max # should 1) reduce(:+)/ add up every element in each array. The map returns the array and then max returns the max number\nend",
"def largest_contiguous_subsum(arr)\r\n # sub_arr = []\r\n # (0...arr.length).each do |idx|\r\n # (idx...arr.length).each do |idx_2| \r\n # sub_arr << arr[idx..idx_2]\r\n # end\r\n # end\r\n # p sub_arr.length \r\n # sub_arr.map {|sub| sub.sum }.max\r\n max = arr.first #8\r\n curr = arr.first #8\r\n arr.drop(1).each do |ele| \r\n curr = 0 if curr < 0\r\n curr += ele\r\n max = curr if curr > max\r\n end\r\n max\r\nend",
"def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend",
"def largest_contiguous_subsum(arr)\n subsets = [] \n\n (0...arr.length).each do |i| \n (i...arr.length).each do |j| \n subsets << arr[i..j]\n end \n end \n \n subsets.map {|sub| sub.sum}.max \nend",
"def largest_con_sum(arr)\n subsets = []\n\n arr.each_index do |i|\n j = i\n until j >= arr.length\n subsets << arr[i..j]\n j += 1\n end\n end\n subsets.map { |arr| arr.reduce(&:+) }.max\nend",
"def largest_contiguous_subsum(list)\r\n max_val = 0 #8\r\n current_sum = 0 #8\r\n list.each do |num|\r\n current_sum = [0, current_sum + num].max\r\n max_val = [max_val, current_sum].max\r\n end\r\n return max_val\r\nend",
"def sub_sum(array)\n sums = []\n i = 0\n j = 0\n\n while i < array.length\n while j < array.length\n sums << array[i..j]\n j += 1\n end\n i += 1\n j = i\n end\n sums.sort_by{|x| x.reduce(:+)}.last.reduce(:+)\n end",
"def largest_contiguous_subsum_n(list2)\n large = 0\n \n list2.inject do |sum, n|\n if (sum + n) > sum\n sum += n \n large = sum if sum > large\n sum\n else\n sum = 0\n end\n end\n\n large\nend",
"def largest_contiguous_subsum_n_2(arr)\n subs = []\n arr.each_with_index do |el1, i|\n arr.each_with_index do |el2, j|\n if j > i \n subs << arr[i..j]\n end\n end\n end\n subs\n x = subs.max_by {|arr| arr.sum}\n x.sum\nend",
"def num_subsequences(input, subsequence_sum)\n digits = DigitQueue.new input\n num = 0\n until digits.empty?\n crnt_sum = 0\n while crnt_sum < subsequence_sum && !digits.empty?\n crnt_sum += digits.next\n end\n return nil unless crnt_sum == subsequence_sum\n num += 1 \n end\n num\nend",
"def subarray_sum(nums, k)\n\n hash = {0 => 1}\n sum = 0\n count = 0\n\n for num in nums\n sum += num\n count += hash[sum - k] if !hash[sum -k].nil?\n hash[sum] ||= 0\n hash[sum] += 1\n end\n count\nend",
"def non_abundant_sums\r\n max = 28123\r\n range = (2..28123)\r\n abundants = range.select{|n| abundant?(n) }\r\n numbers_made_from_abundants = []\r\n abundants.each do |i|\r\n abundants.each do |j|\r\n sum = i + j \r\n break if sum > max \r\n numbers_made_from_abundants << sum \r\n end \r\n end \r\n (range.to_a - numbers_made_from_abundants).reduce(:+)\r\nend",
"def sub_sum(list)\n result = []\n i = 0\n while i < list.length\n result << [list[i]]\n j = i + 1\n while j < list.length\n result << list[i..j]\n j += 1\n end\n i += 1\n end\n\n result.map! { |arr| arr.reduce(:+) }\n result.max\nend",
"def sub_sum(list)\n array = []\n (0...list.length).each do |idx1|\n (idx1...list.length).each do |idx2|\n array << list[idx1..idx2] #O(n)\n end\n end \n array.map {|sub| sub.length > 1 ? sub.sum : sub.first}.max\nend",
"def largest_contiguous_subsum(arr)\n subs = []\n l = arr.length\n (0...l).each do |i|\n (0...l).each do |j| \n subs << arr[i..j] if arr[i..j].length > 0 # n*n *( n) == n^3 + n\n end\n end\n subs.map(&:sum).max\nend",
"def largest_contiguous_subsum(list)\n subsets = []\n (0...list.length).each do |idx1|\n (idx1...list.length).each do |idx2|\n subsets << list[idx1..idx2]\n end\n end\n\n #orignial [1,2,3]\n\n #[1]\n #[1,2]\n #[1,2,3]\n #[2]\n #[2,3]\n #[3]\n\n\n largest = subsets[0].sum\n subsets.each do |subset|\n largest = subset.sum if subset.sum > largest\n end\n\n largest\nend",
"def largest_contiguous_subsum(arr)\n subsets = []\n\n (0...arr.length).each do |idx1|\n (idx1...arr.length).each do |idx2|\n subsets << arr[idx1..idx2]\n end\n end \n\n largest_sum = subsets.first.sum\n\n subsets.each do |subset|\n if subset.sum > largest_sum\n largest_sum = subset.sum\n end\n end\n\n print subsets\nend",
"def problem_106a\n combin = lambda { |m,h| m.factorial / (h.factorial * (m - h).factorial) }\n max = 20\n\n sum = Array.new(max+1,-1)\n 1.upto(max) do |n|\n 0.upto(n/2) do |k|\n sum[n] += combin.call(n,2*k) * combin.call(2*k - 1, k + 1)\n end\n puts \"#{n} #{sum[n]}\"\n end\n sum[12]\nend",
"def sumofint(arr)\n combi = (0..9).to_a.combination(3).to_a.map{|e| e.reduce(:+)}\n _n, s = arr\n combi.select{ |e| e == s }.length\nend",
"def largest_contiguous_subsum(arr)\n answer = []\n arr.each_with_index do |ele1,idx1|\n arr.each_with_index do |ele2,idx2|\n answer << arr[idx1..idx2].sum \n end\n end\n answer.sort[-1]\nend",
"def contig_sum(array)\n greatest_diff = -Float::INFINITY\n subsets = []\n\n i = 0\n while i < array.length\n j = i + 1\n while j <= array.length\n subsets << array[i..j]\n j += 1\n end\n i += 1\n end\n\n subsets.each do |arr|\n sum = arr.inject(:+)\n if sum > greatest_diff\n greatest_diff = sum\n end\n end\n greatest_diff\n\nend",
"def largest_contiguous_subsum(arry)\n sums = 0\n size = arry.length\n\n (0..size - 1).each do | i|\n sub = []\n (i + 1..size).each do |j|\n sub = arry[i..j]\n if sub.sum > sums\n sums = sub.sum \n end\n end\n end\n sums\nend",
"def largest_contiguous_subsum(arr)\n i = 0\n subs = []\n while i < arr.length\n j = i\n\n while j < arr.length\n subs << arr[i..j]\n\n j += 1\n end\n\n i += 1\n end\n\n\n return (subs.max {|a, b| a.sum <=> b.sum}).sum\n\nend",
"def largest_contiguous_subsum(arr) # n^2\n subs = []\n (0...arr.length).each do |start_i|\n (start_i...arr.length).each do |end_i|\n subs << arr[start_i..end_i]\n end\n end\n\n subs.map { |sub| sub.inject(:+) }.max\nend",
"def largest_contiguous_subsum(list)\n answer=[]\n list.each_with_index do |ele,index|\n list.each_with_index do |ele2,index2|\n if index2 >= index \n answer.push(list[index..index2])\n end\n end\n end\n answer.map {|array| array.sum}.max\nend",
"def largest_contiguous_subsum(arr)\n\n\nend",
"def linear_subsum(arr)\n largest = arr[0] # 5\n current = 0 # -4\n\n (0...arr.length).each do |idx| # 1\n current += arr[idx]\n largest = current if current >= largest\n current = 0 if current < 0\n end\n largest\nend",
"def solution(number)\r\n (3...number).each_with_object([]) { |n, arr| arr << n if (n % 3).zero? || (n % 5).zero? }.uniq.sum\r\nend",
"def solution(a)\n d = 6\n n = a.length\n sums = [a[0]] * d\n\n for i in 1...n do\n sums[i % d] = sums.max + a[i]\n end\n\n sums[(n-1) % d]\nend",
"def largest_contiguous_subsum(arr)\n sums = []\n\n (0...arr.length).each do |idx1|\n (idx1+1...arr.length).each do |idx2|\n sums << arr[idx1..idx2].sum\n end\n end\n\n sums.max\nend",
"def solution(a)\n n = a.size\n starting = Array.new(n, 0)\n ending = Array.new(n, 0)\n\n (1..n - 2).each {|i| starting[i] = [starting[i - 1] + a[i], 0].max}\n (1..n - 2).reverse_each {|i| ending[i] = [ending[i + 1] + a[i], 0].max}\n\n sum = 0\n (1..n - 2).each {|i| sum = [sum, starting[i - 1] + ending[i + 1]].max}\n sum\nend",
"def largest_contiguous_subsum(arr)\n max = 0\n\n (0...arr.count).each do |i|\n sum = arr[i]\n (i + 1...arr.count).each do |j|\n sum += arr[j]\n max = sum if max < sum \n end \n end \n\n max\nend",
"def count_adjacent_sums(array, n)\n\nend",
"def largest_contiguous_subsum_two(list)\n largest_sum = list[0]\n current_sum = 0\n # list.inject {|acc, ele| acc + ele}\n list.each do |ele|\n current_sum = [ele, current_sum + ele].max\n largest_sum = [largest_sum, current_sum].max\n end\n largest_sum\nend",
"def opposing_sums(array)\n\nend",
"def subarray_sum(nums, k)\n subarray_count = 0\n map = {0 => 1}\n sum = 0\n \n nums.each_with_index do |n, idx|\n \n new_sum = sum += n\n # newsum = 1\n \n # if key exists\n if map[new_sum - k]\n \n subarray_count += map[new_sum - k]\n end\n \n map[new_sum].nil? ? map[new_sum] = 1 : map[new_sum] += 1\n \n sum = new_sum\n end\n \n return subarray_count\nend",
"def sum_square_difference(max_num: 100)\n diff = 0\n num_set = (1..max_num).to_a.reverse\n set_sum = num_set.inject(:+)\n until num_set.length == 1\n foo = num_set.pop\n set_sum -= foo\n diff += 2 * foo * set_sum\n end\n puts diff\nend",
"def num_sums(target)\n @partial_num_sums = Array.new(target + 1) { Array.new(target + 1, nil) }\n sums = num_sums_helper(target) - 1\n @partial_num_sums = nil\n sums\nend",
"def largest_contiguous_subsum_2(list)\n current_sum = 0\n largest_sum = 0\n (0...list.length).each do |idx|\n current_sum += list[idx]\n largest_sum = current_sum if current_sum > largest_sum\n current_sum = 0 if current_sum < 0\n end\n largest_sum\nend",
"def largest_contiguous_sub_sum1(list)\n max = list[0]\n (0...list.length).each do |i|\n (i...list.length).each do |j| \n sub_sum = list[i..j].sum \n max = sub if sub >= max \n end\n end\n max\nend",
"def largest_contiguous_subsum_2(list)\n largest_sum = 0\n current_sum = 0\n\n list.each do |el|\n largest_sum = current_sum \n current_sum += el \n if current_sum < el \n current_sum = el \n end \n largest_sum = current_sum if largest_sum < current_sum\n end\n\n largest_sum\nend",
"def running_tally_largest_contiguous_subsum(integers)\n max_sum = integers.first\n local_sum = integers.first\n (1...integers.length).each do |idx|\n current_int = integers[idx]\n if current_int + local_sum > 0\n local_sum += current_int\n elsif max_sum.positive?\n local_sum = 0\n elsif current_int > local_sum\n local_sum = current_int\n end\n \n max_sum = local_sum if local_sum > max_sum\n end\n max_sum\nend",
"def largest_contiguous_subsum(list)\n subs = [] \n (0...list.length).each do |i|\n (i...list.length).each do |j|\n subs << list[i..j]\n end\n end\n\n subs.map {|el| el.sum}.max\nend",
"def parts_sums(input_array)\n total = input_array.sum\n output = [total]\n input_array.size.times do \n total = total - input_array.shift\n output << total\n end\n output\nend",
"def largest_contiguous_subsum(list)\n max_sum = 0\n i = 0\n while i < list.size\n curr_sum = list[0..i].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-1].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[0..i].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-1].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-i].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-i].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n i += 1\n end\n max_sum\nend",
"def largest_contiguous_subsum(nums)\n running_sum = 0\n max = nums.first || 0\n\n nums.each do |n|\n running_sum += n\n max = running_sum if max < running_sum\n running_sum = 0 if running_sum < 0\n end\n max\nend",
"def largest_contiguous_subsum_2(list)\n largest_sum = list.first\n current_sum = 0\n list.each do |ele| \n current_sum += ele\n if current_sum > largest_sum\n largest_sum = current_sum\n end\n current_sum = 0 if current_sum < 0 \n end\n largest_sum\nend",
"def largest_contiguous_sum(array)\n subsets = []\n subarr = []\n\n\n array.each_index do |i|\n array.each_index do |j|\n next if j < i\n subsets << array[i..j] unless subsets.include? array[i..j]\n end\n end\n sum = 0\n subsets.each do |sarr|\n next if sarr.empty?\n sum = [sarr.inject(:+), sum].max\n end\n sum\nend",
"def sum_of_sums(numbers)\n sum_total = 0\n 1.upto(numbers.size) do |count|\n sum_total += numbers.slice(0, count).inject(:+)\n end\n sum_total\nend",
"def CoinDeterminer(num)\n coins = [1,5,7,9,11]\n return num if num <= 4\n (1..coins.size - 1).each do |comb|\n coins.combination(comb).to_a.each do |collection|\n return collection.size if collection.reduce(&:+) == num\n end\n end\n \nend",
"def sub_sum_1(list)\r\n subarr = []\r\n\r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 >= idx1\r\n subarr << list[idx1..idx2]\r\n end\r\n end\r\n end\r\n subarr.map { |sub| sub.sum }.max\r\n\r\nend",
"def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend",
"def largest_contiguous_subsum(arr)\n max_sum = arr.first\n\n (0...arr.length).each do |start|\n (start...arr.length).each do |ending|\n sum = arr[start..ending].sum\n max_sum = sum if sum > max_sum\n end\n end\n\n max_sum\nend",
"def largest_contigous_subsum_ii(list)\n current_sum = list.first\n max = list.first\n (1..-1).each do |i|\n current_sum += list[i]\n current_sum = 0 if current_sum < 0\n max = current_sum if max < current_sum\n end\n current_sum\nend",
"def sum_of_sums(array)\n supersum = 0\n array.each_with_index do |_, index|\n supersum += array[0, index + 1].inject(:+)\n end\n supersum\nend",
"def solution(a)\n return 0 if a.uniq.size != a.size\n \n max = a.size \n sum = (1 + max) * max / 2\n \n array_sum = a.inject(0, &:+) \n sum == array_sum ? 1 : 0 \nend",
"def largest_contiguous_subsum1(array)\n sub_array = []\n\n array.each_index do |i|\n array.each_index do |j|\n next if i > j\n sub_array << array[i..j]\n end\n end\n sum = sub_array.first.inject(:+)\n sub_array.each do |el|\n sum = el.inject(:+) if el.inject(:+) > sum\n end\n sum\nend",
"def largest_contiguous_subsum(list)\r\n sub_arr = []\r\n list.each_with_index do |ele1,idx1|\r\n list.each_with_index do |ele2,idx2|\r\n sub_arr<< list[idx1..idx2] if idx2>=idx1\r\n end\r\n end\r\n p sub_arr.size\r\n sub_arr.map{ |sub| sub.sum}.max\r\n #(O(n^2 + m)\r\nend",
"def sum_of_sums(numbers)\n sum_total = 0\n 1.upto(numbers.size) do |count|\n sum_total += numbers.slice(0, count).reduce(:+)\n end\n sum_total\nend",
"def sum_of_sums(numbers)\n sum_total = 0\n 1.upto(numbers.size) do |count|\n sum_total += numbers.slice(0, count).reduce(:+)\n end\n sum_total\nend",
"def sub_sum_2(list)\r\n largest_sum = list.first\r\n current_sum = list.first\r\n \r\n # one loop only\r\n # need to get all subarr\r\n i = 1\r\n while i < list.length #loop to create subarr\r\n if current_sum < 0\r\n current_sum = 0\r\n end \r\n current_sum += list[i]\r\n if current_sum > largest_sum\r\n largest_sum = current_sum\r\n end\r\n i += 1\r\n end\r\n largest_sum\r\n end",
"def largest_continguous_subsum(arr)\n largest_sum = arr.first\n current_sum = arr.first\n \n (1...arr.length).each do |i|\n current_sum += arr[i]\n if current_sum > largest_sum\n largest_sum = current_sum\n elsif current_sum < 0\n current_sum = 0\n end\n end\n largest_sum\nend",
"def better_contig_subsum(arr)\n max_sum = arr.inject(&:+) # O(n)\n temp_sum = max_sum\n\n loop do # O(n)\n left = temp_sum - arr.first\n right = temp_sum - arr.last\n\n if arr.length == 1\n if arr.first > max_sum\n return arr.first\n else\n return max_sum\n end\n end\n\n if right >= left\n max_sum = right if right >= max_sum\n temp_sum = right\n arr.pop\n else\n max_sum = left if left >= max_sum\n temp_sum = left\n arr.shift\n end\n end\n\n max_sum\nend",
"def largest_contiguous_subsum_1(arr)\n res = []\n i = 0\n while i < arr.length\n j = i\n while j < arr.length\n res << arr[i..j].reduce(:+)\n j += 1\n end\n i += 1\n end\n res.max\nend",
"def sub_sum_improved(array)\n max = array[0]\n current_sum = array[0]\n i = 0\n (1...array.length).each do |i|\n max = [array[i], array[i] + max].max\n current_sum = [current_sum, max].max\n end\n current_sum\n end",
"def num_of_sums(num, list)\n # => divide and conquer\n helper(num, list, 0)\nend",
"def solution(coins, sum)\n sums = Hash.new\n sums[0] = 0\n\n (1..sum).each do |s|\n counts = Array.new\n\n coins.each do |c|\n next if c > s\n counts << sums[s-c] + 1 if !sums[s-c].nil?\n end\n\n sums[s] = counts.min\n end\n sums[sum]\nend",
"def largest_contiguous_subsum(array)\n arr = []\n (0...array.length).each do |i|\n (i + 1...array.length).each do |j|\n arr << array[i] + array[j] \n end\n end\n arr.max\n \nend",
"def largest_contig_subsum(nums)\n max = nil\n nums.each_with_index do |num, i|\n j = i\n while j < nums.length\n if !max || nums[i..j].sum > max\n max = nums[i..j].sum\n end\n j += 1\n end\n end\n max\nend",
"def largest_contiguous_subsum(arr)\n sum = 0\n arr_indices = []\n running_sums = []\n arr.each_with_index do |num,idx|\n sum += num \n arr_indices << idx \n running_sums << sum\n end \n running_sums.max\n\nend",
"def find_n_that_total(all, total, n)\n all.combination(n).each do |combo|\n if combo.sum == total\n # p combo\n return combo\n end\n end\nend",
"def largest_contiguous_subsum2(list)\n sum = 0 # keeps track of current sum\n largest_sum = list.first # evaluates to the largest sum\n list.each do |ele|\n sum += ele \n largest_sum = sum if sum > largest_sum\n sum = 0 if sum < 0\n end\n largest_sum\nend",
"def largest_contiguous_subsum(array)\n current_sum = array.first\n largest_sum = array.first\n array.each do |num|\n current_sum += num\n if largest_sum < current_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend",
"def subset_sum(arr)\n max_so_far = 0\n max_ending_here = 0\n\n arr.each do |el|\n max_ending_here = max_ending_here + el\n if max_ending_here < 0\n max_ending_here = 0\n end\n if max_so_far < max_ending_here\n max_so_far = max_ending_here\n end\n end\n max_so_far\nend",
"def largest_contiguous_sub_sum3(arr)\n\n largest_sum = arr.first\n current_sum = arr.first\n\n (1...arr.length).each do |index|\n current_num = arr[index]\n prev_num = arr[index-1]\n\n if largest_sum < current_num\n largest_sum = current_num\n end\n\n current_sum = current_sum + current_num\n prev_sum = prev_num + current_num\n\n if prev_sum > current_sum\n current_sum = prev_sum\n end\n\n if largest_sum < current_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend",
"def divisibleSumPairs(n, k, ar)\n combinations = ar.combination(2).to_a.count{ |pair| pair.reduce(:+) % k == 0 }\nend",
"def findLongestSubarrayBySum(s, arr)\n history = {0 => -1} \n sum = 0 \n max_length = 0 \n result = [-1]\n\n for idx in 0...arr.length \n sum += arr[idx]\n history[sum] = idx if history[sum].nil? \n\n if history[sum - s]\n length = idx - history[sum - s]\n if length > max_length \n max_length = length \n result = [history[sum - s]+2, idx+1]\n end \n end \n end \n\n result\nend",
"def largest_contiguous_subsum_one(list)\n sub_arr = []\n sum = 0\n list.each_with_index do |ele, i|\n (i...list.length).each do |i2|\n sub_arr << list[i..i2]\n end\n end\n sub_arr.each do |arr|\n if arr.sum > sum\n sum = arr.sum\n end\n end\n sum\nend",
"def sum_of_sums(array)\n new_array = []\n array.size.times do |n|\n new_array << array[0..n]\n end\n new_array.flatten.reduce(:+)\nend",
"def largest_contiguous_subsum_2(arr)\n sum = 0\n max = 0\n arr.each do |num|\n sum += num\n if sum > 0\n max = sum if sum > max\n else\n sum = 0\n end\n end\n max\nend",
"def largest_contiguous_subsum_1(arr)\n largest = []\n (0...arr.length).each do |i|\n (i...arr.length).each do |j|\n largest << arr[i..j]\n end\n end\n sums = largest.map do |sub_array|\n sub_array.sum\n end\n sums.max\nend",
"def largest_contiguous_subsum(list)\n prev_max = -9999999999999\n new_max = 0\n list.each do |ele|\n new_max += ele\n prev_max = new_max if prev_max <= new_max\n new_max = 0 if new_max < 0 # Reset\n end\n prev_max\nend",
"def bad_contig_subsum(arr)\n # n! || n^3 ?\n sub_arrays = []\n arr.each_index do |i|\n (i...arr.length).each do |j|\n sub_arrays << arr[i..j]\n end\n end\n\n # above * n^2 ? << bottleneck\n max = sub_arrays.first.inject(&:+)\n sub_arrays.each do |sub_arr|\n sub_sum = sub_arr.inject(&:+)\n max = sub_sum if sub_sum > max\n end\n max\nend",
"def largest_contiguous_subsum(list)\n new_arr = []\n\n (0...list.length).each do |idx1| #O(n)\n (0...list.length).each do |idx2| #O(n)\n if idx2 >= idx1 #O(1)\n new_arr << list[idx1..idx2].sum #O(1)\n end \n end \n \n end \n \n return new_arr.max #O(n)\nend",
"def sub_sum(list)\n sums = []\n low = -1\n high_subsum = nil\n lowest = nil\n \n \n list.each_index do |j|\n sums << (sums.empty? || j == low + 1 ? list[j] : sums.last + list[j] )\n\n if sums.last < 0\n low = j\n end\n \n lowest = j if lowest.nil? || sums[lowest] > sums[low]\n high_subsum = j if high_subsum.nil? || sums.last > sums[high_subsum]\n\n end\n list[lowest + 1..high_subsum].reduce(:+)\nend",
"def largest_contiguous_subsum(list)\n new_arr = []\n (0...list.length - 1).each do |i|\n (i...list.length).each do |j|\n new_arr << list[i..j]\n end\n end\n new_arr.map { |sub_arr| sub_arr.sum }.max\nend"
] |
[
"0.7468959",
"0.7172587",
"0.69921464",
"0.69749784",
"0.6932818",
"0.6928678",
"0.69280535",
"0.6919228",
"0.6911607",
"0.68701476",
"0.6828545",
"0.6805712",
"0.67969435",
"0.6783915",
"0.6778088",
"0.67545545",
"0.67083067",
"0.67000294",
"0.6678229",
"0.66722536",
"0.6669143",
"0.6668809",
"0.6666053",
"0.66658235",
"0.6661616",
"0.6642494",
"0.66421884",
"0.6625779",
"0.6624376",
"0.6612861",
"0.6609706",
"0.6608765",
"0.66083866",
"0.6605018",
"0.6574485",
"0.65729624",
"0.6571417",
"0.6560418",
"0.6556653",
"0.65538514",
"0.6542702",
"0.6535784",
"0.65180904",
"0.65117097",
"0.651026",
"0.64917123",
"0.6489041",
"0.64829904",
"0.6476952",
"0.6473579",
"0.6471846",
"0.6469133",
"0.6466285",
"0.6461534",
"0.6458668",
"0.6453176",
"0.6452555",
"0.64499253",
"0.64455867",
"0.6441348",
"0.6440977",
"0.643847",
"0.64363325",
"0.6430447",
"0.64297515",
"0.6429487",
"0.64293027",
"0.6427035",
"0.642636",
"0.64225763",
"0.6421669",
"0.6419308",
"0.6408856",
"0.6408355",
"0.64040005",
"0.6401405",
"0.63875896",
"0.6386465",
"0.6383085",
"0.63819486",
"0.6379949",
"0.6378881",
"0.63770574",
"0.63736457",
"0.6372048",
"0.63694173",
"0.63658947",
"0.63576823",
"0.63548577",
"0.63545483",
"0.6347353",
"0.63469124",
"0.63457507",
"0.6344617",
"0.6344326",
"0.6342215",
"0.6339775",
"0.633875",
"0.6336289",
"0.6334736"
] |
0.6524383
|
42
|
GET /run_types GET /run_types.json
|
def index
@run_types = RunType.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @run_types = RunType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @run_types }\n end\n end",
"def show\n @run_type = RunType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @run_type }\n end\n end",
"def new\n @run = Run.new \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @run }\n format.json { render json: @run_types}\n end\n end",
"def cmd_types argv\n setup argv\n response = @api.types\n msg response\n return response\n end",
"def index\n @run_types = RunType.all.order_by_name\n @active_run_types = @run_types.active_run_types\n @removed_run_types = @run_types.removed_run_types\n end",
"def ride_types(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:ride_types),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def evals_types\n call_path = \"evals/types\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"def index\n render json: usage(params[:type])\n end",
"def buildtypes\n response = get('buildTypes')\n response['buildType']\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def index\n @task_types = TaskType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_types }\n end\n end",
"def run_list\n json[:run_list]\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def set_run_type\n @run_type = RunType.find(params[:id])\n end",
"def set_run_type\n @run_type = RunType.find(params[:id])\n end",
"def index\n @am_run_observation_types = AmRunObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @am_run_observation_types }\n end\n end",
"def types\n configuration[:types]\n end",
"def new\n @run_type = RunType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @run_type }\n end\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def index\n @runs = Run.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @runs }\n end\n end",
"def type\n @json['type']\n end",
"def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end",
"def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end",
"def test_ListPlatformTypes\n\t\tcolName = 'types'\n\t\tretClass = LeanTesting::PlatformType\n\t\tresp = rcol(colName, ['_id', 'name'])\n\t\t@client.debugReturn = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = @client.platform.types.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def index\n @task_types = @project.task_types\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @task_types }\n end\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def types\n @types ||= []\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def run_type_params\n params.require(:run_type).permit(:type, :active)\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n @types = Type.all\n end",
"def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end",
"def type\n response[\"type\"]\n end",
"def type\n response[\"type\"]\n end",
"def run_type_params\n params.require(:run_type).permit(:name, :hex_code, :active, :default)\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end",
"def types()\n\t\t@pokemon_types = []\n\t\t@pokemon_api[\"types\"].each do |i|\n\t\t\t@pokemon_types.push(i[\"type\"][\"name\"].capitalize)\n\t\tend\n\t\treturn @pokemon_types\n\tend",
"def types\n commit('types', nil)\n end",
"def type\r\n\t\t\t`#{BITS::BITSADMIN} /gettype {#{@id}}`\r\n\t\tend",
"def list_possible_type_ids\n\tissuetypes = @client.Issuetype.all\n\tissuetypes.each do |issue|\n\t\tputs \"#{issue.id}\\t#{issue.name}\"\n\tend\nend",
"def lookup(type)\n @resource_types[type] || []\n end",
"def create\n @run_type = RunType.new(run_type_params)\n\n respond_to do |format|\n if @run_type.save\n format.html { redirect_to @run_type, notice: 'Run type was successfully created.' }\n format.json { render :show, status: :created, location: @run_type }\n else\n format.html { render :new }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type\n @json_body['type']\n end",
"def get_available_types_from_usage(usage)\n # TODO: Research use\n @client.raw('get', \"/helpers/available-types/#{usage}\")\n end",
"def index\n @timerecord_types = TimerecordType.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timerecord_types }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def platform_types\n get(\"platform-types\")[\"types\"]\n end",
"def create\n @run_type = RunType.new(params[:run_type])\n\n respond_to do |format|\n if @run_type.save\n format.html { redirect_to @run_type, notice: 'Run type was successfully created.' }\n format.json { render json: @run_type, status: :created, location: @run_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def court_types\n render json: GamePass.court_types_options\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def index\n @recipe_types = RecipeType.all\n end",
"def index\n @log_types = LogType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @log_types }\n end\n end",
"def registered_types\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def type\n @types ||= strip(:type)\n end",
"def activitytypes\n build_settings_array RubyRedtail::Query.run(\"settings/activitytypes\", @api_hash, \"GET\")\n end",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def destroy\n @run_type = RunType.find(params[:id])\n @run_type.destroy\n\n respond_to do |format|\n format.html { redirect_to run_types_url }\n format.json { head :no_content }\n end\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def type\n @activities = Activity.tagged_with_on(:types,params[:type_name]).page params[:page]\n respond_with @activities\n end",
"def show\n @runtype = Runtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @runtype }\n end\n end",
"def types\n self.singleton_class.const_get(:TYPES)\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def index\n @trtypes = Trtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trtypes }\n end\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def index\n @task_types = TaskType.pretty_list\n end",
"def index\n @recept_types = ReceptType.all\n end",
"def types\n @title = 'Resource Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_type)\n erb(:objects)\nend",
"def resulttypes(job_id)\n url=\"#{@base_url}/#{@tool}/resulttypes/#{URI.encode(job_id)}\"\n uri = URI.parse(url)\n\n resp = Net::HTTP.get_response(uri)\n \n #puts resp.body\n resulttypes = XmlSimple.xml_in(resp.body)\n puts resulttypes.inspect\n\n end",
"def index\n @call_types = CallType.all\n end",
"def list_resource_types(feed_id = nil)\n if feed_id.nil?\n ret = http_get('/resourceTypes')\n else\n the_feed = hawk_escape_id feed_id\n ret = http_get(\"/feeds/#{the_feed}/resourceTypes\")\n end\n ret.map { |rt| ResourceType.new(rt) }\n end",
"def request_type(*args)\n type\n end",
"def index\n @run_requests = RunRequest.all\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def show\n @run = Run.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @run }\n end\n end",
"def index\n @task_types = TaskType.all\n end",
"def index\n authorize! :show, PointsEntryType\n load_active_points_entry_types\n\n respond_to do |format|\n format.html\n format.json { render json: @points_entry_types }\n end\n end",
"def update\n respond_to do |format|\n if @run_type.update(run_type_params)\n format.html { redirect_to @run_type, notice: 'Run type was successfully updated.' }\n format.json { render :show, status: :ok, location: @run_type }\n else\n format.html { render :edit }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def index\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n @technotypes = Technotype.all\n\n respond_to do |format|\n format.json { render json: @technotypes, status: 200 }\n end\n end",
"def index\n @event_types = EventType.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_types }\n end\n end",
"def types\n @types ||= profile_types.pluck(:title).join(' / ').html_safe\n end",
"def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def view_types(for_select = true) # get the defined view type partials. e.g. views/views/list.html.erb\n fetch_array_for get_view_types, for_select\n end",
"def index\n @session_types = SessionType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @session_types }\n end\n end",
"def show\n @task_type = @project.task_types.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @task_type }\n end\n end"
] |
[
"0.7558277",
"0.67575896",
"0.66501176",
"0.66438615",
"0.6630948",
"0.63753474",
"0.62775445",
"0.6260427",
"0.6234029",
"0.6180226",
"0.61403346",
"0.60907465",
"0.6076732",
"0.6044926",
"0.6044163",
"0.60315347",
"0.59881127",
"0.59881127",
"0.59749556",
"0.59468913",
"0.59397674",
"0.59325546",
"0.59167475",
"0.59029007",
"0.58939767",
"0.5885606",
"0.5873176",
"0.586904",
"0.5840668",
"0.583783",
"0.5835709",
"0.5812207",
"0.58082294",
"0.5779709",
"0.57505417",
"0.57375133",
"0.5736828",
"0.57366467",
"0.57366467",
"0.5732407",
"0.57252514",
"0.5724171",
"0.57037675",
"0.5683521",
"0.567666",
"0.5648394",
"0.5647894",
"0.56461674",
"0.56398726",
"0.56393194",
"0.5617002",
"0.56149054",
"0.55794084",
"0.5561855",
"0.5558509",
"0.55517316",
"0.554257",
"0.5542339",
"0.5540124",
"0.55399585",
"0.553777",
"0.55352813",
"0.55345637",
"0.5523287",
"0.5522413",
"0.55207217",
"0.55169606",
"0.5499143",
"0.54980034",
"0.5497303",
"0.54829484",
"0.5480388",
"0.5469111",
"0.5463167",
"0.546257",
"0.5461304",
"0.545564",
"0.5444288",
"0.5438975",
"0.54353416",
"0.54259145",
"0.5424521",
"0.5424029",
"0.5420984",
"0.54201895",
"0.541558",
"0.5413814",
"0.5413814",
"0.5413814",
"0.5413814",
"0.5413814",
"0.54115564",
"0.5411275",
"0.5402132",
"0.53872365",
"0.5376897",
"0.5374697",
"0.5364188",
"0.53592825",
"0.5355185"
] |
0.74328816
|
1
|
GET /run_types/1 GET /run_types/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @run_types = RunType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @run_types }\n end\n end",
"def show\n @run_type = RunType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @run_type }\n end\n end",
"def index\n @run_types = RunType.all\n end",
"def new\n @run = Run.new \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @run }\n format.json { render json: @run_types}\n end\n end",
"def new\n @run_type = RunType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @run_type }\n end\n end",
"def set_run_type\n @run_type = RunType.find(params[:id])\n end",
"def set_run_type\n @run_type = RunType.find(params[:id])\n end",
"def index\n render json: usage(params[:type])\n end",
"def index\n @run_types = RunType.all.order_by_name\n @active_run_types = @run_types.active_run_types\n @removed_run_types = @run_types.removed_run_types\n end",
"def type\n @json['type']\n end",
"def cmd_types argv\n setup argv\n response = @api.types\n msg response\n return response\n end",
"def type\n response[\"type\"]\n end",
"def type\n response[\"type\"]\n end",
"def type\r\n\t\t\t`#{BITS::BITSADMIN} /gettype {#{@id}}`\r\n\t\tend",
"def show\n @runtype = Runtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @runtype }\n end\n end",
"def create\n @run_type = RunType.new(run_type_params)\n\n respond_to do |format|\n if @run_type.save\n format.html { redirect_to @run_type, notice: 'Run type was successfully created.' }\n format.json { render :show, status: :created, location: @run_type }\n else\n format.html { render :new }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @run = Run.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @run }\n end\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def create\n @run_type = RunType.new(params[:run_type])\n\n respond_to do |format|\n if @run_type.save\n format.html { redirect_to @run_type, notice: 'Run type was successfully created.' }\n format.json { render json: @run_type, status: :created, location: @run_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @run_type = RunType.find(params[:id])\n @run_type.destroy\n\n respond_to do |format|\n format.html { redirect_to run_types_url }\n format.json { head :no_content }\n end\n end",
"def type\n @json_body['type']\n end",
"def index\n @runs = Run.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @runs }\n end\n end",
"def index\n @am_run_observation_types = AmRunObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @am_run_observation_types }\n end\n end",
"def show\n @am_run_observation_type = AmRunObservationType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @am_run_observation_type }\n end\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def update\n respond_to do |format|\n if @run_type.update(run_type_params)\n format.html { redirect_to @run_type, notice: 'Run type was successfully updated.' }\n format.json { render :show, status: :ok, location: @run_type }\n else\n format.html { render :edit }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @task_type = @project.task_types.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @task_type }\n end\n end",
"def type\n types.first\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def index\n @task_types = TaskType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_types }\n end\n end",
"def find(id)\n response = RestClient.get(\"#{@type.Resource}/#{id}\")\n @type.from_json response['data']\n end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def show\n @task_type = TaskType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_type }\n end\n end",
"def index\n @task_types = @project.task_types\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @task_types }\n end\n end",
"def ride_types(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:ride_types),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end",
"def run_list\n json[:run_list]\n end",
"def type\n types.first\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def destroy\n @run_type.destroy\n respond_to do |format|\n format.html { redirect_to run_types_url, notice: 'Run type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def run_type_params\n params.require(:run_type).permit(:type, :active)\n end",
"def run_type_params\n params.require(:run_type).permit(:name, :hex_code, :active, :default)\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def type\n @activities = Activity.tagged_with_on(:types,params[:type_name]).page params[:page]\n respond_with @activities\n end",
"def index\n @types = Type.all\n end",
"def show\n @instance_type = InstanceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instance_type }\n end\n end",
"def show\n @entry_type = EntryType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry_type }\n end\n end",
"def create\n @run_type = RunType.new(run_type_params)\n\n respond_to do |format|\n if @run_type.save\n @run_type.update_default_shoe(params[:run_type][:default].to_i)\n\n format.html { redirect_to admin_run_types_path, notice: create_notice(@run_type.name) }\n format.json { render :index, status: :created, location: @run_type }\n else\n format.html { render :new }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @run_type.update(run_type_params)\n @run_type.update_default_shoe(params[:run_type][:default].to_i)\n\n format.html { redirect_to admin_run_types_path, notice: update_notice(@run_type.name) }\n format.json { render :index, status: :ok, location: @run_type }\n else\n format.html { render :edit }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_type(*args)\n type\n end",
"def show\n @tasktype = Tasktype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tasktype }\n end\n end",
"def type\n self['type']['type']\n end",
"def update\n @run_type = RunType.find(params[:id])\n\n respond_to do |format|\n if @run_type.update_attributes(params[:run_type])\n format.html { redirect_to @run_type, notice: 'Run type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def buildtypes\n response = get('buildTypes')\n response['buildType']\n end",
"def cron_get(type)\n cmd = \"{\\\"id\\\":13,\\\"method\\\":\\\"cron_get\\\",\\\"params\\\":[#{type}]}\\r\\n\"\n request(cmd)\n end",
"def type\n @payload['type']\n end",
"def show\n @type = Type.find(params[:id])\n end",
"def type\n result_hash['typ']\n end",
"def get_tray_by_type(username, type)\n $LOG.i \"running \" + __method__.to_s\n @client.get '/mc/v1/trays/' + username + '/' + type\n end",
"def index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end",
"def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end",
"def lookup(type)\n @resource_types[type] || []\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def type\n params['TYPE']\n end",
"def type\n @type ||= get_type_from_status_code(code)\n end",
"def index\n @timerecord_types = TimerecordType.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timerecord_types }\n end\n end",
"def index\n @recipe_types = RecipeType.all\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def show\n @log_type = LogType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log_type }\n end\n end",
"def evals_types\n call_path = \"evals/types\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"def destroy\n @run_type.remove_action_set_new_default\n\n respond_to do |format|\n if @run_type.save\n format.html { redirect_to admin_run_types_path, notice: remove_notice(@run_type.name) }\n format.json { render :index, status: :ok, location: @run_type }\n else\n format.html { render :edit }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type\n params[:type]\n end",
"def index\n @log_types = LogType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @log_types }\n end\n end",
"def show\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @realty_type }\n end\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def show\n @act_type = ActType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @act_type }\n end\n end",
"def type\n raw_data['type']\n end",
"def type\n @types ||= strip(:type)\n end",
"def show\n @type = Type.find(params[:id])\n @things = @type.things\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type }\n end\n end",
"def show\n\t\trender json: @run\n\tend",
"def sc_type(type, text, *params)\n __remote_control_command(\"type\", [__locator(type, *params), text, ])\n end",
"def type\n TYPES[@type_id]\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end",
"def show\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json { render json: @stat_type }\n end\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def test_ListPlatformTypes\n\t\tcolName = 'types'\n\t\tretClass = LeanTesting::PlatformType\n\t\tresp = rcol(colName, ['_id', 'name'])\n\t\t@client.debugReturn = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = @client.platform.types.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def show\n @step_type = StepType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step_type }\n end\n end",
"def type(type = nil)\n @type = type if type\n @type || name.split('::').last.gsub(/Resource$/, '').underscore\n end",
"def index\n @trtypes = Trtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trtypes }\n end\n end",
"def index\n @run_requests = RunRequest.all\n end",
"def index\n @sample_types = SampleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sample_types }\n end\n end",
"def get_scene_type(scene_type_id)\n get \"commandcenter/scenetypes/#{scene_type_id}\"\n end",
"def index\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def get_run(run_id)\n testrail_api_client.send_get(\"get_run/#{run_id}\")\n end",
"def type\n @gapi[\"type\"]\n end",
"def types\n configuration[:types]\n end"
] |
[
"0.749174",
"0.73711944",
"0.72801197",
"0.7057678",
"0.6557763",
"0.6453602",
"0.6453602",
"0.6415689",
"0.6367274",
"0.6346261",
"0.6334664",
"0.6188315",
"0.6188315",
"0.6097806",
"0.60939306",
"0.6082426",
"0.6066972",
"0.6063172",
"0.60373616",
"0.60328287",
"0.6010431",
"0.5994688",
"0.59784555",
"0.59626997",
"0.59597534",
"0.5933397",
"0.5899826",
"0.58978844",
"0.58976686",
"0.58788556",
"0.5861465",
"0.5851424",
"0.5830057",
"0.5809112",
"0.57866",
"0.57865226",
"0.5786501",
"0.57794636",
"0.57729524",
"0.57598263",
"0.574794",
"0.5728481",
"0.5725343",
"0.5717838",
"0.57091695",
"0.5704571",
"0.5701102",
"0.5673628",
"0.56731826",
"0.56542945",
"0.5649915",
"0.56456655",
"0.56450695",
"0.5638682",
"0.5637135",
"0.56031233",
"0.5598416",
"0.5597708",
"0.5592447",
"0.55843514",
"0.55745417",
"0.5562711",
"0.55540574",
"0.55509824",
"0.55388224",
"0.5528072",
"0.55277914",
"0.55248153",
"0.55198914",
"0.55196184",
"0.5516987",
"0.55160964",
"0.5512161",
"0.55105287",
"0.5507277",
"0.550178",
"0.54921275",
"0.54849035",
"0.548093",
"0.5468043",
"0.54658866",
"0.54609257",
"0.5459807",
"0.54585195",
"0.54583573",
"0.5455323",
"0.5453475",
"0.5444077",
"0.5434781",
"0.54335856",
"0.5432923",
"0.5432315",
"0.5432158",
"0.5430311",
"0.5426135",
"0.5424665",
"0.54241365",
"0.5419035",
"0.5418419",
"0.54168576",
"0.54122865"
] |
0.0
|
-1
|
POST /run_types POST /run_types.json
|
def create
@run_type = RunType.new(run_type_params)
respond_to do |format|
if @run_type.save
format.html { redirect_to @run_type, notice: 'Run type was successfully created.' }
format.json { render :show, status: :created, location: @run_type }
else
format.html { render :new }
format.json { render json: @run_type.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @run_type = RunType.new(params[:run_type])\n\n respond_to do |format|\n if @run_type.save\n format.html { redirect_to @run_type, notice: 'Run type was successfully created.' }\n format.json { render json: @run_type, status: :created, location: @run_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def run_type_params\n params.require(:run_type).permit(:name, :hex_code, :active, :default)\n end",
"def evals_types\n call_path = \"evals/types\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"def run_type_params\n params.require(:run_type).permit(:type, :active)\n end",
"def new\n @run = Run.new \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @run }\n format.json { render json: @run_types}\n end\n end",
"def create\n @run_type = RunType.new(run_type_params)\n\n respond_to do |format|\n if @run_type.save\n @run_type.update_default_shoe(params[:run_type][:default].to_i)\n\n format.html { redirect_to admin_run_types_path, notice: create_notice(@run_type.name) }\n format.json { render :index, status: :created, location: @run_type }\n else\n format.html { render :new }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @run_types = RunType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @run_types }\n end\n end",
"def index\n @run_types = RunType.all\n end",
"def run_type_params\n params.require(:run_type).permit(:name, :heartrate)\n end",
"def cmd_types argv\n setup argv\n response = @api.types\n msg response\n return response\n end",
"def set_run_type\n @run_type = RunType.find(params[:id])\n end",
"def set_run_type\n @run_type = RunType.find(params[:id])\n end",
"def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end",
"def types\n commit('types', nil)\n end",
"def create\n @runtype = Runtype.new(params[:runtype])\n\n respond_to do |format|\n if @runtype.save\n flash[:notice] = 'Runtype was successfully created.'\n format.html { redirect_to(@runtype) }\n format.xml { render :xml => @runtype, :status => :created, :location => @runtype }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @runtype.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @run_type = RunType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @run_type }\n end\n end",
"def create_break_type(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/labor/break-types',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def create_types\n\t\t[]\n\tend",
"def create_types\n\t\t[]\n\tend",
"def create_types\n\t[]\nend",
"def create_types\n\t[]\nend",
"def update\n respond_to do |format|\n if @run_type.update(run_type_params)\n format.html { redirect_to @run_type, notice: 'Run type was successfully updated.' }\n format.json { render :show, status: :ok, location: @run_type }\n else\n format.html { render :edit }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def create\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type = EntryType.new(params[:entry_type])\n @entry_type.field_type_ids = field_type_ids\n @entry_type.form_code = build_form_code(@entry_type.field_types)\n @entry_type.model_code = build_model_code(@entry_type.name, @entry_type.field_types)\n @entry_type.model = build_model_from_code(@entry_type)\n\n respond_to do |format|\n if @entry_type.save\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully created.' }\n format.json { render json: @entry_type, status: :created, location: @entry_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@run = Run.new(run_params)\n\t\t@run.user_id = @current_user.id\n\t\t\n\t\tif @run.save\n\t\t\trender json: @run, status: :created\n\t\telse\n\t\t\trender json: @run.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def destroy\n @run_type.destroy\n respond_to do |format|\n format.html { redirect_to run_types_url, notice: 'Run type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run_type = RunType.find(params[:id])\n @run_type.destroy\n\n respond_to do |format|\n format.html { redirect_to run_types_url }\n format.json { head :no_content }\n end\n end",
"def type\n @json_body['type']\n end",
"def types(types); end",
"def update\n respond_to do |format|\n if @run_type.update(run_type_params)\n @run_type.update_default_shoe(params[:run_type][:default].to_i)\n\n format.html { redirect_to admin_run_types_path, notice: update_notice(@run_type.name) }\n format.json { render :index, status: :ok, location: @run_type }\n else\n format.html { render :edit }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_map_type(map_type_body, options = {})\n path = base_uri\n request(path, options.merge(method: :post), map_type_body).to_s\n end",
"def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end",
"def create\n @prune_type = PruneType.new(prune_type_params)\n\n respond_to do |format|\n if @prune_type.save\n format.html { redirect_to @prune_type, notice: 'Prune type was successfully created.' }\n format.json { render :show, status: :created, location: @prune_type }\n else\n format.html { render :new }\n format.json { render json: @prune_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def types\n configuration[:types]\n end",
"def create_types\n\t\t[Device]\n\tend",
"def create_types\n\t\t[Device]\n\tend",
"def destroy\n @run_type.remove_action_set_new_default\n\n respond_to do |format|\n if @run_type.save\n format.html { redirect_to admin_run_types_path, notice: remove_notice(@run_type.name) }\n format.json { render :index, status: :ok, location: @run_type }\n else\n format.html { render :edit }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @am_run_observation_type = AmRunObservationType.new(params[:am_run_observation_type])\n\n respond_to do |format|\n if @am_run_observation_type.save\n format.html { redirect_to @am_run_observation_type, notice: 'Am run observation type was successfully created.' }\n format.json { render json: @am_run_observation_type, status: :created, location: @am_run_observation_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @am_run_observation_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @run = current_user.runs.new(run_params)\n\n if @run.save\n render :show, status: :created\n else\n render json: @run.errors, status: :unprocessable_entity\n end\n end",
"def sc_type(type, text, *params)\n __remote_control_command(\"type\", [__locator(type, *params), text, ])\n end",
"def boot_types\n @types = {}\n type_names.each do |name , ivars |\n @types[name] = type_for( name , ivars)\n end\n type_type = @types[:Type]\n @types.each do |name , type |\n type.set_type(type_type)\n end\n end",
"def type_params\n params.require(:type).permit( :name)\n end",
"def ride_types(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:ride_types),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end",
"def run_params\n params.require(:run).permit(:start, :duration, :runner_id, :category_id)\n end",
"def registered_types\n end",
"def add_type(type)\n end",
"def create\n @debug_run = DebugRun.new(debug_run_params)\n\n respond_to do |format|\n if @debug_run.save\n format.html { redirect_to @debug_run, notice: 'Debug run was successfully created.' }\n format.json { render :show, status: :created, location: @debug_run }\n else\n format.html { render :new }\n format.json { render json: @debug_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @run_type = RunType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @run_type }\n end\n end",
"def create\n @runstat = Runstat.new(runstat_params)\n\n respond_to do |format|\n if @runstat.save\n format.html { redirect_to @runstat, notice: 'Runstat was successfully created.' }\n format.json { render :show, status: :created, location: @runstat }\n else\n format.html { render :new }\n format.json { render json: @runstat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_ListPlatformTypes\n\t\tcolName = 'types'\n\t\tretClass = LeanTesting::PlatformType\n\t\tresp = rcol(colName, ['_id', 'name'])\n\t\t@client.debugReturn = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = @client.platform.types.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend",
"def create\n @run = Run.new(run_params)\n\n respond_to do |format|\n if @run.save\n format.html { redirect_to @run, notice: 'Run was successfully created.' }\n format.json { render :show, status: :created, location: @run }\n else\n format.html { render :new }\n format.json { render json: @run.errors, status: :unprocessable_entity }\n end\n end\n # redirect_to runs_path\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def create\n params = run_params.clone\n pass_plaintxt = params[:password]\n params[:password] = BCrypt::Password.create(params[:password])\n heroku_netrc = nil\n if params[\"heroku_netrc\"]\n heroku_netrc = params[\"heroku_netrc\"].read\n end\n params[\"heroku_netrc\"] = \"dummystring\"\n # By default run is running :)\n params[\"status_id\"] = 1\n @run = Run.new(params)\n respond_to do |format|\n if @run.save\n @docker_kickstart = DockerKickstartsController.new(@run, params[\"rundockerservers_attributes\"], pass_plaintxt, heroku_netrc)\n number_of_containers = @docker_kickstart.docker_kickstart\n set_run_status(@run[:id], number_of_containers)\n\n format.html { redirect_to @run, notice: 'Run was successfully created.' }\n format.json { render :show, status: :created, location: @run }\n else\n format.html { render :new }\n format.json { render json: @run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_type = TaskType.new(task_type_params)\n\n respond_to do |format|\n if @task_type.save\n format.html { redirect_to task_types_path, notice: 'Task type was successfully created.' }\n format.json { render :show, status: :created, location: @task_type }\n else\n format.html { render :new }\n format.json { render json: @task_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def run(*args)\n connection.execute(sanitize(*args)).tap do |res|\n res.type_map = type_map\n end\n end",
"def create\n @type = Type.new(type_params)\n\n unless @type.save\n render json: @type.errors, status: :unprocessable_entity\n end\n \n end",
"def update\n @run_type = RunType.find(params[:id])\n\n respond_to do |format|\n if @run_type.update_attributes(params[:run_type])\n format.html { redirect_to @run_type, notice: 'Run type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @realty_type = RealtyType.new(params[:realty_type])\n\n respond_to do |format|\n if @realty_type.save\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully created.' }\n format.json { render json: @realty_type, status: :created, location: @realty_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_types\n\t\t[]\n\tend",
"def update_types\n\t\t[]\n\tend",
"def type\n @json['type']\n end",
"def types\n @types ||= []\n end",
"def tf_types\n {\n Api::Type::Boolean => 'schema.TypeBool',\n Api::Type::Double => 'schema.TypeFloat',\n Api::Type::Integer => 'schema.TypeInt',\n Api::Type::String => 'schema.TypeString',\n # Anonymous string property used in array of strings.\n 'Api::Type::String' => 'schema.TypeString',\n Api::Type::Time => 'schema.TypeString',\n Api::Type::Enum => 'schema.TypeString',\n Api::Type::ResourceRef => 'schema.TypeString',\n Api::Type::NestedObject => 'schema.TypeList',\n Api::Type::Array => 'schema.TypeList',\n Api::Type::KeyValuePairs => 'schema.TypeMap',\n Api::Type::Map => 'schema.TypeSet',\n Api::Type::Fingerprint => 'schema.TypeString'\n }\n end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def enter_types(test_data)\n test_types = test_data[Org::ORG_RECORD_TYPES.name]\n test_types = [{ Org::ORG_RECORD_TYPE.name => ''}] unless test_types\n prep_fieldsets_for_test_data([fieldset(Org::ORG_RECORD_TYPES.name)], test_types)\n\n test_types.each_with_index do |test_type, index|\n wait_for_options_and_select(org_record_type_input(index), org_record_type_options(index), test_type[Org::ORG_RECORD_TYPE.name])\n end\n end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def add_type(type)\n\n # nothing to be done\n end",
"def add_type(type)\n\n # nothing to be done\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def create\n @task_type = TaskType.new(params[:task_type])\n\n respond_to do |format|\n if @task_type.save\n format.html { redirect_to @task_type, notice: 'Task type was successfully created.' }\n format.json { render json: @task_type, status: :created, location: @task_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_resource_type(feed_id, type_id, type_name)\n the_feed = hawk_escape_id feed_id\n\n type = create_blueprint\n type[:id] = type_id\n type[:name] = type_name\n\n begin\n http_post(\"/feeds/#{the_feed}/resourceTypes\", type)\n rescue HawkularException => error\n # 409 We already exist -> that is ok\n raise unless error.status_code == 409\n ensure\n the_type = hawk_escape_id type_id\n res = http_get(\"/feeds/#{the_feed}/resourceTypes/#{the_type}\")\n end\n ResourceType.new(res)\n end",
"def buildtypes\n response = get('buildTypes')\n response['buildType']\n end",
"def index\n @run_types = RunType.all.order_by_name\n @active_run_types = @run_types.active_run_types\n @removed_run_types = @run_types.removed_run_types\n end",
"def type_test_params\n params.require(:type_test).permit(:name, :instruction)\n end",
"def create\n @instance_type = InstanceType.new(params[:instance_type])\n\n respond_to do |format|\n if @instance_type.save\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully created.' }\n format.json { render json: @instance_type, status: :created, location: @instance_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @run = Run.new(run_params)\n # setting run owner to current user, if it isn't set\n @run.user_id ||= current_user.id\n respond_to do |format|\n if @run.save\n format.html { redirect_to @run, notice: 'Run was successfully created.' }\n format.json { render :show, status: :created, location: @run }\n else\n format.html { render :new }\n format.json { render json: @run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def types=(types)\n @types = Array(types) if types\n end",
"def generate_types\n pal.generate_types(cache: true)\n end",
"def type\n @payload['type']\n end",
"def create\n @recipe_type = RecipeType.new(recipe_type_params)\n\n respond_to do |format|\n if @recipe_type.save\n format.html { redirect_to @recipe_type, notice: \"Recipe type was successfully created.\" }\n format.json { render :show, status: :created, location: @recipe_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @recipe_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_types\n\t[]\nend",
"def update_types\n\t[]\nend",
"def recept_type_params\n params.require(:recept_type).permit(:name)\n end",
"def create_types\n\t[Domain]\nend",
"def create\n @method_type = MethodType.new(method_type_params)\n\n respond_to do |format|\n if @method_type.save\n format.html { redirect_to @method_type, notice: \"Method type was successfully created.\" }\n format.json { render :show, status: :created, location: @method_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @method_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_params\n params.require(:type).permit(:name)\n end",
"def create\n @test_run = TestRun.new(params[:test_run])\n\n respond_to do |format|\n if @test_run.save\n format.html { redirect_to @test_run, notice: 'Test run was successfully created.' }\n format.json { render json: @test_run, status: :created, location: @test_run }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type = Type.new(type_params)\n @sub_types = params[:subtype_attributes]\n if @type.save\n @sub_types.each do |subtype|\n @subtype = @type.subtype.new\n @subtype.name = subtype[\"name\"]\n @subtype.code = subtype[\"code\"]\n @subtype.save\n end\n flash[:notice] = 'Type was successfully created.'\n redirect_to types_path\n else\n flash[:error] = @type.errors.full_messages\n render \"new\"\n end\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def run_params\n params.require(:run).permit(:name, :completed_run, :planned_mileage, :mileage_total, :start_time, :pace_minutes, :pace_seconds, :hours, :minutes, :seconds, :elevation_gain, :city, :notes, :personal_best, :shoe_id, :state_id, :country_id, :run_type_id)\n end",
"def create\n @spec_type = SpecType.new(spec_type_params)\n\n respond_to do |format|\n if @spec_type.save\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully created.' }\n format.json { render :show, status: :created, location: @spec_type }\n else\n format.html { render :new }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def downtime_type_params\n params.require(:downtime_type).permit(:nr, :name, :description)\n end",
"def request_type(*args)\n type\n end",
"def index\n render json: usage(params[:type])\n end",
"def create\n @type_test = TypeTest.new(type_test_params)\n\n respond_to do |format|\n if @type_test.save\n format.html { redirect_to @type_test, notice: 'Type test was successfully created.' }\n format.json { render :show, status: :created, location: @type_test }\n else\n format.html { render :new }\n format.json { render json: @type_test.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6818408",
"0.679146",
"0.6748303",
"0.6630122",
"0.6617919",
"0.64316225",
"0.62767184",
"0.6260892",
"0.6205599",
"0.61164045",
"0.6111814",
"0.6111814",
"0.6069159",
"0.6016958",
"0.5966407",
"0.5964771",
"0.5902644",
"0.5824565",
"0.5824565",
"0.5823609",
"0.5823609",
"0.56342036",
"0.55973566",
"0.5578736",
"0.55089873",
"0.5488258",
"0.54701614",
"0.5466103",
"0.545859",
"0.5430784",
"0.542371",
"0.5406196",
"0.5398124",
"0.5393712",
"0.53765637",
"0.5372017",
"0.5372017",
"0.53531617",
"0.53469723",
"0.5304189",
"0.52965385",
"0.5292484",
"0.52917695",
"0.52908415",
"0.52846664",
"0.52843714",
"0.52784324",
"0.5276839",
"0.5267587",
"0.52615297",
"0.525867",
"0.52372223",
"0.5219722",
"0.5218022",
"0.5215263",
"0.52133054",
"0.5203174",
"0.51982653",
"0.5193515",
"0.51934195",
"0.51934195",
"0.5192734",
"0.5186325",
"0.5177277",
"0.51718104",
"0.51718104",
"0.51718104",
"0.51718104",
"0.51718104",
"0.51657015",
"0.51604843",
"0.5145317",
"0.5145317",
"0.5142281",
"0.51403695",
"0.51389813",
"0.51386684",
"0.51357675",
"0.5134427",
"0.51339954",
"0.51322925",
"0.51294786",
"0.5128805",
"0.5124422",
"0.51216984",
"0.51104164",
"0.51104164",
"0.5097701",
"0.50895214",
"0.50868255",
"0.5085759",
"0.5085323",
"0.5084812",
"0.5082681",
"0.5072857",
"0.5069244",
"0.50645345",
"0.5063005",
"0.506128",
"0.5057207"
] |
0.6901437
|
0
|
PATCH/PUT /run_types/1 PATCH/PUT /run_types/1.json
|
def update
respond_to do |format|
if @run_type.update(run_type_params)
format.html { redirect_to @run_type, notice: 'Run type was successfully updated.' }
format.json { render :show, status: :ok, location: @run_type }
else
format.html { render :edit }
format.json { render json: @run_type.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @run_type = RunType.find(params[:id])\n\n respond_to do |format|\n if @run_type.update_attributes(params[:run_type])\n format.html { redirect_to @run_type, notice: 'Run type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @run_type.update(run_type_params)\n @run_type.update_default_shoe(params[:run_type][:default].to_i)\n\n format.html { redirect_to admin_run_types_path, notice: update_notice(@run_type.name) }\n format.json { render :index, status: :ok, location: @run_type }\n else\n format.html { render :edit }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @runtype = Runtype.find(params[:id])\n\n respond_to do |format|\n if @runtype.update_attributes(params[:runtype])\n flash[:notice] = 'Runtype was successfully updated.'\n format.html { redirect_to(@runtype) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @runtype.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_break_type(id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/labor/break-types/{id}',\n 'default')\n .template_param(new_parameter(id, key: 'id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def change_type\n\t\t\trender json: User.update_type_by_id(params[:id], params[:type], params[:is])\n\t\tend",
"def update\n respond_to do |format|\n if @run.update(run_params)\n format.html { redirect_to @run, notice: 'Run was successfully updated.' }\n format.json { render :show, status: :ok, location: @run }\n else\n format.html { render :edit }\n format.json { render json: @run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @run.update(run_params)\n format.html { redirect_to @run, notice: 'Run was successfully updated.' }\n format.json { render :show, status: :ok, location: @run }\n else\n format.html { render :edit }\n format.json { render json: @run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @run.update(run_params)\n format.html { redirect_to @run, notice: 'Run was successfully updated.' }\n format.json { render :show, status: :ok, location: @run }\n else\n format.html { render :edit }\n format.json { render json: @run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description]\n st.save\n st.save_field_types raw[:field_types]\n\n render json: { sample_type: st }\n\n end",
"def update\n @am_run_observation_type = AmRunObservationType.find(params[:id])\n\n respond_to do |format|\n if @am_run_observation_type.update_attributes(params[:am_run_observation_type])\n format.html { redirect_to @am_run_observation_type, notice: 'Am run observation type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @am_run_observation_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spec_type.update(spec_type_params)\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully updated.' }\n format.json { render :show, status: :ok, location: @spec_type }\n else\n format.html { render :edit }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tif @run == nil\n\t\t\trender json: \"Not Found\", status: :not_found\n\t\telse\n\t\t\tif @run.update(run_params)\n\t\t\t\trender json: @run, status: :ok\n\t\t\telse\n\t\t\t\trender json: @run.errors, status: :unprocessable_entity\n\t\t\tend\n\t\tend\n\tend",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n @entry_type = EntryType.find(params[:id])\n\n respond_to do |format|\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type.field_type_ids = field_type_ids if field_type_ids\n params[:entry_type].delete(\"form_code\")\n if @entry_type.update_attributes(params[:entry_type])\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @run = Run.find(params[:id])\n\n respond_to do |format|\n if @run.update_attributes(params[:run])\n format.html { redirect_to @run, :notice => 'Run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @run.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @run = Run.find(params[:id])\n\n respond_to do |format|\n if @run.update_attributes(params[:run])\n format.html { redirect_to @run, notice: 'Run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n if @realty_type.update_attributes(params[:realty_type])\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_run_type\n @run_type = RunType.find(params[:id])\n end",
"def set_run_type\n @run_type = RunType.find(params[:id])\n end",
"def update\n @type.update(type_params)\n end",
"def update\n respond_to do |format|\n if @instance_type.update(instance_type_params)\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_type.update(task_type_params)\n format.html { redirect_to task_types_path, notice: 'Task type was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_type }\n else\n format.html { render :edit }\n format.json { render json: @task_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n end",
"def update\n @act_type = ActType.find(params[:id])\n\n respond_to do |format|\n if @act_type.update_attributes(params[:act_type])\n format.html { redirect_to @act_type, notice: 'Данные типа документа успешно обновлены.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @act_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(name, type, options = {})\n Utils.stringify_keys!(options)\n path = \"/projects/#{project.name}/resources/#{name}\"\n\n headers = build_create_base_headers(name, type, options)\n body = build_create_base_body(options)\n\n !!client.put(path, headers: headers, body: body)\n end",
"def update\n respond_to do |format|\n if @workflow_type.update(workflow_type_params)\n format.html { redirect_to @workflow_type, notice: 'Workflow type was successfully updated.' }\n format.json { render :show, status: :ok, location: @workflow_type }\n else\n format.html { render :edit }\n format.json { render json: @workflow_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task_type = TaskType.find(params[:id])\n\n respond_to do |format|\n if @task_type.update_attributes(params[:task_type])\n format.html { redirect_to @task_type, notice: 'Task type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n params_obj = ::RunParams.new(group_run_params)\n if @group_run.update(params_obj.model_attrs)\n @group_run.runs.update_all(params_obj.model_attrs.except(:start_date, :start_time))\n format.html { redirect_to @group_run, notice: I18n.t('group_runs.updated') }\n format.json { render :show, status: :ok, location: @group_run }\n else\n format.html { render :edit }\n format.json { render json: @group_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @instance_type = InstanceType.find(params[:id])\n\n respond_to do |format|\n if @instance_type.update_attributes(params[:instance_type])\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def run_type_params\n params.require(:run_type).permit(:type, :active)\n end",
"def update\n respond_to do |format|\n if @run.update(run_params)\n format.html { redirect_to companies_path, notice: 'Run was successfully updated.' }\n format.json { render companies_path, status: :ok, location: @run }\n else\n #binding.pry\n format.html { render :edit }\n format.json { render json: @run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n @id = args[:id] if args.key?(:id)\n end",
"def update\n @trait_type = TraitType.find(params[:id])\n\n if @trait_type.update(trait_type_params)\n head :no_content\n else\n render json: @trait_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @recipe_type.update(recipe_type_params)\n format.html { redirect_to @recipe_type, notice: \"Recipe type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recipe_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recipe_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_issue_type(project_id_or_key, type_id, params = {})\n patch(\"projects/#{project_id_or_key}/issueTypes/#{type_id}\", params)\n end",
"def update\n respond_to do |format|\n if @api_v1_admin_type.update(api_v1_admin_type_params)\n format.html { redirect_to @api_v1_admin_type, notice: 'Admin type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_admin_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_admin_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reform_type = ReformType.find(params[:id])\n\n respond_to do |format|\n if @reform_type.update_attributes(params[:reform_type])\n format.html { redirect_to @reform_type, notice: 'Reform type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reform_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @use_type.update(use_type_params)\n format.html { redirect_to @use_type, notice: 'Use type was successfully updated.' }\n format.json { render :show, status: :ok, location: @use_type }\n else\n format.html { render :edit }\n format.json { render json: @use_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @issue_type.update(issue_type_params)\n format.html { redirect_to @issue_type, notice: 'Issue type was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue_type }\n else\n format.html { render :edit }\n format.json { render json: @issue_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @step_type = StepType.find(params[:id])\n\n respond_to do |format|\n if @step_type.update_attributes(params[:step_type])\n format.html { redirect_to @step_type, notice: 'Step type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @jobtype = Jobtype.find(params[:id])\n\n if @jobtype.update_attributes(params[:unit])\n render_json \"success\"\n else\n render_error \"failure\"\n end\n end",
"def update\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n if @crate_type.update_attributes(params[:crate_type])\n format.html { redirect_to @crate_type, :notice => 'Crate type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @crate_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shuttle_run.update(shuttle_run_params)\n format.html { redirect_to @shuttle_run, notice: 'Shuttle run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shuttle_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @default_task_type.update(default_task_type_params)\n format.html { redirect_to @default_task_type, notice: 'Default task type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @default_task_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @method_type.update(method_type_params)\n format.html { redirect_to @method_type, notice: \"Method type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @method_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @method_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @worktype.update(worktype_params)\n format.html { redirect_to worktypes_path, notice: 'Worktype was successfully updated.' }\n format.json { render :show, status: :ok, location: @worktype }\n else\n format.html { render :edit }\n format.json { render json: @worktype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"def run_type_params\n params.require(:run_type).permit(:name, :hex_code, :active, :default)\n end",
"def update\n respond_to do |format|\n if @api_v1_user_type.update(api_v1_user_type_params)\n format.html { redirect_to @api_v1_user_type, notice: 'User type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_user_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_user_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(type, _objects, _options = {})\n raise UndefinedUpdateStrategy, type\n end",
"def update\n respond_to do |format|\n if @box_request_abuse_type.update(box_request_abuse_type_params)\n format.html { redirect_to @box_request_abuse_type, notice: 'Box request abuse type was successfully updated.' }\n format.json { render :show, status: :ok, location: @box_request_abuse_type }\n else\n format.html { render :edit }\n format.json { render json: @box_request_abuse_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testtype.update(testtype_params)\n format.html { redirect_to @testtype, notice: 'Testtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call_type.update(call_type_params)\n format.html { redirect_to @call_type, notice: 'Call type was successfully updated.' }\n format.json { render :show, status: :ok, location: @call_type }\n else\n format.html { render :edit }\n format.json { render json: @call_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @roof_type.update(roof_type_params)\n format.html { redirect_to roof_types_path, notice: 'Roof type was successfully updated.' }\n format.json { render :show, status: :ok, location: @roof_type }\n else\n format.html { render :edit }\n format.json { render json: @roof_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @run_type = RunType.new(run_type_params)\n\n respond_to do |format|\n if @run_type.save\n @run_type.update_default_shoe(params[:run_type][:default].to_i)\n\n format.html { redirect_to admin_run_types_path, notice: create_notice(@run_type.name) }\n format.json { render :index, status: :created, location: @run_type }\n else\n format.html { render :new }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lift_type.update(lift_type_params)\n format.html {redirect_to lift_types_path, notice: 'Lift type was successfully updated.'}\n format.json {render :show, status: :ok, location: @lift_type}\n else\n format.html {render :edit}\n format.json {render json: @lift_type.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n respond_to do |format|\n if @yarn_type.update(yarn_type_params)\n format.html { redirect_to @yarn_type, notice: 'Yarn type was successfully updated.' }\n format.json { render :show, status: :ok, location: @yarn_type }\n else\n format.html { render :edit }\n format.json { render json: @yarn_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @model_type.update(model_type_params)\n format.html { redirect_to @model_type, notice: 'Model type was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_type }\n else\n format.html { render :edit }\n format.json { render json: @model_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _update type, id, body\n @elasticsupport.client.update index: _index_for(type), type: type.to_s, id: id, body: body\n end",
"def update!(**args)\n @failure_type = args[:failure_type] if args.key?(:failure_type)\n end",
"def update\n respond_to do |format|\n if @type_test.update(type_test_params)\n format.html { redirect_to @type_test, notice: 'Type test was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_test }\n else\n format.html { render :edit }\n format.json { render json: @type_test.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.71815574",
"0.6975401",
"0.632426",
"0.628634",
"0.6165148",
"0.6105321",
"0.6105321",
"0.610498",
"0.61010486",
"0.608783",
"0.60799575",
"0.6071219",
"0.6069354",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6068691",
"0.6048331",
"0.6022089",
"0.60162556",
"0.6014592",
"0.60032517",
"0.60032517",
"0.5951132",
"0.5943463",
"0.59314257",
"0.59300005",
"0.5920315",
"0.5895026",
"0.5878261",
"0.5853633",
"0.5841352",
"0.5838598",
"0.58193916",
"0.58037573",
"0.5802806",
"0.57990587",
"0.5792254",
"0.57882917",
"0.577234",
"0.5767544",
"0.5753411",
"0.5747723",
"0.5746286",
"0.57431734",
"0.57333946",
"0.57323724",
"0.5717992",
"0.5717129",
"0.57161105",
"0.57147145",
"0.57125825",
"0.57107836",
"0.5710119",
"0.5709666",
"0.56860375",
"0.5678118",
"0.5676956",
"0.56763566",
"0.56712747",
"0.56695026",
"0.566628",
"0.5664602",
"0.56619716",
"0.56601626"
] |
0.72308123
|
0
|
DELETE /run_types/1 DELETE /run_types/1.json
|
def destroy
@run_type.destroy
respond_to do |format|
format.html { redirect_to run_types_url, notice: 'Run type was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @run_type = RunType.find(params[:id])\n @run_type.destroy\n\n respond_to do |format|\n format.html { redirect_to run_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run_type.remove_action_set_new_default\n\n respond_to do |format|\n if @run_type.save\n format.html { redirect_to admin_run_types_path, notice: remove_notice(@run_type.name) }\n format.json { render :index, status: :ok, location: @run_type }\n else\n format.html { render :edit }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @runtype = Runtype.find(params[:id])\n @runtype.destroy\n\n respond_to do |format|\n format.html { redirect_to(runtypes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @am_run_observation_type = AmRunObservationType.find(params[:id])\n @am_run_observation_type.destroy\n\n respond_to do |format|\n format.html { redirect_to am_run_observation_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end",
"def cron_del(type)\n cmd = \"{\\\"id\\\":14,\\\"method\\\":\\\"cron_del\\\",\\\"params\\\":[#{type}]}\\r\\n\"\n request(cmd)\n end",
"def destroy\n @run = Run.find(params[:id])\n @run.status = \"deleted\"\n @run.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end",
"def destroy\n @testtype.destroy\n respond_to do |format|\n format.html { redirect_to testtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref_diagnostic_test_type = Ref::DiagnosticTestType.find(params[:id])\n @ref_diagnostic_test_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_diagnostic_test_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @api_v1_admin_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_admin_types_url, notice: 'Admin type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @act_type = ActType.find(params[:id])\n @act_type.destroy\n\n respond_to do |format|\n format.html { redirect_to act_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n FileUtils.rm_rf(File.join(ENV['OPENSHIFT_DATA_DIR'], @run[:id].to_s))\n\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to realty_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry_type = EntryType.find(params[:id])\n @entry_type.destroy\n\n respond_to do |format|\n format.html { redirect_to entry_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @step_type = StepType.find(params[:id])\n @step_type.destroy\n\n respond_to do |format|\n format.html { redirect_to step_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate_type = CrateType.find(params[:id])\n @crate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to crate_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @addtype.destroy\n respond_to do |format|\n format.html { redirect_to addtypes_url, notice: '变动方式删除成功!.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tasktype = Tasktype.find(params[:id])\n @tasktype.destroy\n\n respond_to do |format|\n format.html { redirect_to tasktypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dash_type = DashType.find(params[:id])\n @dash_type.destroy\n\n respond_to do |format|\n format.html { redirect_to dash_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_type = SampleType.find(params[:id])\n @sample_type.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @instance_type.destroy\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_user_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_user_types_url, notice: 'User type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @instance_type = InstanceType.find(params[:id])\n @instance_type.destroy\n\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prune_type.destroy\n respond_to do |format|\n format.html { redirect_to prune_types_url, notice: 'Prune type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reform_type = ReformType.find(params[:id])\n @reform_type.destroy\n\n respond_to do |format|\n format.html { redirect_to reform_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_type = TaskType.find(params[:id])\n @task_type.destroy\n\n respond_to do |format|\n format.html { redirect_to task_types_url }\n format.json { head :no_content }\n end\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def destroy\n @shape_type = ShapeType.find(params[:id])\n @shape_type.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.shape_type'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_shape_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @recept_type.destroy\n respond_to do |format|\n format.html { redirect_to recept_types_url, notice: 'Recept type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @log_type = LogType.find(params[:id])\n @log_type.destroy\n\n respond_to do |format|\n format.html { redirect_to log_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @downtime_type.destroy\n respond_to do |format|\n format.html { redirect_to downtime_types_url, notice: '成功删除.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @yarn_type.destroy\n respond_to do |format|\n format.html { redirect_to yarn_types_url, notice: 'Yarn type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_task_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_type = ActivityType.find(params[:id])\n @activity_type.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n head 200\n end",
"def destroy\n @spec_type.destroy\n respond_to do |format|\n format.html { redirect_to spec_types_url, notice: 'Spec type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @affected_type.destroy\n respond_to do |format|\n format.html { redirect_to affected_types_url, notice: 'Affected type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @girltype = Girltype.find(params[:id])\n @girltype.destroy\n\n respond_to do |format|\n format.html { redirect_to girltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref_med_diagnostic_test_type = Ref::MedDiagnosticTestType.find(params[:id])\n @ref_med_diagnostic_test_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_med_diagnostic_test_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @structure_type = StructureType.find(params[:id])\n @structure_type.destroy\n\n respond_to do |format|\n format.html { redirect_to structure_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tariff_type = TariffType.find(params[:id])\n @tariff_type.destroy\n\n respond_to do |format|\n format.html { redirect_to tariff_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @default_task_type.destroy\n respond_to do |format|\n format.html { redirect_to default_task_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rtype = Rtype.find(params[:id])\n @rtype.destroy\n\n respond_to do |format|\n format.html { redirect_to(rtypes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n asset_type = AssetType.find(params[:id])\n asset_type.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_types_url }\n format.json { head :no_content }\n end\n end",
"def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend",
"def destroy\n @type_test.destroy\n respond_to do |format|\n format.html { redirect_to type_tests_url, notice: 'Type test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_type.destroy\n respond_to do |format|\n format.html { redirect_to task_types_url, notice: 'Task type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manifestation_type = ManifestationType.find(params[:id])\n @manifestation_type.destroy\n\n respond_to do |format|\n format.html { redirect_to manifestation_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gl_type = GlType.find(params[:id])\n @gl_type.destroy\n\n respond_to do |format|\n format.html { redirect_to gl_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flow_type.destroy\n respond_to do |format|\n format.html { redirect_to flow_types_url, notice: 'Flow type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run = TestRun.find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @workflow_type.destroy\n respond_to do |format|\n format.html { redirect_to workflow_types_url, notice: 'Workflow type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @use_type.destroy\n respond_to do |format|\n format.html { redirect_to use_types_url, notice: 'Use type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @benchmark_type = BenchmarkType.find(params[:id])\n @benchmark_type.destroy\n\n respond_to do |format|\n format.html { redirect_to benchmark_types_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def destroy\n @debug_run.destroy\n respond_to do |format|\n format.html { redirect_to debug_runs_url, notice: 'Debug run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cdist_type = CdistType.find(params[:id])\n @cdist_type.destroy\n\n respond_to do |format|\n format.html { redirect_to cdist_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @az_simple_data_type = AzSimpleDataType.find(params[:id])\n @az_simple_data_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_simple_data_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sample_type.destroy\n respond_to do |format|\n format.html { redirect_to sample_types_url, notice: \"Sample type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brew_type.destroy\n respond_to do |format|\n format.html { redirect_to brew_types_url, notice: 'Brew type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_type = OsType.find(params[:id])\n @os_type.destroy\n\n respond_to do |format|\n format.html { redirect_to os_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metric_type = MetricType.find(params[:id])\n @metric_type.destroy\n\n respond_to do |format|\n format.html { redirect_to metric_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @segment_type = SegmentType.find(params[:id])\n @segment_type.destroy\n\n respond_to do |format|\n format.html { redirect_to segment_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_type.destroy\n respond_to do |format|\n format.html { redirect_to base_project_types_url, notice: 'Base project type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coverage_type.destroy\n respond_to do |format|\n format.html { redirect_to coverage_types_url, notice: 'Coverage type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(realty_types_url) }\n format.xml { head :ok }\n end\n end",
"def delete(session, id)\n write_task('rvpe.vmtype.delete', session, true) do\n type = VMType.find_by_id(id)[0]\n raise \"VMType[#{id}] does not exist.\" unless type\n\n type.delete\n [true, '']\n end\n end",
"def remove name, type = nil, &block\n debug \"Runner#remove name:#{name}, type:#{type}\" \n \n batch \"#{name}.#{type}\", \"kill\", true\n batch \"#{name}.#{type}\", \"rm\", true \n unregister_all(/#{name}\\.#{type}\\./)\n end",
"def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_set_type.destroy\n respond_to do |format|\n format.html { redirect_to data_set_types_url, notice: 'Data set type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @runstat.destroy\n respond_to do |format|\n format.html { redirect_to runstats_url, notice: 'Runstat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @drum_type.destroy\n respond_to do |format|\n format.html { redirect_to drum_types_url, notice: 'Drum type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fieldtype = Fieldtype.find(params[:id])\n @fieldtype.destroy\n\n respond_to do |format|\n format.html { redirect_to fieldtypes_url }\n format.json { head :no_content }\n end\n end",
"def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end",
"def delete_resource(type, id, data = {})\n model = fetch_generic_object_definition(type, id, data)\n delete_resource_main_action(type, model, data)\n model\n rescue => err\n raise BadRequestError, \"Deleting #{model_ident(model, type)} - #{err}\"\n end",
"def destroy\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def deleteMetadataType\n begin\n type = params[:metadatatypename].to_s.strip.downcase\n puts \"Type to be removed: \" + type\n\n if type == \"\"\n render :text => \"Type of metadata not given\", :status => 404\n return\n end\n\n # Search metadatatype\n metadatatype = MetadataType.find_by_name(type)\n\n # Check that type was found\n if metadatatype == nil\n render :test => \"Metadatatype not found\", :status => 404\n end\n\n # Delete all metadata of that type\n Metadata.destroy_all([\"metadata_type_id = ? \", metadatatype.id])\n\n # Delete metadata type\n metadatatype.destroy\n render :text => \"Metadatatype and metadata of that type deleted\", :status => 200\n return\n\n rescue => e\n puts \"Error in deleting metadatatype: #{e.to_s}\".background(:red)\n render :text => \"Conflict\", :status => 409\n return\n end\n end",
"def destroy\n @flat_type.destroy\n respond_to do |format|\n format.html { redirect_to flat_types_url, notice: 'Flat type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model_type.destroy\n respond_to do |format|\n format.html { redirect_to model_types_url, notice: 'Model type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_type = EventType.find(params[:id])\n @event_type.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.event_type'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_event_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @statement_type.destroy\n respond_to do |format|\n format.html { redirect_to statement_types_url, notice: 'Statement type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @archetype = Archetype.find(params[:id])\n @archetype.destroy\n\n respond_to do |format|\n format.html { redirect_to archetypes_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @plantype = Plantype.find(params[:id])\n @plantype.destroy\n\n respond_to do |format|\n format.html { redirect_to plantypes_url }\n format.json { head :no_content }\n end\n end",
"def delete_resource!(type, name, run_context: self.run_context)\n run_context.resource_collection.delete(\"#{type}[#{name}]\").tap do |resource|\n # Purge any pending notifications too. This will not raise an exception\n # if there are no notifications.\n if resource\n run_context.before_notification_collection.delete(resource.declared_key)\n run_context.immediate_notification_collection.delete(resource.declared_key)\n run_context.delayed_notification_collection.delete(resource.declared_key)\n end\n end\n end",
"def destroy\n\n @sample_type = SampleType.find(params[:id])\n\n if !@sample_type.samples.empty?\n flash[:notice] = \"Could not delete sample type definition #{@sample_type.name} because it has samples associated with it.\"\n else\n @sample_type.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to sample_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_type.destroy\n respond_to do |format|\n format.html { redirect_to project_types_url, notice: 'Project type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @premise_type = PremiseType.find(params[:id])\n @premise_type.destroy\n\n respond_to do |format|\n format.html { redirect_to premise_types_url }\n format.json { head :no_content }\n end\n end",
"def remove(index, type, id)\n resp = delete do |req|\n req.url \"#{index}/#{type}/#{id}\"\n end\n resp.body\n end",
"def delete(test_ids, type)\n type = @type_map.fetch(type) if type.class == Symbol\n test_ids = test_ids.join(',') if test_ids.class == Array\n args = {testIds: test_ids, type: type}\n post('deleteInternalMonitors', args)\n end",
"def destroy\n @trtype = Trtype.find(params[:id])\n @trtype.destroy\n\n respond_to do |format|\n format.html { redirect_to trtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @modtype.destroy\n respond_to do |format|\n format.html { redirect_to modtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @observation_type = ObservationType.find(params[:id])\n @observation_type.destroy\n\n respond_to do |format|\n format.html { redirect_to observation_types_url }\n format.json { head :ok }\n end\n end"
] |
[
"0.75388706",
"0.6970893",
"0.68634564",
"0.67474186",
"0.6655298",
"0.6654021",
"0.6549378",
"0.64984417",
"0.6465846",
"0.6456955",
"0.64284295",
"0.64201725",
"0.640605",
"0.6396923",
"0.6394494",
"0.6391869",
"0.6390206",
"0.6363904",
"0.63532853",
"0.6353162",
"0.6346058",
"0.63404477",
"0.6335837",
"0.6331706",
"0.6322819",
"0.632179",
"0.63123536",
"0.63057256",
"0.6301846",
"0.62974274",
"0.628631",
"0.6285389",
"0.6277505",
"0.6264215",
"0.62582123",
"0.62534934",
"0.6252226",
"0.62498933",
"0.6246606",
"0.6241593",
"0.62268436",
"0.62259895",
"0.6225811",
"0.62249386",
"0.62155926",
"0.6215436",
"0.6215436",
"0.6215436",
"0.6215436",
"0.6208983",
"0.6207471",
"0.6206477",
"0.62026805",
"0.6202244",
"0.6198634",
"0.6196373",
"0.61949795",
"0.61931854",
"0.61930037",
"0.6192512",
"0.618911",
"0.6187789",
"0.6180277",
"0.6176888",
"0.61762345",
"0.6168853",
"0.6163455",
"0.61490846",
"0.61440194",
"0.6142844",
"0.6141308",
"0.6136237",
"0.6133363",
"0.6128974",
"0.61161757",
"0.6114907",
"0.6113654",
"0.6110012",
"0.61085963",
"0.61067164",
"0.6104981",
"0.6104601",
"0.61037725",
"0.6101346",
"0.6095858",
"0.60917246",
"0.6087527",
"0.6085893",
"0.608562",
"0.6083835",
"0.6082485",
"0.60786647",
"0.6077723",
"0.60766625",
"0.60763097",
"0.6074834",
"0.60741585",
"0.6073591",
"0.6073549",
"0.60691273"
] |
0.74347365
|
1
|
Use callbacks to share common setup or constraints between actions.
|
def set_run_type
@run_type = RunType.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def run_type_params
params.require(:run_type).permit(:type, :active)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Check if params of JSON is correct
|
def wrong_params?
if has_not_mandatory_params?
render json: { message: "Wrong data params" }, status: 400
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def valid?\n unless @json.class == Hash\n return false\n end\n\n unless @json['method'].class == String\n return false\n end\n\n unless @json['params'].class == Array\n return false\n end\n\n return true\n end",
"def valid?(json:)\n return false unless json.present?\n\n json[:type].present? && json[:identifier].present?\n end",
"def valid?(json: {})\n json.present? && json[:license_ref].present? && json[:start_date].present?\n end",
"def valid_params?\n params.is_a?(Hash)\n end",
"def valid_json(json)\n JSON.parse(json)\n return true\n rescue JSON::ParserError => e\n return false\n end",
"def valid_json?(json)\n begin\n JSON.parse(json)\n return true\n rescue Exception => e\n return false\n end\n end",
"def valid_json?(json)\n begin\n JSON.parse(json)\n return true\n rescue Exception => e\n return false\n end\n end",
"def valid_json?( json )\n begin\n JSON.parse( json )\n return true\n rescue JSON::ParserError => error\n @logger.error(\"json parse error: #{error}\") if @debug\n return false\n end\n end",
"def valid_json?(json)\n JSON.parse(json)\n true\n rescue JSON::ParserError\n false\n end",
"def valid?\n\t\t\t\t((request.format.symbol == :json) || (params[\"format\"] != nil && params[\"format\"] == \"json\")) && params[\"email\"]\n\t\t\tend",
"def valid_json?(json)\n begin\n JSON.parse(json)\n return true\n rescue JSON::ParserError => e\n return false\n end\n end",
"def geo_json_valid?\n geo_data = RGeo::GeoJSON.decode(params.to_json)\n if !geo_data.blank?\n return true\n else\n json_response(nil, :unprocessable_entity, :invalid_geojson_type)\n return false\n end\n end",
"def check_params\n # For each key,value in GLOBAL VAR **PARAMS**.\n PARAMS.each do |param, method|\n # Next if there isn't param in the request of client\n next unless params[param]\n # Check the *param* with *method*\n unless send(method, params[param])\n @error_object = \"Param #{param} is wrong, #{method} failed\"\n return false\n end\n end\n true\n end",
"def valid_json(json)\n JSON(json)\n #NOTE: Rescuing TypeError too in case json is not a String\n rescue ::JSON::ParserError, TypeError\n nil\n end",
"def content_type_is_json_but_invalid_json_provided?\n content_type_json? && ((request_body_required? || any_request_body?) && invalid_json?)\n end",
"def json_request?()\n request.format.json?\n end",
"def params_validation\n errors = validate_params(params)\n return json_response(errors, :unprocessable_entity) if errors.present?\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def check_params; true; end",
"def safeguarded_json\n # Make sure this is actually JSON\n hash = JSON.parse(params[:json])\n\n # Refuse to handle more than 12 chickens at once. What are you, a factory farmer??\n raise \"Too many birds\" if hash.size > 12\n\n return params[:json]\n end",
"def maybe_json?(got, expected)\n return expected == got if expected.is_a?(Array)\n !expected.match(got.join(' ')).nil?\n end",
"def json_input?\n return request.content_type == 'application/json'\n end",
"def validate_param\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate_param(@arguments.keys.first.to_s, @arguments.values.first)\n render json: { success: 'Param looks like the right data type! good job!' }, status: 200\n end\n end",
"def valid_params?\n params_auth_hash.is_a?(Hash)\n end",
"def malformed_request?\n from_json\n @coffee.nil? || @order.nil?\n end",
"def is_json? (string_to_validate)\n \t\t\tbegin\n\t\t !!JSON.parse(string_to_validate)\n\t\t rescue\n\t\t false\n\t\t end \t\t\t\n \t\tend",
"def is_json?(content)\n if content.present?\n sanitized_content = content.gsub(/\\n/, '') # remove newlines that may break this check\n chars = [sanitized_content[0], sanitized_content[sanitized_content.size - 1]]\n chars == %w({ }) || chars == %w([ ])\n else\n false\n end\n end",
"def valid_params_request?; end",
"def valid_params_request?\n true\n end",
"def valid_params_request?\n true\n end",
"def validate_parameter(*param)\n param.each do |a|\n return false unless a && (a.to_s =~ /^\\{.*\\}$/) == nil && a != '' && a != {}\n end\n end",
"def valid_json(string) \n\tJSON.parse(string) \n\treturn true \n\trescue JSON::ParserError \n\treturn false \nend",
"def check_params_json(file)\n puts \"Checking #{file}...\"\n puts\n\n contents = File.read(file)\n puts contents\n\n puts \"Parsing JSON...\"\n puts\n\n json = JSON.parse contents\n puts json\n puts\n\n puts \"Verifying JSON...\"\n install = json[\"install\"]\n\n unless [true, false].include? install\n raise \"Invalid pe_xl parameter file; must contain `install` parameter specifying either `true` or `false`\"\n end\n\n puts \"Verified parameter 'install': #{install}\"\n puts\nend",
"def check_parameter\n \t# response to the JSON if searchterm or sort_type is not present.\n \trender json: {success: false, message: 'Something wrong with the parameters'}, status: 400 if (params[:searchterm].nil? || params[:sort_type].nil?)\n end",
"def valid?(json: {})\n return false unless json.present?\n\n id = json.fetch(:affiliation_id, json.fetch(:funder_id, {}))[:identifier]\n json[:name].present? || id.present?\n end",
"def ensure_params(*req)\n missing = []\n req.flatten.each do |param|\n if params[param].blank?\n missing << param.to_s\n end\n end\n if missing.empty?\n return false\n else\n msg = \"Following params are required but missing: \" + missing.join(\", \")\n render_api_error(11 , 400, 'params', msg)\n return true\n end\n end",
"def check_params\n true\n end",
"def validate_params\n data = endpoint_params\n errors = []\n errors << 'Invalid verb' if %w[GET POST PATCH DELETE].exclude?(data[:verb])\n # check for valid url\n begin\n URI.parse data[:path]\n rescue URI::InvalidURIError => e\n errors << 'Invalid Path'\n end\n render json: { errors: errors }, status: :unprocessable_entity if errors.present?\n end",
"def required_params_present?\n\n render json: {error: 'Missing required parameter: result'},\n status: :bad_request and return false unless params[:result]\n\n render json: {error: 'Missing required parameter: result.result_type'},\n status: :bad_request and return false unless params[:result][:result_type]\n\n # Manual Results are required to provide the execution id.\n # All other results are required to provide the project_id\n if params['result']['result_type'] == 'manual'\n render json: {error: 'Missing required parameter: result.execution_id'},\n status: :bad_request and return false unless params[:result][:execution_id]\n else\n render json: {error: 'Missing required parameter: result.project_id'},\n status: :bad_request and return false unless params[:result][:project_id]\n end\n\n\n render json: {error: 'Missing required parameter: result.testcase_id'},\n status: :bad_request and return false unless params[:result][:testcase_id]\n\n render json: {error: 'Missing required parameter: result.environment_id'},\n status: :bad_request and return false unless params[:result][:environment_id]\n\n\n render json: {error: 'Missing required parameter: result.status'},\n status: :bad_request and return false unless params[:result][:status]\n\n true\n end",
"def ensure_json_request\n return if params[:format] == 'json' || request.headers['Accept'] =~ /json/\n head :not_acceptable\n end",
"def ensure_json_request\n return render_message({status:ERR_STATUS,responseMessage: NOT_ACCEPTABLE_MESSAGE, responseCode: NOT_ACCEPTABLE }) unless request.format == :json\n end",
"def valid_params?(params)\n params.keys.each do |key|\n unless RealPush::API::App.params_accept.include? key.to_sym\n raise ConfigurationError, \"Invalid parameter! ( #{RealPush::API::App.params_accept.join(', ')} )\"\n end\n end\n true\n end",
"def is_json?(json)\n begin\n JSON.parse(json)\n return true\n rescue Exception => e\n return false\n end\nend",
"def check_format\n redirect_to root_url unless params[:format] == 'json' || request.headers[\"Accept\"] =~ /json/\n end",
"def valid_params?\n params.none? do |k,v|\n v == \"\"\n end\n end",
"def validate_parameters(sent_parameters)\n valid_parameters = nil\n if sent_parameters.is_a?(JamendoParameters)\n valid_parameters = sent_parameters.to_hash\n elsif sent_parameters.is_a?(Hash)\n valid_parameters = format_parameters(sent_parameters)\n elsif sent_parameters.is_a?(String)\n valid_parameters = Hash.new\n valid_parameters = { artist: sent_parameters }\n else\n raise JamendoError(\"Imposible to handle parameter you provided.\")\n end\n return valid_parameters\n #sent_parameters.select! { | param, value | valid_parameters.include?(param) }\n end",
"def json_params\n begin\n JSON.parse(request.body.read)\n rescue\n halt 400, serialize_error('Invalid JSON.')\n end\n end",
"def valid_json?(string)\n !!JSON.parse(string)\n rescue JSON::ParserError\n false\n end",
"def test_validate_required_param_test()\n # Parameters for the API call\n model = Validate.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"farhan\",\"field\":\"QA\"}'\n ))\n option = '...'\n\n # Perform the API call through the SDK function\n result = @controller.validate_required_parameter(model, option: option)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def looks_like_json? line\n !!(line =~ /^\\s*\\{/)\n end",
"def valid_params?; end",
"def check_json_authenticity\n\t\treturn unless request.format.js? or request.format.json?\n\t\treturn unless protect_against_forgery?\n\t\tauth_token = params[request_forgery_protection_token]\n\t\tunless (auth_token and form_authenticity_token == URI.unescape(auth_token))\n\t\t\traise(ActionController::InvalidAuthenticityToken)\n\t\tend\n\tend",
"def validate_format\n data = JSON.decode(data) if data.class == Hash\n JSON.parse(data) && nil if data.present?\n rescue JSON::ParserError\n nil\n end",
"def check_json_authenticity\n return unless request.format.js? or request.format.json?\n return unless protect_against_forgery?\n return unless params[request_forgery_protection_token]\n auth_token = params[request_forgery_protection_token]\n unless (auth_token and form_authenticity_token == URI.unescape(auth_token))\n raise(ActionController::InvalidAuthenticityToken)\n end\n end",
"def json?\n true\n end",
"def check_json_authenticity\n return unless request.format.js? or request.format.json?\n return unless protect_against_forgery?\n auth_token = params[request_forgery_protection_token]\n unless (auth_token and form_authenticity_token == URI.unescape(auth_token))\n raise(ActionController::InvalidAuthenticityToken)\n end\n end",
"def check_json_authenticity\n return unless request.format.js? or request.format.json?\n return unless protect_against_forgery?\n auth_token = params[request_forgery_protection_token]\n unless (auth_token and form_authenticity_token == URI.unescape(auth_token))\n raise(ActionController::InvalidAuthenticityToken)\n end\n end",
"def valid_body?\n request.feedback.body && valid_json?(request.feedback.body)\n end",
"def valid?(params = {})\n params.each_value do |arr|\n arr.each do |key, value|\n # hasOtherName always will be correct\n next if key == 'hasOtherName'\n # If the array is empty or the data that has is invalid return false\n # return false if the array is empty\n return false if value.class == Array && value.empty?\n # return false if the information is not correct\n return false if value.class == Array && invalid_interactions?(value)\n next if value.class == Array\n # If the string is empty data not valid\n return false if value == ''\n end\n end\n true\n end",
"def json?\n content_type == \"application/json\"\n end",
"def validate_params?\n true # TODO: add validation\n end",
"def validate_required_params(required_param)\n return unless request.query_parameters[required_param].blank?\n\n render json: { error: \"'#{required_param}' query parameter is required\" },\n status: :bad_request\n end",
"def invalid_params?\n @invalid_params.keys.length == 0\n end",
"def validate\n @errors = JSON::Validator.fully_validate(\n schema, params,\n errors_as_objects: true\n )\n @errors.empty?\n end",
"def ensure_hash(params)\n case params\n when String then params.present? ? ensure_hash(JSON.parse(params)) : {}\n when Hash, ActionController::Parameters then params\n when nil then {}\n else raise ArgumentError, \"Unexpected parameter: #{params}\"\n end\n end",
"def validate_params\n if process_object && process_object[\"required_params\"]\n process_object[\"required_params\"].each do |param|\n if !params_hash.has_key?(param)\n errors.add(:params, \"Step: #{step} - Missing mandatory param #{param}\")\n end\n end\n end\n end",
"def required_alert_keys?(json)\n %w[title description artifacts].all? { |key| json.key? key }\n end",
"def json?\n content_type&.start_with?(\"application/json\")\n end",
"def valid?\n @params_definition.each { |pd| return false unless @params.has_key?(pd) }\n true\n end",
"def rendering_json?(p = nil)\n p ||= params\n fmt = p[:format].to_s.downcase\n (fmt == 'json') || (respond_to?(:request) && request.format.json?)\n end",
"def validate_format\n JSON.parse(content) && nil if content\n rescue JSON::ParserError => err\n err.message\n end",
"def validate_format\n JSON.parse(content) && nil if content\n rescue JSON::ParserError => err\n err.message\n end",
"def validate_params\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate(@arguments)\n render json: { success: 'Params look great!' }, status: 200\n end\n end",
"def valid?(params)\n true\n end",
"def validate_parameters\n if (latitude.to_f == 0.0) || (longitude.to_f == 0.0)\n render :status=>401,\n :json=>{:Message=>\"The latitude and longitude parameters should be float values.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if (location_lock != \"true\") || (location_lock != \"false\")\n render :status=>401,\n :json=>{:Message=>\"The location_lock should be either true or false.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if proximity.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The proximity should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if page.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The page should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n end",
"def validate_params(hash)\n hash.include?('title') and hash.include?('body') and hash.include?('category')\n end",
"def ensure_json_content_type\n request.headers['Content-Type'] =~ /application\\/json/\n end",
"def assert_valid_json(res)\n require 'json'\n assert_content_type res, \"application/json\"\n begin\n JSON.parse(res.body)\n rescue JSON::ParserError => e\n flunk build_message(\"\", \"String <?> is not valid JSON. The Parser Error was: #{e.message}\", res.body)\n end\n end",
"def is_point?\n point_data = RGeo::GeoJSON.decode(params.to_json)\n if point_data.blank? || point_data.geometry.geometry_type.to_s != 'Point'\n json_response(nil, :unprocessable_entity, :incompatible_geomtry)\n end\n end",
"def check_valid_trace(body)\n contents = JSON.parse body\n assert_kind_of(Array, contents, 'Response contents is not an Array')\n assert !contents.empty?\n\n contents.each do |p|\n assert p.key? 'latitude'\n assert p['latitude'].is_a? Float\n assert p.key? 'longitude'\n assert p['longitude'].is_a? Float\n assert p.key? 'distance'\n assert p['distance'].is_a? Float\n assert p.key? 'elevation'\n assert p['elevation'].is_a? Integer\n end\n\n assert last_response.ok?\n contents\n end",
"def check_request_format\n unless request.content_type == 'application/json'\n error = ErrorSerializer.serialize({ format: \"Invalid request format. Only JSON requests are supported.\" })\n render json: error, status: :unsupported_media_type\n end\n end",
"def has_required_http_params?(param_hash)\n # Note: The blank? method is a Rails extension.\n # Specific keys have to be present, and their values\n # must not be blank.\n if !param_hash[:filename].blank? &&\n !param_hash[:assignment].blank? &&\n !param_hash[:group_name].blank?\n return true\n else\n return false\n end\n end",
"def validate(ctx, params:, **)\n is_valid =\n params.is_a?(Hash) &&\n params[\"info\"].is_a?(Hash) &&\n params[\"info\"][\"email\"]\n\n is_valid # return value matters!\n end",
"def verify_params(params)\n return false if params['Body'].to_s.empty?\n return false if params['Body'].to_s.bytes.size > 1600\n return false unless /\\+\\d+$/.match(params['To'])\n true\n end",
"def ensure_param_exists(param)\n\t return unless params[param].blank?\n\t render json:{ success: false, error: \"Missing #{param} parameter\"}, status: :unprocessable_entity\n\t end",
"def ensure_params_url\n if !params[:url]\n render json: ['No URL has been provided.'], status: 422 \n else \n render json: ['Url format is Improper.'], status: 422 unless ShortURL.validate_url_format(params[:url])\n end\n end",
"def valid_params?(actuals, expected_keys)\n actuals = actuals.delete_if { |k, _v| k == \"captures\" }\n expected_keys == actuals.keys.to_set &&\n actuals.values.none? { |v| v.nil? || v.empty? }\n end",
"def has_valid?(params)\n params.none?{|key,value| value.empty?}\n end",
"def json?\n content_type = @response.headers[:content_type] || ''\n content_type.include?('application/json')\n end",
"def response?(params); end",
"def validate(ctx, params:, **)\n is_valid =\n params.is_a?(Hash) &&\n params[\"info\"].is_a?(Hash) &&\n params[\"info\"][\"email\"]\n \n is_valid # return value matters!\n end",
"def check_payload(json, model,\n exclude = nil, # fields that should not be present\n allow = nil, # fields to check, overriding model accessible_attributes. Note: silently ignored if not an accessabie field - use augment!\n augment = [:server_time]) # non-DB fields to check for existence and format\n return check_reply(json: json, model: model, exclude: exclude,\n allow: allow, augment: augment)\n end",
"def params?\n !(params.input_filters.required_inputs.empty? && params.input_filters.optional_inputs.empty?)\n end",
"def params_checked(params)\n \tparams.each do |key, value|\n \t\tif !is_number?(value)\n \t\t\treturn false\n \t\tend\n \tend\n \treturn true\n end",
"def api_request?\n request.format.json? || request.format.js? || request.format.xml? || request.format.fbtab?\n end"
] |
[
"0.77083033",
"0.7410057",
"0.7060128",
"0.6960697",
"0.69467294",
"0.6888149",
"0.6888149",
"0.68609464",
"0.68485796",
"0.6776756",
"0.674491",
"0.6727375",
"0.67187524",
"0.6716137",
"0.6676854",
"0.6668017",
"0.6665036",
"0.66641176",
"0.6650941",
"0.6650941",
"0.6650941",
"0.6650941",
"0.6650941",
"0.6643323",
"0.6640602",
"0.66310596",
"0.6610724",
"0.65977764",
"0.6595696",
"0.6583146",
"0.6557228",
"0.6548307",
"0.654607",
"0.65346664",
"0.65346664",
"0.6511068",
"0.6500943",
"0.6485829",
"0.64756054",
"0.646878",
"0.64656353",
"0.6456101",
"0.64554703",
"0.64233226",
"0.64223677",
"0.6410457",
"0.64050394",
"0.6399636",
"0.63599765",
"0.63584656",
"0.63478595",
"0.63401705",
"0.6338295",
"0.6299032",
"0.62969106",
"0.6265819",
"0.62636966",
"0.62587535",
"0.62429434",
"0.6242136",
"0.6191522",
"0.6191522",
"0.6183234",
"0.6174614",
"0.61616635",
"0.6150822",
"0.6148742",
"0.6139664",
"0.61227584",
"0.6110185",
"0.61042464",
"0.61019784",
"0.60943973",
"0.60935646",
"0.6090933",
"0.607987",
"0.607987",
"0.60690325",
"0.60683674",
"0.6049233",
"0.6039138",
"0.6037219",
"0.6036068",
"0.6005962",
"0.5995738",
"0.5993975",
"0.59815466",
"0.5974245",
"0.59691423",
"0.59672064",
"0.5936402",
"0.5932275",
"0.5927536",
"0.5918909",
"0.5908663",
"0.5905996",
"0.58876294",
"0.5879792",
"0.58706266",
"0.5869701"
] |
0.7122817
|
2
|
Check if params DEVICE_CODE, DATA is present in JSON send
|
def has_not_mandatory_params?
!params[:email].present? || !params[:password].present?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def verify_send_code_data(params)\n params[:game].is_a?(Game) && params[:code_string].is_a?(String) && params[:user].is_a?(User)\n end",
"def check_single_data(data:, message:)\n crit_msg(message) if data\n end",
"def wrong_params?\n if has_not_mandatory_params?\n render json: { message: \"Wrong data params\" }, status: 400\n end\n end",
"def verify_attach_unzoned_codes_data(params)\n params[:game].is_a?(Game) && params[:codes].is_a?(Hash) && params[:user].is_a?(User)\n end",
"def check_device_exists\n render json: { error: 'device not found' }, status: :internal_server_error unless Device.exists?(params[:device_id])\n end",
"def verify_code\n if params.include?(:phone_number) and params.include?(:activate_code)\n if User.exists?(:phone_number => params[:phone_number], :code => params[:activate_code])\n success = true\n message = 'activate successfully'\n else\n success = false\n message = 'phone number does not exist or code activate is not ok'\n end\n else\n success = false\n message = 'please check the paramaters'\n end\n result = { :success => success, :message => message }\n render json: result, status: 200\n end",
"def validate_sendtomultisig_inputs(data)\n response = {}\n response['status'] = false\n\n if data.length < 6\n response['err_msg'] = 'Insufficient number of parameters!'\n return response\n end\n\n begin\n data[1] = Integer(data[1])\n data[2] = btc_to_satoshi(Float(data[2]))\n data[3] = Integer(data[3])\n\n transaction = retrieve_transaction_from_utxo(data[0], data[1])\n\n if transaction.nil?\n response['err_msg'] =\n 'Either invalid, non-wallet or already spent Transaction ID,' \\\n 'or incorrect vout index'\n return response\n end\n\n if btc_to_satoshi(transaction['value']) < (data[2] + TRANSACTION_FEE)\n response['err_msg'] =\n 'Amount to transfer must be less than the transaction amount'\n return response\n end\n\n payee_addresses = data.slice(4..-1)\n\n if data[3] > payee_addresses.length\n response['err_msg'] =\n 'Minimum signatures required must be less than or equal to' \\\n 'the number of payee addresses provided'\n return response\n end\n\n payee_addresses.each { |address|\n next if valid_address? address\n response['err_msg'] =\n 'Either invalid or non-wallet payee address: ' + address\n return response\n }\n\n response['status'] = true\n return response\n rescue\n response['err_msg'] = 'Invalid parameter values!'\n return response\n end\nend",
"def request_valid?(data)\n ln = 0\n data.each_line {|l|\n ln += 1\n }\n if ln > 1\n return true\n else\n puts \"\\e[1;31mCatch GET's without header information / Other \\e[0m\\ \"\n return false # Due to single GET Requests to no headers \n end\n end",
"def check_rest_result_valid(json_result)\n \n\tdevice = Api::Device.find_by(mac_address: @device_given_attrs['mac_address'], serial_number: @device_given_attrs['serial_number'])\n\t\n # device register 的流程應檢查的項目包含:\n # 1. API response 內容\n # 2. personal cloud db\n # 3. xmpp db\n # 4. redis\n\n # 確認 API response 內容\n check_device_register_json_response(device, json_result)\n\n # 確認 personal cloud db 內容\n check_device_register_db_result(device)\n\n # 確認 xmpp db 內容\n check_device_register_xmpp_db_result(device)\n\n # 確認 redis 內容\n check_device_register_redis_result(device)\nend",
"def requestOneTimePasscode\n \n acct_phone_number = params.require(:phone_number)\n device_id = params.permit(:device_id)[:device_id]\n name = params.permit(:name)[:name]\n email = params.permit(:email)[:email]\n \n begin\n acct = User.find_or_create_mobile_phone_account(acct_phone_number, email, name)\n if (! acct)\n Log.create(log_type: Log::ERROR, context: \"ApiController#requestOneTimePasscode\", current_user: @current_user.id, message: \"Error Creating Account with phone number #{acct_phone_number}\")\n render status: :internal_server_error, json: {error: \"Error creating account\"}\n end\n \n if device_id and !device_id.empty?\n acct.device_id = device_id\n end\n \n \n acct.save\n \n # Todo check the device ID and get worried if it changed\n otp = acct.generate_otp \n begin\n MessageSender.new.send_code(acct.phone_number, \"Your T👀U authentication code is #{otp}\") unless acct.test_user?\n rescue Exception => err \n Log.create(log_type: Log::ERROR, context: \"ApiController#requestOneTimePasscode\", current_user: acct_phone_number, message: err.message)\n # render status: :internal_server_error, json: {error: \"Error sending SMS\"}\n render status: :internal_server_error, json: {error: err.message}\n return\n end\n render json: {}, status: :ok\n \n rescue Exception => e\n render status: :bad_request, json: {error: e.message}\n end\n\n \n end",
"def check_params\n # For each key,value in GLOBAL VAR **PARAMS**.\n PARAMS.each do |param, method|\n # Next if there isn't param in the request of client\n next unless params[param]\n # Check the *param* with *method*\n unless send(method, params[param])\n @error_object = \"Param #{param} is wrong, #{method} failed\"\n return false\n end\n end\n true\n end",
"def getDataForBeacon\n if params[:type].present? && params[:beacon_uid].present?\n if params[:type]==\"getDataForBeacon\"\n @item = Item.where(:beacon_id => Beacon.where(:uid => params[:beacon_uid]))\n if (@item.count) <= 0\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Beacon Not Found\"}\n else\n end\n else\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Wrong Type\"}\n end\n else\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Missing Attribute\"}\n end\n end",
"def credential_check\n %w(partner req_id service v).all? { |k|\n # AlipayWap.logger.debug \"#{k}: #{@protocol_fields[k]}<->#{@request.protocol_fields[k]}\"\n @protocol_fields[k] == @request.protocol_fields[k].to_s\n } || raise(\"Response is not for this request\")\n end",
"def skip_mobile_param_not_present?\n params[:skip_mobile] != 'true'\n end",
"def skip_mobile_param_not_present?\n params[:skip_mobile] != 'true'\n end",
"def valid?\n\t\t\t\t((request.format.symbol == :json) || (params[\"format\"] != nil && params[\"format\"] == \"json\")) && params[\"email\"]\n\t\t\tend",
"def data_json\n\t\tbegin\n\t\t\tJSON.parse(@client_input) if !@client_form_bool and @client_json_bool\n\t\trescue => ex\n\t\t\t@client_json_bool = false\n\t\t\t{ :bool => false, :code => 0, :info => 'bad client json data' }\n\t\tend\n\tend",
"def validate_peer_data!(data)\n\t\t\t[:uuid,:host,:port].each{|k|\n\t\t\t\tdata[k] || fail(\"Peer data does not meet requirements. #{k} is a required field. See Hive documentation.\")\n\t\t\t}\n\t\t\tkeys = peer_fields.keys\n\t\t\tdata.keys.each{|k|\n\t\t\t\tkeys.include?(k) || warn(\"Provided key #{k} will not be stored with peer data\")\n\t\t\t}\n\t\t\ttrue\n\t\tend",
"def ensure_json_request\n return render_message({status:ERR_STATUS,responseMessage: NOT_ACCEPTABLE_MESSAGE, responseCode: NOT_ACCEPTABLE }) unless request.format == :json\n end",
"def all_required(data, fields)\t\t\n\t\tif fields.nil? == true\n\t\t\treturn true\n\t\tend\n\t\t@api_errmsg = Array.new\n\t\tfields = fields.split(',')\n\t\tflag = true\n\t\tfields.each do |name|\n\t\t\tif data[name].nil?\n\t\t\t @api_errmsg.push(name)\n\t\t\t flag = false\n\t\t\tend\n\t\tend\n\t\tif flag == true\n\t\t return true\n\t\tend\n\t\treturn false\n\tend",
"def check_params #:doc:\n if params[:username] !~ /.{1,}/ or params[:password] !~ /.{1,}/ or\n params[:devicename] !~ /.{1,}/ or params[:dev_type] !~ /.{1,}/ or\n (params[:port] != nil and params[:port] !~ /\\d{1,10}/)\n return false\n else\n return true\n end\n end",
"def verify_idcode\n\n #Put the device into IDCode retrival mode.\n self.instruction = :idcode\n\n #And attempt to retrieve the 32-bit IDcode.\n id_code = receive_data(32).reverse\n\n #If the two IDcodes don't match, raise an error.\n raise JTAG::Error, \"IDCode verification failed! Expected: #{@idcode.unpack(\"H*\")}, receieved #{id_code.unpack(\"H*\")}. \" unless id_code == @idcode\n\n end",
"def show\n\t\t\t#check params device_code\n\t\t\tunless params[:device_code].blank? or params[:regId_code].blank?\n\t\t\t\t#check device exits\n\t\t\t\t@device = Device.find_by(code: params[:device_code])\n\t\t\t\t#neu co\n\t\t\t\tif @device\n\t\t\t\t\tif @device.status == false\n\t\t\t\t\t\t\t#render status =002\n\t\t\t\t\t\t\trender json:{status: 0, message:\"Device not used\",details:{name_device:@device.name,notification: 1,info:{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tid:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tname:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taddress:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttour_name:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlat:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlng:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tphone:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdevice_id:@device.id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tif @device.reg_id.blank?\n\t\t\t\t\t\t\t@device.update(reg_id:params[:regId_code])\n\t\t\t\t\t\t\t#check status\n\t\t\t\t\t\t\t# if don't joined tour\n\t\t\t\t\t\t\t#joined tour\n\t\t\t\t\t\t\t@tourguide = Tourguide.find_by(device_id:@device.id)\n\t\t\t\t\t\t\t# @tourguide_info = @tourguide\n\t\t\t\t\t\t\t# @tourguide_info[:abc] = @device.lat\n\t\t\t\t\t\t\t# @tourguide[:lng] = @device.lng\n\t\t\t\t\t\t\tif @tourguide #tourguide\n\t\t\t\t\t\t\t\t#render tourguide info\n\t\t\t\t\t\t\t\t\trender json:{ \n\t\t\t\t\t\t\t\t\t\t\t\t\tstatus:0,message: \"Success\",details:{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroup: 1,name_device: @device.name,notification:2,info:{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tid:@tourguide[:id],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tname:@tourguide[:name],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taddress:@tourguide[:address],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttour_name:@tourguide.tours.first.name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timages:\"http://\"+request.host_with_port+\"/assets/images_tourguide/\"+@tourguide.images,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlat:@device.lat == nil ? \"\" : @device.lat,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlng:@device.lng == nil ? \"\" : @device.lng,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tphone:@tourguide[:phone],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdevice_id:@device.id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse#traveller\n\t\t\t\t\t\t\t\t# render json:{url:request.host_with_port}\n\t\t\t\t\t\t\t\t#get traveller info\n\t\t\t\t\t\t\t\t@traveller = Traveller.find_by(device_id:@device.id)\n\t\t\t\t\t\t\t\t#render traveller info\n\t\t\t\t\t\t\t\trender json:{ \n\t\t\t\t\t\t\t\t\t\t\t\tstatus:0,message: \"Success\",details:{\n\t\t\t\t\t\t\t\t\t\t\t\t\tgroup: 0,name_device: @device.name,notification:2,info:{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tid:@traveller[:id],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tname:@traveller[:name],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taddress:@traveller[:address],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttour_name:@traveller.tours.first.name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\timages:\"http://\"+request.host_with_port+\"/assets/images_travellers/\"+@traveller.images,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlat:@device.lat == nil ? \"\" : @device.lat,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlng:@device.lng == nil ? \"\" : @device.lng,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tphone:@traveller[:phone],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdevice_id:@device.id\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telsif @device.reg_id != params[:regId_code]\n\t\t\t\t\t\t\trender json:{ status: 103, message:\"RegId invalid \"}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t#joined tour\n\t\t\t\t\t\t\t@tourguide = Tourguide.find_by(device_id:@device.id)\n\t\t\t\t\t\t\t# @tourguide_info = @tourguide\n\t\t\t\t\t\t\t# @tourguide_info[:abc] = @device.lat\n\t\t\t\t\t\t\t# @tourguide[:lng] = @device.lng\n\t\t\t\t\t\t\tunless @tourguide == nil #tourguide\n\t\t\t\t\t\t\t\t#render tourguide info\n\t\t\t\t\t\t\t\t\trender json:{ \n\t\t\t\t\t\t\t\t\t\t\t\t\tstatus:0,message: \"Success\",details:{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroup: 1,name_device: @device.name,notification:2,info:{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tid:@tourguide[:id],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tname:@tourguide[:name],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taddress:@tourguide[:address],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttour_name:@tourguide.tours.first.name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\timages:\"http://\"+request.host_with_port+\"/assets/images_tourguide/\"+@tourguide.images,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlat:@device.lat == nil ? \"\" : @device.lat,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlng:@device.lng == nil ? \"\" : @device.lng,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tphone:@tourguide[:phone],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdevice_id:@device.id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse#traveller\n\t\t\t\t\t\t\t\t# render json:{url:request.host_with_port}\n\t\t\t\t\t\t\t\t#get traveller info\n\t\t\t\t\t\t\t\t@traveller = Traveller.find_by(device_id:@device.id)\n\t\t\t\t\t\t\t\t#render traveller info\n\t\t\t\t\t\t\t\trender json:{ \n\t\t\t\t\t\t\t\t\t\t\t\tstatus:0,message: \"Success\",details:{\n\t\t\t\t\t\t\t\t\t\t\t\t\tgroup: 0,name_device: @device.name,notification:2,info:{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tid:@traveller[:id],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tname:@traveller[:name],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taddress:@traveller[:address],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttour_name:@traveller.tours.first.name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\timages:\"http://\"+request.host_with_port+\"/assets/images_travellers/\"+@traveller.images,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlat:@device.lat == nil ? \"\" : @device.lat,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlng:@device.lng == nil ? \"\" : @device.lng,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tphone:@traveller[:phone],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdevice_id:@device.id\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telse #don't already system\n\t\t\t\t\t\t#render status = 001\n\t\t\t\t\t\trender json:{status:0,message:\"Device not already in system\",details:{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroup: \"\",name_device:\"\",notification:0,info:{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tid:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tname:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taddress:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttour_name:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlat:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlng:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tphone:\"\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdevice_id:\"\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\tend\n\t\t\telse\n\t\t\t\trender json:{status: 104, message:\"Not found information device code or regID code\"}\n\t\t\tend\n\t\tend",
"def on_message data\n begin\n data = JSON.parse data\n rescue Exception => e\n puts e\n response << {event: :error, message: \"Unknown Error\"}.to_json\n response.close\n return false\n end\n broadcast :_send_message, {event: :chat, from: params[:name], message: data['message'], at: Time.now}.to_json\n end",
"def valid? job_data\n job_data[\"identifier\"] && job_data[\"data\"]\n rescue\n false\n end",
"def valid_contact_params?(params)\n r = false\n if !params[:sender_name].blank? and !params[:sender_address].blank? and !params[:message_title].blank? and !params[:message_content].blank? and ((params[:spamcode]).to_i==session[:spamcode])\n r = true\n end\n r\n end",
"def intent_listen_send\n\tbegin\n\t\tif @params['par']\n\t\t\tcase @params['par']\n\t\t\twhen '5'\n\t\t\t\tdata = { 'message' => 'Message to service' }\n\t\t\t\tparams_constructor(Rho::Intent::START_SERVICE,\"\",\"\",\"\",\"com.rhomobile.compliancetestruby\",\"com.rhomobile.rhodes.RhodesService\",\"\",\"\",data)\n\t\t\twhen '11'\n\t\t\t\tdata = { 'reply' => 'This is my broadcast data!' }\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"com.smap.targetapp.mySecondAction\",\"\",\"\",\"\",\"\",\"\",data)\n\t\t\twhen '391'\n\t\t\t\tdata = { 'myData' => 'This is broadcast data 3!' }\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"com.rhomobile.BROADCAST\",[\"com.rhomobile.compliancetestruby\"],\"\",\"\",\"\",\"\",data)\n\t\t\twhen '392'\n\t\t\t\tdata = { 'myData' => 'This is broadcast data 3!' }\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"\",\"\",\"compliancetestruby\",\"\",\"\",\"\",data)\n\t\t\twhen '393'\n\t\t\t\tdata = { 'myData' => 'This is broadcast data 3!' }\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"\",\"\",\"rhomobile compliancetest_ruby/compliancetestruby.exe\",\"\",\"\",\"\",data)\n\t\t\twhen '461'\n\t\t\t\tdata = { 'myData' => 'This is broadcast data!'}\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"com.rhomobile.BROADCAST\",\"\",\"com.rhomobile.compliancetestruby\",\"\",\"\",\"\",data)\n\t\t\twhen '462'\n\t\t\t\tdata = { 'myData' => 'This is broadcast data!'}\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"com.rhomobile.BROADCAST\",\"\",\"rhomobile compliancetest_ruby/compliancetestruby.exe\",\"\",\"\",\"\",data)\n\t\t\telse\n\n\t\t\tend\n\t\tend\n\t\tRho::Intent.startListening(url_for(:action => :listen_callback))\n\t\tRho::Intent.send(@result)\n\trescue =>ex\n\t\tjsmethod = 'Ruby.sendValueToJS(\"' + ex.message + '\")'\n\t\tRho::WebView.executeJavascript(jsmethod)\n\tend\nend",
"def validate_code\n \n # Don't validate in dev mode\n return true if Rails.env==\"development\"\n \n begin\n \n id = params[:key].to_s.split(\"-\")[0]\n code = params[:key].to_s.split(\"-\")[1]\n \n @version = params[:version].to_i\n \n @api_key = ApiKey.find( id )\n if ( @api_key && @api_key.enabled? && @api_key.code==code )\n return true\n else\n reject and return false\n end\n \n rescue\n reject and return false\n end\n \n end",
"def parseDeviceData(doc, params)\n \n dev_type = (doc.find_first('//xmpp2rest/user/device/dev_type')) ? doc.find_first('//xmpp2rest/user/device/dev_type').content : nil\n password = (doc.find_first('//xmpp2rest/user/device/password')) ? doc.find_first('//xmpp2rest/user/device/password').content : nil\n \n if not dev_type or not password\n raise Exception.new(\"Missing elements data for creating new device!\")\n end \n \n params.merge!({:dev_type => dev_type})\n params.merge!({:password => password})\n \n return params\n end",
"def validate_request req\n id, method, params = req.id, req.method.sub(/^block\\./,''), req.params\n\n case method\n when \"notify\"\n coin_code, password, hash = *params\n raise Rpc::InvalidParams.new( extra_msg: \"coin_code is invalid : #{coin_code}\" ) if ! coin_code =~ /^\\w{3,5}$/\n else\n raise JSON_RPC::MethodNotFound.new( method: \"block.#{method}\" )\n end\n\n emit( method, req )\n\n true\n end",
"def stop_processing_because_param?\n return true if params[:skip_mobile] == 'true'\n false\n end",
"def send_device_token\n\t\t@device = Device.where(:token =>params[:device_token])\n\t\t\n\t\tif @device.length > 0 && (!@device.first.vendor.nil? || !@device.first.restaurant.nil?)\n\t\t\td = @device.first\n\t\t\trender :json => { :vendor_name => d.owner.name, :vendor_id => d.owner.id, :initial_state => d.owner.initial_state, :is_open => d.owner.open }\n\t\telse\n\t\t\trender :json => {:error => \"unregistered_device\", :token => params[:device_token]}\n\t\tend\n\tend",
"def request_filter(data)\n flt = Stopwatch.new\n flt.watch('start')\n if !request_valid?(data)\n sql = \"SELECT 1;\"\n return sql\n end\n guid = Tools::guid\n cols, vals = String.new, String.new\n lkey, rkey = String.new, String.new\n sql_ua, json_data_pieces = String.new, String.new\n t = 0\n json_data_hdr = '{ \"http\": { '\n json_data_ftr = \" } }\"\n sql = \"INSERT INTO #{@reqtable} (recv_time,recv_date,guid,json_data) \"\n data.each_line {|n|\n unless n.strip == \"\"\n if t > 0 # Don't processes GET / POST Line\n lkey, rkey = lkey_strip(n), rkey_strip(n)\n puts \"LKEY: #{lkey} RKEY: #{rkey}\" if @debug == true\n rkeyenc = filter_header?(lkey)\n if rkeyenc == false\n rkeyenc = rkey_decode(rkey)\n if lkey == \"useragent\"\n ua = Tools::ua_parser(rkeyenc)\n sql_ua = \"INSERT INTO #{@reqtableua} (family, \"\n sql_ua << \"major, minor, \" unless ua.version == nil\n sql_ua << \"os, guid) \"\n sql_ua << \"VALUES ('#{ua.family}', \"\n sql_ua << \"'#{ua.version.major}', '#{ua.version.minor}', \" unless ua.version == nil\n sql_ua << \"'#{ua.os.to_s}', '#{guid}');\"\n end\n else \n rkey = \"ommited\"\n end\n if rkey != \"\" or lkey != \"\"\n prerkeyins = rkey.gsub('\"', '') # Strip Quotes\n prerkeyins = \"blank\" if prerkeyins.strip == \"\" # Seems JSON values can't be \"accept\":\"\"\n puts \"Found Blank Value!!!\" if prerkeyins == \"blank\"\n json_data_pieces << %Q{\"#{lkey}\": \"#{prerkeyins}\",} if lkey != \"useragent\"\n end\n end\n t += 1\n end\n }\n # Store the URL in the JSON unless its blank\n # Build JSON Manually as i bet its faster than using some JSON encoder where it has to convert from Array etc.\n json_data_pieces << %Q{\"url\":\"#{@makeurl_last}\",\"} unless @makeurl_last == \"\"\n # SQL for Datastore\n begin\n # Remove last , to fix hash table\n json_data_pieces.sub!(%r{,\"$}, \"\")\n json_data = \"#{json_data_hdr}#{json_data_pieces}#{json_data_ftr}\"\n puts \"\\e[4;36mJSON Data:\\e[0m\\ \\n#{json_data}\"\n puts \"JSON Data: #{json_data}\" if @debug == true\n # Added GUID as i could extend TCP/IP capture suites in the future for HTTP traffic \n sql = \"#{sql}VALUES (NOW(), NOW(), '#{guid}', '#{json_data}');\"\n flt.watch('stop')\n print \"\\e[4;36mFilter Time Taken:\\e[0m\\ \"\n flt.print_stats\n return [sql, sql_ua]\n rescue => e\n pp e\n end\n end",
"def malformed_request?\n from_json\n @coffee.nil? || @order.nil?\n end",
"def data(code, params)\n {\n :code => code,\n :flg => params.flags,\n :ver => params.version\n }\n end",
"def isvalid?(code:)\n @channel.each { |k,v| return true if code == v[:code] }\n return false\n end",
"def is_checksum_valid?(received_params)\n paytmparams = Hash.new\n\n keys = received_params.keys\n keys.each do |k|\n paytmparams[k] = received_params[k]\n end\n\n checksum_hash = paytmparams[\"CHECKSUMHASH\"]\n paytmparams.delete(\"CHECKSUMHASH\")\n\n Rails.logger.debug \"HERE\"\n Rails.logger.debug \"paytmparams #{paytmparams}\"\n Rails.logger.debug \"checksum_hash #{checksum_hash}\"\n Rails.logger.debug \"PAYTM_MERCHANT_KEY #{ENV[\"PAYTM_MERCHANT_KEY\"]}\" \n \n return new_pg_verify_checksum(paytmparams, checksum_hash, ENV[\"PAYTM_MERCHANT_KEY\"])\n end",
"def valid_params?(params)\n params.keys.each do |key|\n unless RealPush::API::App.params_accept.include? key.to_sym\n raise ConfigurationError, \"Invalid parameter! ( #{RealPush::API::App.params_accept.join(', ')} )\"\n end\n end\n true\n end",
"def valid?(json:)\n return false unless json.present?\n\n json[:type].present? && json[:identifier].present?\n end",
"def response?(params); end",
"def check \n\t\tdatadb = Register.where(name: params[:name], password: params[:pass])\n\n if datadb.exists? \n token = params[:token]\n \n tokening = \"key=\"+token\n \n puts tokening \n phone_id = datadb.pluck(:phone)\n phoneid = phone_id[0]\n puts phoneid\n formid = Userdet.where(usid: phoneid).all\n \n mill_id = formid.pluck(:windmill)\n leng = mill_id.length\n \n n = 0\n for i in 1..leng do \n millid = mill_id[n]\n puts millid\n b = formid.find_by(windmill: millid )\n b.mobile_token = tokening\n if b.save\n puts \"success\"\n else\n puts \"no\"\n end\n\n n +=1\n \n \n end\n \n\n \n \n \n render json: datadb.as_json(only: [:role, :phone])\n else\n render json: [{role: \"inu\"}]\n\tend\n\t\t\n\tend",
"def format_authentication_data(data)\n # return unless data.present?\n return if data.blank?\n response.headers.merge!(data[:headers]) if data[:headers].present?\n # return unless data[:body].present?\n return if data[:body].blank?\n render json: data[:body], status: status_for_response(data[:code])\n false\n end",
"def nagammai_connection_data\n \n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in wondersoft_connection_data\"\n begin\n wonder_soft_data=WonderSoft.first\n render json: wonder_soft_data\n unless wonder_soft_data.present?\n Rails.logger.debug_log.debug { \"#{\"sync_setting data not available\"}\"}\n end\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} sync_setting_controller wondersoft_connection_data method\" }\n end\n end",
"def response?(params)\n params.key?('responseStatusCode') || params.key?('responseErrorReason')\n end",
"def verify_params(params)\n return false if params['Body'].to_s.empty?\n return false if params['Body'].to_s.bytes.size > 1600\n return false unless /\\+\\d+$/.match(params['To'])\n true\n end",
"def check_device_register_json_response(device, json_result)\n xmpp_account = TestingDevice.new(@device_given_attrs).xmpp_account\n expect(json_result[\"xmpp_account\"]).to eq(xmpp_account)\n expect(json_result[\"xmpp_bots\"]).to eq(Settings.xmpp.bots)\n expect(json_result[\"xmpp_ip_addresses\"]).to eq(Settings.xmpp.nodes)\nend",
"def getDataForBeaconStore\n if params[:type].present? && params[:beacon_uid].present? && params[:item_id].present?\n if params[:type]==\"getDataForBeaconStore\"\n #Check is this item is actually associated with the beacon provided\n if(params[:beacon_uid]==Beacon.find(Item.find(params[:item_id]).beacon_id).uid)\n #If Yes, return notes associated with that particular item\n @note = Note.where(:item_id => Item.where(:id => params[:item_id]))\n else\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Beacon & Item Don't Match\"}\n end\n else\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Wrong Type\"}\n end\n else\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Missing Attribute\"}\n end\n end",
"def post_data\n message=\"\"\n data_gpr_params = { :id => params[:id],:microarraygpr_id => params[:microarraygpr_id],:gpr_header_id => params[:gpr_header_id],:gal_block_id => params[:gal_block_id],:oligo_row => params[:oligo_row],:oligo_column => params[:oligo_column],:oligo_id => params[:oligo_id],:oligo_name => params[:oligo_name],:x => params[:x],:y => params[:y],:dia => params[:dia],:f635_median => params[:f635_median],:f635_mean => params[:f635_mean],:f635_sd => params[:f635_sd],:f635_cv => params[:f635_cv],:b635 => params[:b635],:b635_Median => params[:b635_Median],:b635_mean => params[:b635_mean],:b635_sd => params[:b635_sd],:b635_cv => params[:b635_cv],:percent_b635_1_sd => params[:percent_b635_1_sd],:percent_b635_2_sd => params[:percent_b635_2_sd],:f635_perc_sat => params[:f635_perc_sat],:f532_median => params[:f532_median],:f532_mean => params[:f532_mean],:f532_sd => params[:f532_sd],:f532_cv => params[:f532_cv],:b532 => params[:b532],:b532_median => params[:b532_median],:b532_mean => params[:b532_mean],:b532_sd => params[:b532_sd],:b532_cv => params[:b532_cv],:percent_b532_1_sd => params[:percent_b532_1_sd],:percent_b532_2_sd => params[:percent_b532_2_sd],:f532_perc_sat => params[:f532_perc_sat],:ratio_of_medians => params[:ratio_of_medians],:ratio_of_means => params[:ratio_of_means],:median_of_ratios => params[:median_of_ratios],:mean_of_ratios => params[:mean_of_ratios],:ratios_sd => params[:ratios_sd],:rgn_ratio => params[:rgn_ratio],:rgn_r2 => params[:rgn_r2],:f_pixels => params[:f_pixels],:b_pixels => params[:b_pixels],:circularity => params[:circularity],:sum_of_medians => params[:sum_of_medians],:sum_of_means => params[:sum_of_means],:log_ratio => params[:log_ratio],:f635_median_minus_b635 => params[:f635_median_minus_b635],:f532_median_minus_b635 => params[:f532_median_minus_b635],:f635_mean_minus_b635 => params[:f635_mean_minus_b635],:f532_mean_minus_b635 => params[:f532_mean_minus_b635],:f635_total_intensity => params[:f635_total_intensity],:f532_total_intensity => params[:f532_total_intensity],:snr_635 => params[:snr_635],:snr_532 => params[:snr_532],:flags => params[:flags],:normalize => params[:normalize],:autoflag => params[:autoflag] }\n case params[:oper]\n when 'add'\n if params[\"id\"] == \"_empty\"\n data_gpr = DataGpr.create(data_gpr_params)\n message << ('add ok') if data_gpr.errors.empty?\n end\n \n when 'edit'\n data_gpr = DataGpr.find(params[:id])\n message << ('update ok') if data_gpr.update_attributes(data_gpr_params)\n when 'del'\n DataGpr.destroy_all(:id => params[:id].split(\",\"))\n message << ('del ok')\n when 'sort'\n data_gpr = DataGpr.all\n data_gpr.each do |data_gpr|\n data_gpr.position = params['ids'].index(data_gpr.id.to_s) + 1 if params['ids'].index(data_gpr.id.to_s) \n data_gpr.save\n end\n message << \"sort ak\"\n else\n message << ('unknown action')\n end\n \n unless (data_gpr && data_gpr.errors).blank? \n data_gpr.errors.entries.each do |error|\n message << \"<strong>#{DataGpr.human_attribute_name(error[0])}</strong> : #{error[1]}<br/>\"\n end\n render :json =>[false,message]\n else\n render :json => [true,message] \n end\n end",
"def process_data\n begin\n data = ::ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(received_data))\n packet = ::Syncano::Packets::Base.instantize_packet(data)\n\n if packet.notification?\n notification = ::Syncano::Resources::Notifications::Base.instantize_notification(client, packet)\n\n callbacks_queue.each do |callback_name|\n callbacks[callback_name].call(notification)\n end\n elsif packet.call_response?\n queue_response(packet)\n elsif packet.auth?\n queue_response(packet)\n end\n\n self.received_data = ''\n rescue Exception => e\n p 'EXCEPTION!'\n p e.inspect\n end\n end",
"def validate_request \n\t\tval_required='required'\n\t\tdata_val_required='data_required'\n\t\tuser_id=\"\";\n\t\tclient_id=\"\";\n\t\tsession_id=\"\";\n\t\t\n\t\tif(cookies[:user_id])\n\t\t\tuser_id= cookies[:user_id].to_s\n\t\tend\n\t\t\n\t\tif(cookies[:client_id])\n\t\t\tclient_id= cookies[:client_id].to_s\n\t\tend\n\t\t\n\t\tif(cookies[:session_id])\n\t\t\tsession_id= cookies[:session_id].to_s\n\t\tend\n\t\t\n\t\tif client_id.empty? == true || session_id.empty? == true\n\t\t\tlogger.debug \"Client not found for client_id=\" + client_id\n\t\t\tcoockies_render_error('e1011',params[:response_type].to_s) \n\t\t\treturn false\n\t\tend\n\t\t\n\t\t@client=Client.where(pk_client_id: client_id)\t\t\n\t\tif (@client.count<=0)\n\t\t\tlogger.debug \"Client not found for client_id=\" + client_id\n\t\t\tcoockies_render_error('e1011',params[:response_type].to_s) \n\t\t\treturn false\n\t\tend\t\t\t\n\t\t\n\t\t@device_users=DeviceUser.where(fk_client_id: client_id, pk_user_id: user_id, sessionid: session_id) \n\t\t\n\t\tif (@device_users.count<=0)\t\n\t\t\tlogger.debug \"device_users not found for client_id=\" + client_id+ \" and session_id=\" + session_id + \" \"\n\t\t\tcoockies_render_error('e1012',params[:response_type].to_s) \n\t\t\treturn false\n\t\telse\n\t\t\tif @device_users[0][:status_code] == 403\n\t\t\t\tcoockies_render_error('e2203',params[:response_type].to_s) \n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\tif @device_users[0][:status_code] == 402\n\t\t\t\tcoockies_render_error('e2204',params[:response_type].to_s) \n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\n\t\tparams[:user_id]=user_id\n\t\tparams[:client_id]=client_id\n\t\tparams[:session_id]=session_id\n\t\t\n\t\treturn true\n\tend",
"def check_key_data(record, ref_data, resp_data,\n exclude = nil, # exclude from db check.\n allow = nil, augment = true, # extra GET /keys items\n disallow = nil, line = nil)\n # XXX validate internally-generated db fields.\n must_exclude = [:time_constraints, :admin]\n exclude = exclude ? exclude + must_exclude : must_exclude\n # Allow skipping check_data.\n if (record && ref_data)\n check_data(record, ref_data, exclude, nil, disallow, line)\n end\n # Allow skipping reply check.\n if !resp_data\n return\n end\n\n non_db = [ \"bluetooth_address\",\n \"first_name\", \"last_name\", \"email\",\n \"user_display_name\", \"time_constraints\", \"lock_time_zone\" ]\n server_time = augment ? [:server_time] : []\n # reply splits into two sub-hashes.\n key_data = resp_data[\"key_data\"]\n key_info = resp_data[\"key_info\"]\n assert_not_nil key_data, \"key_data present\"\n assert_not_nil key_info, \"key_info present\"\n check_reply(json: key_data, model: record,\n elsewhere: non_db, allow: @@key_data_fields,\n exclude: [\"seq_no\"], augment: nil)\n # id present due to global rule in key_info, but not required\n check_reply(json: key_info, model: record,\n elsewhere: non_db, exclude: @@key_data_fields,\n augment: server_time)\n assert_equal record.lock.bluetooth_address, key_info[\"bluetooth_address\"], \"bluetooth_address\"\n assert_equal record.lock.name, key_info[\"name\"], \"name\"\n assert date_match(record.last_access, key_info[\"last_access\"]), \"last_access\"\n assert_equal record.user.account.first_name, key_info[\"first_name\"], \"first_name\"\n assert_equal record.user.account.last_name, key_info[\"last_name\"], \"last_name\"\n assert_equal record.user.account.email, key_info[\"email\"], \"email\"\n assert_equal record.user.display_name, key_info[\"user_display_name\"], \"user_display_name\"\n assert_equal record.lock.time_zone, key_info[\"lock_time_zone\"], \"time_zone\"\n # XXX admin\n\n check_key_time_constraints(record, key_data, key_info)\n\n #/locks doesn't include the same fields as /keys, so ignore these checks for GET /locks\n if (!ref_data && augment)\n # get /keys has extra fields\n admin = key_info['admin']\n auto_generated = key_info['auto_generated']\n lock_owner_key = key_info['lock_owner_key']\n assert_boolean_equal admin || lock_owner_key, auto_generated, \"auto_generated equals admin || lock_owner_key\"\n assert_boolean_equal record.lock.user_id == record.user_id, lock_owner_key, \"lock_owner_key equals record.lock.user_id == record.user_id\"\n lu = LocksUser.where(:lock_id => record.lock.id,\n :user_id => record.user_id)\n assert_boolean_equal (lu.count > 0) && lu.first.admin, admin, \"admin matches LocksUser\"\n # XXX lock_owner_display_name, sharer_display_name\n end\n end",
"def send_data(data)\n jsonified_data = data.to_json\n log('sending', jsonified_data)\n super(jsonified_data)\n end",
"def phonePayment\n @token = request.headers['HTTP_X_API_POP_KEY']\n @playerID = params[:oneSignalID]\n @phone = params[:phone]\n @amount = params[:amount]\n @password = params[:password]\n @lat = params[:latitude]\n @long = params[:longitude]\n @ip = request.remote_ip\n\n begin\n\n #Recherche de ce numero sur la plateforme\n # check token of sender of request\n if @token.present? && @phone.present? && @amount.present? && @password.present?\n customer = Customer.find_by_authentication_token(@token)\n if customer.blank?\n render json: {\n status: false,\n message: \"Utilisateur inconnu\"\n }\n else\n #tout va bien, l'utilisateur payeur est connu, check the phone number\n #find if this number is not registrated to the plateforme\n payment = External::DemoUsers.Pay(token: @token, password: @password, phone: @phone, amount: @amount, ip: @ip, lat: @lat, long: @long, oneSignalID: @playerID)\n puts \"From Payment : #{payment}\"\n render json: {\n status: payment[0],\n message: payment[1]\n }\n\n end\n else\n render json: {\n status: false,\n message: \"Certaines informations sont absentes.\"\n }\n end\n\n rescue ActiveRecord::RecordNotFound\n\n render json: {\n status: false,\n message: \"Utilisateur inconnu de la plateforme\"\n }\n\n end\n\n end",
"def required_params_present?\n\n render json: {error: 'Missing required parameter: result'},\n status: :bad_request and return false unless params[:result]\n\n render json: {error: 'Missing required parameter: result.result_type'},\n status: :bad_request and return false unless params[:result][:result_type]\n\n # Manual Results are required to provide the execution id.\n # All other results are required to provide the project_id\n if params['result']['result_type'] == 'manual'\n render json: {error: 'Missing required parameter: result.execution_id'},\n status: :bad_request and return false unless params[:result][:execution_id]\n else\n render json: {error: 'Missing required parameter: result.project_id'},\n status: :bad_request and return false unless params[:result][:project_id]\n end\n\n\n render json: {error: 'Missing required parameter: result.testcase_id'},\n status: :bad_request and return false unless params[:result][:testcase_id]\n\n render json: {error: 'Missing required parameter: result.environment_id'},\n status: :bad_request and return false unless params[:result][:environment_id]\n\n\n render json: {error: 'Missing required parameter: result.status'},\n status: :bad_request and return false unless params[:result][:status]\n\n true\n end",
"def might_respond_to?(data)\n data.respond_to?(:text) && !data.text.nil? && (data.user != client.self.id)\n end",
"def phone_number_check_code(code, request_id)\n return_code, response = send_command(\"phone_number/check_code\", token, \n {:code => code, :request_id => request_id})\n return return_code == \"200\"\n end",
"def submitSessionInfos\n # check if data submission is offline\n is_offline_sensor_data_collection = false\n\n # not having valid device id or device type. \n if params.has_key?(:uid) == true && !params[:uid].empty?\n @deviceType = nil\n if (\n params.has_key?(:did) == false || params[:did].empty? || \n params.has_key?(:dtype) == false || params[:dtype].empty? ||\n (@deviceType = DeviceType.where(name: params[:dtype]).first) == nil || \n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first) == nil\n ) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n if (\n params.has_key?(:sensor_infos) == false || params[:sensor_infos].empty? || \n params[:sensor_infos].kind_of?(Array) == false || params[:sensor_infos].count == 0\n )\n render json: { 'status' => 'OK' }.to_json\n end\n\n # check device pairing. \n @deviceId = params[:did]\n if isPairedDeviceValid(@deviceId, params[:uid]) == false\n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n needToCreateSession = false\n if params.has_key?(:is_initiator) && params[:is_initiator] == true\n needToCreateSession = true\n else\n # check if devicepairconnotp is not expired yet\n @devicepairconnections = @devicepairs.ute_device_pair_connections.where(\n :expire_by.gte => Time.now.getutc.to_f, \n :is_active => true\n )\n firststartdate = params[:sensor_infos][0][:t]\n @devicepairconnections.each do |devicepairconnection|\n si = devicepairconnection.ute_ex_session\n unless si.nil?\n if firststartdate > si.range_start_at && firststartdate < si.range_end_at \n #found the paired connection\n @devicepairconnection = devicepairconnection\n @session = @devicepairconnection.ute_ex_session\n break\n end\n end\n end\n\n if @devicepairconnection == nil && @session == nil \n #session to pair is not found\n render json: { 'status' => 'FAILED', 'code' => 404 }.to_json\n return\n end\n end\n\n if needToCreateSession \n # create new session\n @sessionId = generateNewSessionId\n\n while isSessionIdAlreadyExist(@experiment.experiment_code, @sessionId) do\n @sessionId = generateNewSessionId\n end\n\n @session = @experiment.ute_ex_sessions.create!(\n session_code: @sessionId,\n is_active: true,\n initiated_by_device_id: @deviceId,\n is_created_offline: true\n )\n end\n\n if @session\n @sessionConnection = @session.ute_ex_session_connections.create!(device_id: @deviceId, device_model: params[\"model\"], device_type: @deviceType.id, is_active: true, connected_at: params[:sensor_infos][0][:t])\n \n @devicepairconnotp = generateNewDevicePairConnOtp\n\n while isActiveDevicePairConnOtpAlreadyExist(@devicepairs, @devicepairconnotp) do\n @devicepairconnotp = generateNewDevicePairConnOtp\n end\n\n dpc = @devicepairs.ute_device_pair_connections.new(\n is_active: true,\n otp: @devicepairconnotp,\n expire_by: Time.now.getutc.to_f + OTP_DEVICE_PAIR_CONN_LIFETIME, \n ute_ex_session: @session\n )\n dpc.save! \n\n @session.ute_device_pair_connection = dpc\n @session.save!\n\n is_offline_sensor_data_collection = true\n end\n end \n\n if isDataSubmissionInvalidForExpAndSession(request, params) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n begin\n if params.has_key?(:sensor_infos) && params[:sensor_infos].empty? == false\n UteDataSubmissionService.delay.handlesensorinfos(@session, @sessionConnection, params)\n end\n rescue => e\n puts(e.message)\n raise 'an error has occured'\n #puts(e.backtrace.join(\"\\n\"))\n end\n\n #begin\n # if params.has_key?(:sensor_infos) && params[:sensor_infos].empty? == false\n # puts('receiving first item: ' + params[:sensor_infos][0][:t].to_s)\n # end\n #rescue => e\n # puts('TRY TO RESCUE')\n #\n # puts(e.message)\n # raise 'an error has occured'\n # #puts(e.backtrace.join(\"\\n\"))\n #end\n\n if @devicepairconnection != nil && is_offline_sensor_data_collection \n #otp needs to be renewed\n @devicepairconnection.update_attributes(\n expire_by: Time.now.getutc.to_f + OTP_DEVICE_PAIR_CONN_LIFETIME\n )\n end \n \n if is_offline_sensor_data_collection\n render json: { 'status' => 'OK', 'otp' => @devicepairconnotp, 'session_id' => @session.session_code }.to_json\n else\n render json: { 'status' => 'OK' }.to_json\n end\n end",
"def check_parameters\n\n # read the parameter version in the database and in the device \n read_parameter_from_device(0)\n @params.each do |p|\n if p['id'] == 0\n @param_version_ar = p['value_ar']\n end\n end\n\n @param_version_db = @bot_dbaccess.read_parameter_with_default('PARAM_VERSION', 0)\n\n # if the parameters in the device is different from the database parameter version\n # read and compare each parameter and write to device is different\n if @param_version_db != @param_version_ar\n load_param_values_non_arduino()\n differences_found_total = false\n @params.each do |p|\n if p['id'] > 0\n difference = check_and_write_parameter(p)\n if difference then\n @params_in_sync = false\n differences_found_total = true\n end\n end\n end\n if !differences_found_total\n @params_in_sync = true\n write_parameter_to_device(0, @param_version_db)\n else\n @params_in_sync = false\n end\n end\n end",
"def should_respond?\n return false unless @data.is_a?(Hash)\n return @data[:process_results] if @data.include?(:process_results)\n return @data[\"process_results\"] if @data.include?(\"process_results\")\n\n true\n end",
"def send_data hash\n raise 'not implemented'\n end",
"def get_device( id_or_uid)\n \n # try to find with device id\n @device = Device.where(\"id = ? OR uid= ?\", id_or_uid.to_i, id_or_uid).take\n \n \n rescue ActiveRecord::RecordNotFound\n render json: {:message => \"Device not found\", :code => 404} , :status => :not_found\n return false\n \n end",
"def create_json_request(code)\n parameters = {\n \t\"code\" => code,\n\t\"level\" => self.level,\n\t\"format\" => \"json\",\n\t\"info\" => self.op\n }\n end",
"def ok?\n [ :remote_addr, :price, :subscription_id, :transaction_id, :checksum , :jurnalo_user_id ].inject( true ){ |s,x| s && !(send(x).blank?) }\n end",
"def received(data, command)\n\t\tlogger.debug \"Extron IPCP sent #{data}\"\n\t\t\n\t\tif command.nil? && data =~ /Copyright/i\n\t\t\tpass = setting(:password)\n\t\t\tif pass.nil?\n\t\t\t\tdevice_ready\n\t\t\telse\n\t\t\t\tdo_send(pass)\t\t# Password set\n\t\t\tend\n\t\telsif data =~ /Login/i\n\t\t\tdevice_ready\n\t\telse\n\t\t\tcase data[0..2].to_sym\n\t\t\twhen :Irs\t# IR Sent\n\t\t\twhen :Cpn\t# IO or Relay\n\t\t\t\tport = data[3..-1].to_i\n\t\t\t\t\n\t\t\t\tdata = data.split(' ')[1]\n\t\t\t\tcase data[0..2]\n\t\t\t\twhen 'Iom'\t# IO mode\n\t\t\t\t\tdata = data[3..-1].split(',')\n\t\t\t\t\tself[\"IO#{port}_mode\"] = data[0].to_i\n\t\t\t\t\tif data.length > 1\n\t\t\t\t\t\tself[\"IO#{port}_upper\"] = data[1].to_i\n\t\t\t\t\t\tself[\"IO#{port}_lower\"] = data[2].to_i\n\t\t\t\t\tend\n\t\t\t\twhen 'Sio'\n\t\t\t\t\tself[\"IO#{port}\"] = data[3..-1].to_i\n\t\t\t\t\t\n\t\t\t\twhen 'Rly'\t\t\t\t\t\t# Relay\n\t\t\t\t\tself[\"relay#{port}\"] = data[3..-1].to_i == 1\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\twhen :Dcp\t# Power\n\t\t\t\tdata = data.split('*')\n\t\t\t\tport = data[0][5..-1].to_i\n\t\t\t\tself[\"power#{port}\"] = data[1] == '1'\n\t\t\telse\n\t\t\t\tif data == 'E22'\t# Busy! We should retry this one\n\t\t\t\t\tsleep(1)\n\t\t\t\t\treturn :failed\n\t\t\t\telsif data[0] == 'E'\n\t\t\t\t\tlogger.info \"Extron Error #{ERRORS[data[1..2].to_i]}\"\n\t\t\t\t\tlogger.info \"- for command #{command[:data]}\" unless command.nil?\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn :success\n\tend",
"def create_device\n phone = Phone.where('uuid=?', params[:device_uuid]).first\n if phone\n phone.token = params[:regId]\n phone.save\n else\n if params[:is_android] == \"true\"\n p = Phone.create(:is_android => true, :uuid => params[:device_uuid] , :token => params[:regId])\n else\n p = Phone.create(:is_android => false, :uuid => params[:device_uuid] , :token => params[:regId])\n end\n end\n render :status=>200, :json=>{:success=>\"1\", :message=>\"Success\"}\n end",
"def availability_check_response(_msg_id, data)\n if false\n response = JSON.parse(data)\n # TODO: format of fifi_ready value is not defined yet\n status = response['result'] == 'ok' && response['fifi_ready'].to_i == 1 ? STATUS_AVAILABLE : STATUS_UNAVAILABLE\n\n if status == STATUS_UNAVAILABLE\n logger.warn(\"Source #{source_id} is unavailable. Reason: #{response['message']}\")\n end\n\n update_source(source_id, status)\n else\n # woohoo, always successful\n update_source(source_id, STATUS_AVAILABLE)\n end\n end",
"def valid?\n unless @json.class == Hash\n return false\n end\n\n unless @json['method'].class == String\n return false\n end\n\n unless @json['params'].class == Array\n return false\n end\n\n return true\n end",
"def process_cmd(data)\n ##Dyndoc.warn \"process_cmd\",data\n if data =~ /^__send_cmd__\\[\\[(.*)\\]\\]__/\n ##cmd=\"do_\"+$1+\"(\\\"\"+$'+\"\\\")\"\n cmd,param=$1,$'\n ##puts \"cmd\";p cmd;puts \"param\";p param\n param.empty? ? method(\"do__\"+cmd).call : method(\"do__\"+cmd).call(param)\n return true\n else \n return nil\n end\n end",
"def send_json_packet(op_code, data)\n LOGGER.debug { \"Sending #{OPCODES[op_code]} #{data}\" }\n payload = { op: op_code, d: data }\n @websocket.send_json(payload)\n end",
"def _new_data_from_device__LM_D_2_v_0\n \n if !params[Const::SL::PASSWD_SL_Key] and\n !params[Const::LM::PASSWD_LM_Key]\n \n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n \"!params['passwd_sl'](params => #{params.keys}\",\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n \n return false\n \n else#if !params['passwd_sl']\n \n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n \"params['passwd_sl'] => \" + params['passwd_sl'].to_s,\n #\"params['passwd'] => \" + params['passwd'].to_s,\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n=begin \n #REF app name // http://stackoverflow.com/questions/3539148/how-do-i-access-the-name-of-the-rails-3-application-object Rails.application.class.to_s.split(\"::\").first\n #REF method name // http://stackoverflow.com/questions/6426598/how-to-get-current-method-in-rails-3 answered Jun 21 '11 at 15:53\n #REF cont name // http://stackoverflow.com/questions/3757491/can-i-get-the-name-of-the-current-controller-in-the-view answered Sep 21 '10 at 5:27\n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n \"#{Rails.application.class.to_s.split(\"::\").first} \n #{params[:controller]} # #{__method__}\",\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n=end\n msg = \"\"\n \n if params[Const::SL::PASSWD_SL_Key] \\\n == Const::SL::PASSWD_SL_NewItem\n \n msg = _new_data_from_device_NewItem\n \n elsif params[Const::SL::PASSWD_SL_Key] \\\n == Const::SL::PASSWD_SL_PurHist#if params['passwd_sl'] == Const::SL::PASSWD_SL_NEW\n \n msg = _new_data_from_device_PurHist\n \n elsif params[Const::LM::PASSWD_LM_Key] \\\n == Const::LM::PASSWD_LM_NewLoc#if params['passwd_sl'] == Const::SL::PASSWD_SL_NEW\n \n msg = _new_data_from_device_NewLoc\n \n end#if params['passwd_sl'] == Const::SL::PASSWD_SL_NEW\n \n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n msg,\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n \n return true\n \n end#if !params['passwd_sl']\n \n end",
"def json_input?\n return request.content_type == 'application/json'\n end",
"def usbchip_validate_register\n @user = User.find_by_edutorid(params[:user_id])\n @device = Device.find_by_deviceid(params[:device_id])\n if @user.nil?\n respond_to do |format|\n format.json { render json: {:chip_accepted=>false,:error=>'Invalid User'} }\n end\n return\n end\n\n if @device.nil?\n respond_to do |format|\n format.json { render json: {:chip_accepted=>false,:error=>'Invalid Device'} }\n end\n return\n end \n\n @slots = Slot.where(:serialnum=>params[\"serial\"]).order(\"jobid desc\")\n if @slots.empty?\n respond_to do |format|\n format.json { render json: {:chip_accepted=>false,:error=>\"Invalid JobID\"}}\n end\n return \n end\n\n \n if @user.institution_id != 51827\n if !@slots.empty?\n @job = Job.where(\"jobid = #{@slots.first.jobid} and jobname like '%WriteProtect.mlj'\")\n \n if @job.empty?\n respond_to do |format|\n format.json { render json: {:chip_accepted=>false,:error=>\"Invalid JobID\"}}\n end\n return\n end\n end\n end\n if @user.institution_id != 51827\n @chip_present = IgnitorUserChip.find_by_serialnum(params[\"serial\"])\n\n if !@chip_present.nil?\n if @chip_present.user_id == @user.id\n respond_to do |format|\n format.json { render json: {:chip_accepted=>true,:error=>'Already Assigned'} }\n end\n return\n else\n respond_to do |format|\n format.json { render json: {:chip_accepted=>false,:error=>\"Chip Already Assigned to #{@chip_present.user_id}\"} }\n end\n return\n end\n end\n end\n\n @chip = IgnitorUserChip.new\n @chip.user_id = @user.id\n @chip.device_id = @device.id\n @chip.serialnum = params[\"serial\"]\n @chip.pid = params[\"pid\"]\n @chip.vid = params[\"vid\"]\n if @chip.save\n respond_to do |format|\n format.json { render json: {:chip_accepted=>true} }\n end\n else\n respond_to do |format|\n format.json { render json: {:chip_accepted=>false,:error=>@chip.errors} }\n end\n end\n \nend",
"def verify_signature(data)\n Signature.valid?(data.merge('api_key' => api_key))\n end",
"def json_request?()\n request.format.json?\n end",
"def check_command_group\n if clientdata?\n response_bad_sequence\n end\n end",
"def receive_data data\n @buf.extract(data).each do |packet|\n begin\n request = JSON::parse(packet)\n log.debug { request }\n case request['method']\n when \"relay_tx\"\n return handle_relay_tx(request, *request['params'])\n when \"monitor\"\n respond(request, handle_monitor(request, *request['params']))\n else\n if respond_to?(\"handle_#{request['method']}\")\n respond(request, send(\"handle_#{request['method']}\", *request['params']))\n else\n respond(request, { error: \"unknown command: #{request['method']}. send 'help' for help.\" })\n end\n end\n rescue\n respond(request, { error: $!.message })\n end\n end\n rescue Exception\n p $!; puts *$@\n end",
"def success_with_data(data)\n\n # Allow only Hash data to pass ahead\n data = {} unless Util::CommonValidator.is_a_hash?(data)\n\n OstKycSdkRuby::Util::Result.success({data: data})\n\n end",
"def request_device?(device)\n (request.user_agent.to_s.downcase =~ (Mobylette.devices.device(device) || %r{not_to_be_matched_please}) ? true : false)\n end",
"def check_code(url_data)\n if url_data[:response].code != '200'\n url_data[:notifs].push(\"slack-tech\")\n\n if @app_errors[\"#{url_data[:name]}\"]\n @app_errors[\"#{url_data[:name]}\"] += 1\n else\n @app_errors[\"#{url_data[:name]}\"] = 1\n end\n\n if @app_errors[\"#{url_data[:name]}\"] > 5\n restart_app(url_data[:restart])\n url_data[:notifs].push(\"email\")\n end\n\n if @app_errors[\"#{url_data[:name]}\"] > 10\n url_data[:notifs].push(\"sms\")\n end\n\n else\n @app_errors[\"#{url_data[:name]}\"] = 0\n end\n end",
"def receive_plates_process?(params)\n @receive_plates_process ||=\n InstrumentProcess.find_by(id: params[:instrument_process]).key.eql?(\"slf_receive_plates\")\n end",
"def json_request?\n request.format.json?\n end",
"def data_satisfy?(data = {})\n jdata = JsonPath.new(['$.', json_path].join).first(data.to_json)\n return false unless jdata.present?\n mapped_conditions[cond_op.to_sym].call(jdata)\n end",
"def check_params_and_create(params)\n\n # is there a valid category_id\n program = Program.where(name: params[\"category_id\"]).take\n if program.present?\n\n # is there a valid barcode\n card = User.barcode_in_program(program, params[\"barcode\"]).take\n\n if card.present?\n return card\n end #card.any?\n\n # is there a device_id\n card = User.device_in_program(program, params[\"device_id\"]).take\n\n if card.present?\n return card\n elsif params[\"device_id\"].present?\n barcode = calculate_ean13\n card = create_new_card(barcode, program, params[\"device_id\"])\n return card\n end #(card.any?) &&\n\n return nil ## niet genoeg informatie, foutief verzoek\n\n else\n return nil ## category_id is altijd verplicht\n end #Program.where(name: pa\n\n end",
"def valid(data)\n return data && data[0] && data[1]\n end",
"def ensure_param_exists(param)\n\t return unless params[param].blank?\n\t render json:{ success: false, error: \"Missing #{param} parameter\"}, status: :unprocessable_entity\n\t end",
"def code\n @code = params[:code]\n @token = request.headers[\"HTTP_X_API_POP_KEY\"]\n @ip = request.remote_ip\n\n begin\n\n #uniquement si le code est un entier\n @customer = Customer.find_by_code(@code)\n if @customer.blank?\n render json: {\n message: false,\n flag: :customer_not_found\n }\n else\n #on retourne les informations\n\n render json: {\n message: true,\n context: searchContext(@customer),\n name: @customer.name,\n second_name: @customer.second_name,\n marchand_id: @customer.authentication_token,\n date: Time.now.strftime(\"%d-%m-%Y à %H:%M:%S\"),\n expire: 5.minutes.from_now\n }\n end\n \n rescue ActiveRecord::RecordNotFound\n\n render json: {\n message: false,\n content: \"Utilisateur inconnu\"\n }\n \n end\n end",
"def validate_param\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate_param(@arguments.keys.first.to_s, @arguments.values.first)\n render json: { success: 'Param looks like the right data type! good job!' }, status: 200\n end\n end",
"def check_info\n connection = Connection.where(group_id: params[:group_id], contact_id: params[:contact_id]).first\n json_details = if connection.present?\n {\n status: true,\n delete_connection_url: connection_path(connection),\n connection_id: connection\n }\n else\n { status: false }\n end\n render json: json_details\n end",
"def check_parameter\n \t# response to the JSON if searchterm or sort_type is not present.\n \trender json: {success: false, message: 'Something wrong with the parameters'}, status: 400 if (params[:searchterm].nil? || params[:sort_type].nil?)\n end",
"def validate_parameters(sent_parameters)\n valid_parameters = nil\n if sent_parameters.is_a?(JamendoParameters)\n valid_parameters = sent_parameters.to_hash\n elsif sent_parameters.is_a?(Hash)\n valid_parameters = format_parameters(sent_parameters)\n elsif sent_parameters.is_a?(String)\n valid_parameters = Hash.new\n valid_parameters = { artist: sent_parameters }\n else\n raise JamendoError(\"Imposible to handle parameter you provided.\")\n end\n return valid_parameters\n #sent_parameters.select! { | param, value | valid_parameters.include?(param) }\n end",
"def valid?(json: {})\n json.present? && json[:license_ref].present? && json[:start_date].present?\n end",
"def create\n puts params\n @device = Device.where(phone_number: params[:phone_number]).first \n respond_to do |format|\n if @device.nil?\n format.json { render json: {message: \"Sorry, the submited device is not registered\"}, status: :ok }\n elsif @device.register_device(current_user)\n @device.alias_name = params[:alias_name]\n @device.save\n format.json { render json: {message: \"The submited device was registered succesfully\"}, status: :ok }\n else\n format.json { render json: {message: \"Sorry, the Device has already been registered\"}, status: :ok }\n end\n end\n end",
"def register_device_token_for_vendor\n\t\t@owner = Vendor.where(:registration_code => params[:registration_code]).first\n\t\t@owner = Restaurant.where(:registration_code => params[:registration_code]).first if @owner.nil?\n\n\t\tif @owner.nil? \n\t\t\trender :json => { :error => \"incorrect_registration_code\" } \n\t\telse\n\t\t\t@device = Device.where(:token => params[:device_token]).first_or_create\n\t\t\t@device.update_owner @owner\n\t\t\t@device.save\n\n\t\t\trender :json => { :vendor_name => @device.owner.name, :vendor_id => @device.owner.id, :initial_state => @device.owner.initial_state, :is_open => @device.owner.open }\n\t\t\n\t\tend\n\tend",
"def valid?(message)\n super do |payload|\n payload.get(:data, :code_fetcher, :info, :commit_sha) &&\n !payload.get(:data, :code_fetcher, :asset)\n end\n end",
"def create\n\n device_info = JSON.load(params[:device_info])\n chip_fs_info =JSON.load(params[:chip_fs_info])\n chip_info = JSON.load(params[:chip_info])\n\n @admin_device = DeviceProperty.where(:mac_id=>device_info['mac_id'])\n if @admin_device.empty?\n\n respond_to do |format|\n format.json { render json: {:chip_accepted=>false,:error=>\"Invalid admin device\"}}\n end\n logger.info\"=========admin\"\n return\n\n end\n\n\n=begin\n @slot = Slot.where(:cid=>chip_info['cid'])\n\n if !@slot.empty?\n @slot = @slot.last\n @job = Job.where(:jobid=>@slot.jobid)\n if @job.empty?\n respond_to do |format|\n format.json { render json: {:chip_accepted=>false,:error=>\"Invalid JobID\"}}\n end\n return\n else\n @job = @job.last\n if @job.jobname.split('/').last.split('.') == \"Write\"\n @pearson_chip = PearsonChip.create(:cid=>@slot.cid,:serial_number=>@slot.serialnum,:capacity=>@slot.capacity,:job_name=>@job.jobname.split('/').last,:host_name=>@job.hostname,:operator=>@job.operator)\n else\n respond_to do |format|\n format.json { render json: {:chip_accepted=>false,:error=>\"Invalid Job Name\"}}\n end\n return\n end\n\n end\n end\n=end\n\n @issue_id = params[:masterchip_id]\n @master_chip = Masterchip.find_by_issue_id(@issue_id)\n\n if @master_chip.nil?\n respond_to do |format|\n format.json { render json: {:chip_accepted=>false,:error=>\"Invalid masterchip id\"} }\n end\n logger.info\"=========master\"\n return\n\n end\n\n @master_chip_fs = ChipFsInfo.find(@master_chip.chip_fs_info_id)\n @master_chip_fs = @master_chip_fs.to_json\n @master_chip_fs = JSON.load(@master_chip_fs)\n @master_chip_fs.delete('created_at')\n @master_chip_fs.delete('updated_at')\n @master_chip_fs.delete('id')\n # if !chip_fs_info_are_equal(@master_chip_fs,chip_fs_info)\n # respond_to do |format|\n # format.json { render json: {:chip_accepted=>false,:error=>\"chip_fs_info doesn't match\"} }\n # end\n # logger.info\"=========chipfs\"\n # return\n # end\n\n chip_type = chip_info['type']\n chip_info.delete('type')\n chip_info['chip_type'] = chip_type\n\n m_chip_info = chip_info\n m_chip_info['issue_id'] = params[:masterchip_id]\n m_chip_info.delete('masterchip_id')\n @master_aspchip = Masterchip.where(m_chip_info)\n\n if !@master_aspchip.empty?\n respond_to do |format|\n format.json { render json: {:chip_accepted=>false,:error=>\"This is Masterchip\"} }\n end\n return\n end\n\n\n chip_info.delete('issue_id')\n chip_info['masterchip_id'] = params[:masterchip_id]\n\n logger.info\"===================#{chip_info}\"\n @pchip_exist = Powerchip.where(chip_info)\n logger.info\"===================#{@pchip_exist}\"\n @response = {}\n if @pchip_exist.empty?\n logger.info\"===========innn========#{@pchip_exist}\"\n @pcid = Powerchip.find_by_cid(chip_info['cid'])\n @pserial = Powerchip.find_by_serial(chip_info['serial'])\n\n @collision = ''\n if !@pcid.nil?\n @collision = \"collison with cid #{@pcid.id}\"\n end\n\n if !@pserial.nil?\n @collision += \"collison with serial#{@pserial.id}\"\n end\n logger.info \"==========Collusion #{@collision} \"\n\n if @collision.length !=0\n @response = {:chip_accepted=>false,:error=>@collision}\n record_chip_errors(@response)\n respond_to do |format|\n format.json { render json: @response }\n end\n return\n else\n logger.info\"======increate===pchip\"\n @powerchip = Powerchip.new(chip_info)\n respond_to do |format|\n if @powerchip.save\n if @job.nil?\n format.json { render json: {:chip_accepted=>true } }\n else\n format.json { render json: {:chip_accepted=>true,:keys=>\"/powerchips/get_key/#{@powerchip.id}\" } }\n end\n else\n if @powerchip.errors.any?\n record_chip_errors(@powerchip.errors)\n end\n format.json { render json: {:chip_accepted=>false,:error=>@powerchip.errors} }\n end\n end\n end\n else\n logger.info\"=========powerchip existed accepted\"\n respond_to do |format|\n format.json { render json: {:chip_accepted=>true} }\n end\n end\n end",
"def submit_request_release\n if @params['hiddenImagePath'] == ''\n @data = \"subject=Freimeldung aus Maco-Tec App&product_machine=#{@params['product_machine']}&pickup_date=#{@params['pickup_date']}&location=#{@params['location']}&company=#{@params['company']}&phone=#{@params['phone']}&email=#{@params['email']}&additional_location_information=#{@params['additional_location_information']}&hardware_id=#{Device.instance.hardware_id}&device_os=#{Device.instance.device_os}&locale=#{Device.instance.locale}&device_os_version=#{Device.instance.device_os_version}\" \n ConnectionController.service_request(\"send_request_release_test.php\",nil,\"post\",nil, @data, url_for(:action => :http_callback))\n else\n multipart_array = [{:filename => @params['hiddenImagePath'], :name => \"image\", :content_type => \"image/jpg\"},\n {:name => \"hardware_id\",:body => Device.instance.hardware_id},\n {:name => \"device_os\",:body => Device.instance.device_os},\n {:name => \"locale\",:body => Device.instance.locale},\n {:name => \"device_os_version\",:body => Device.instance.device_os_version},\n {:name => \"action\",:body => \"submit_request_release\"},\n {:name => \"subject\",:body => \"Freimeldung aus Maco-Tec App\"},\n {:name => \"product_machine\", :body => @params['product_machine']},\n {:name => \"pickup_date\", :body => @params['pickup_date']},\n {:name => \"location\", :body => @params['location']},\n {:name => \"company\", :body => @params['company']},\n {:name => \"phone\", :body => @params['phone']},\n {:name => \"email\", :body => @params['email']},\n {:name => \"additional_location_information\", :body => @params['additional_location_information']},\n ]\n ConnectionController.service_request(\"send_request_release_test.php\",nil,\"upload_file\",nil, nil, url_for(:action => :http_callback), nil, multipart_array)\n end\n render :action => :wait\n end",
"def has_required_http_params?(param_hash)\n # Note: The blank? method is a Rails extension.\n # Specific keys have to be present, and their values\n # must not be blank.\n if !param_hash[:filename].blank? &&\n !param_hash[:assignment].blank? &&\n !param_hash[:group_name].blank?\n return true\n else\n return false\n end\n end",
"def validate_devices\n [gateway_serial, transmitter_serial].each do |_serial|\n errors.add_to_base(\"Device #{_serial} is not available. Please verify the serial number.\") unless (_serial.blank? || Device.available?( _serial, senior))\n end\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?\n request.format.json?\n end"
] |
[
"0.6515538",
"0.5838034",
"0.5824579",
"0.57573754",
"0.5670267",
"0.5624435",
"0.5582012",
"0.5436488",
"0.54359585",
"0.5422075",
"0.54190546",
"0.5376578",
"0.5367298",
"0.5344924",
"0.5344924",
"0.5338389",
"0.5315112",
"0.53120005",
"0.53021",
"0.52555835",
"0.5252483",
"0.52503276",
"0.523554",
"0.5229844",
"0.5224437",
"0.5218274",
"0.5210817",
"0.52065074",
"0.52022624",
"0.5201564",
"0.5194264",
"0.51811403",
"0.51635116",
"0.51579535",
"0.5144424",
"0.51411694",
"0.51410043",
"0.51404506",
"0.51334685",
"0.51319945",
"0.5131097",
"0.51246744",
"0.511821",
"0.51165956",
"0.51107395",
"0.510248",
"0.5100092",
"0.5094464",
"0.509104",
"0.5061426",
"0.50560904",
"0.5052894",
"0.5050073",
"0.5048463",
"0.50484437",
"0.50441927",
"0.5036258",
"0.50326794",
"0.50252116",
"0.5023588",
"0.5023012",
"0.50208855",
"0.5020795",
"0.5013386",
"0.50016147",
"0.49995652",
"0.49956408",
"0.49942836",
"0.49920052",
"0.49919307",
"0.4980291",
"0.4970949",
"0.4966787",
"0.49641523",
"0.49620685",
"0.49595895",
"0.49569696",
"0.49490348",
"0.4946053",
"0.49382868",
"0.49368942",
"0.49363077",
"0.49355432",
"0.49241835",
"0.4920409",
"0.4918208",
"0.4913017",
"0.49072966",
"0.4901429",
"0.4893397",
"0.48898566",
"0.48892713",
"0.48873416",
"0.4884033",
"0.48803562",
"0.48797846",
"0.48797244",
"0.4872046",
"0.48623526",
"0.48623526",
"0.48623526"
] |
0.0
|
-1
|
Make a request to the transaction search endpoint of the API
|
def transaction_search(transaction_type, location)
result = transaction_request(transaction_type, location)
Responses::Transaction.new(JSON.parse(result.body))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def transaction_request(transaction_type, location)\n result = @client.connection.get (PATH +\n ERB::Util.url_encode(transaction_type) + '/search'), location\n Error.check_for_error(result)\n result\n end",
"def search_request(params)\n result = @client.connection.get PATH, params\n Error.check_for_error(result)\n result\n end",
"def search_with_http_info(space_id, query, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionService.search ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling TransactionService.search\" if space_id.nil?\n # verify the required parameter 'query' is set\n fail ArgumentError, \"Missing the required parameter 'query' when calling TransactionService.search\" if query.nil?\n # resource path\n local_var_path = \"/transaction/search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n \n # connection timeout\n timeout = @api_client.get_connection_timeout()\n\n # http body (model)\n post_body = @api_client.object_to_http_body(query)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :timeout => timeout,\n :auth_names => auth_names,\n :return_type => 'Array<Transaction>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionService#search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def search_transaction_data(parameters)\n url = make_url('SearchTrade')\n\n data = {}\n data[:Version] = '105'\n data[:ShopID] = @options[:login]\n data[:ShopPass] = @options[:password]\n data[:OrderID] = parameters[:OrderID]\n\n [url, data.to_query]\n end",
"def transaction_service_search_with_http_info(space_id, query, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionService.transaction_service_search ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling TransactionService.transaction_service_search\" if space_id.nil?\n # verify the required parameter 'query' is set\n fail ArgumentError, \"Missing the required parameter 'query' when calling TransactionService.transaction_service_search\" if query.nil?\n # resource path\n local_var_path = \"/transaction/search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(query)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Transaction>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionService#transaction_service_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def search_request(params)\n result = @client.connection.get(PATH, params)\n Yelp::Fusion::Error.check_for_error(result)\n result\n end",
"def search(params = {})\n @api.get(\"api.json\", params)\n end",
"def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end",
"def send_search_money_request(mercado_pago_id)\n url = create_url(money_request_url(mercado_pago_id), access_token: access_token)\n headers = {:accept => 'application/json'}\n get url, headers, quiet: true\n end",
"def search limit: nil, npa: nil, nxx: nil, page: nil, ratecenter: nil, state: nil, tn: nil\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/available-tns/tns/\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\r\n \"limit\" => limit,\r\n \"npa\" => npa,\r\n \"nxx\" => nxx,\r\n \"page\" => page,\r\n \"ratecenter\" => ratecenter,\r\n \"state\" => state,\r\n \"tn\" => tn,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"accept\" => \"application/json\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'GET',\r\n query_url:query_url,\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def search(params={})\n rpc_call :search, params\n end",
"def request_search(options, format = :xml)\r\n\t\t\turi = URI \"#{API_URL}edsapi/rest/Search?#{options}\"\r\n\t\t\t@log << uri.to_s << \" -- \"\r\n\t\t\t#return uri.request_uri\r\n\t\t\treq = Net::HTTP::Get.new(uri.request_uri)\r\n\r\n\t\t\treq['x-authenticationToken'] = @auth_token\r\n\t\t\treq['x-sessionToken'] = @session_token\r\n\t\t\treq['Accept'] = 'application/json' #if format == :json\r\n\r\n\t\t\tNet::HTTP.start(uri.hostname, uri.port, :read_timeout => 10) { |http|\r\n \t\t\tbegin\r\n\t\t\t return http.request(req).body\r\n\t\t\trescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\r\n\t\t\t raise \"No response from server\"\r\n\t\t\tend\r\n\t\t\t}\r\n end",
"def make_request\n url = 'https://www.googleapis.com/qpxExpress/v1/trips/search?key=' + @api_key\n request = compose_request\n response = RestClient.post url, request, content_type: :json, accept: :json\n response.body\n end",
"def index\n @search = @source.source_transactions.search(params[:q])\n @transactions = @search.result\n end",
"def query(transaction_id)\n params = {transaction_id: transaction_id}\n query_response params\n end",
"def search(query)\n params = { key: self.api_key, cx: self.search_engine_id, q: query }\n uri = URI(BASE_URL)\n uri.query = URI.encode_www_form(params)\n request = build_request(uri)\n\n response = self.execute_search(uri, request)\n format_response(response)\n end",
"def searchrawtransactions(bitcoinaddress, verbose=1)\n @api.request 'searchrawtransactions', bitcoinaddress, verbose\n end",
"def gettransaction(txid)\n request :gettransaction, txid\n end",
"def getTransaction( transaction_id)\n params = Hash.new\n params['transaction_id'] = transaction_id\n return doCurl(\"get\",\"/transaction\",params)\n end",
"def get_single_transaction_query(params = {})\r\n @PARAM_HASH[\"REPORT_START_DATE\"] = params[:report_start_date]\r\n @PARAM_HASH[\"REPORT_END_DATE\"] = params[:report_end_date]\r\n @PARAM_HASH[\"id\"] = params[:transaction_id]\r\n @PARAM_HASH[\"EXCLUDE_ERRORS\"] = params[:exclude_errors] || ''\r\n @api = \"stq\" \r\n end",
"def get_single_transaction_query(params = {})\r\n @PARAM_HASH[\"REPORT_START_DATE\"] = params[:report_start_date]\r\n @PARAM_HASH[\"REPORT_END_DATE\"] = params[:report_end_date]\r\n @PARAM_HASH[\"id\"] = params[:transaction_id]\r\n @PARAM_HASH[\"EXCLUDE_ERRORS\"] = params[:exclude_errors] || ''\r\n @api = \"stq\" \r\n end",
"def search\n send_request\n parse_response\n end",
"def make_request(search_term)\n JSON.parse(RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"))\nend",
"def index\n @search = Transaction.search(params[:search] || Contact::DEFAULT_SEARCH_PARAMETERS)\n @transactions = @search.all.paginate(:page=>params[:page], :per_page=>25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end",
"def transaction_data(item_account_id=nil,higher_limit=500,lower_limit=1, end_number=100, start_number=1)\n if cobrand_token && token\n query({\n :endpoint => '/jsonsdk/TransactionSearchService/executeUserSearchRequest',\n :method => :POST,\n :params => {\n :cobSessionToken => cobrand_token,\n :userSessionToken => token,\n :'transactionSearchRequest.containerType'=>'All',\n :'transactionSearchRequest.higherFetchLimit'=>higher_limit,\n :'transactionSearchRequest.lowerFetchLimit'=>lower_limit,\n :'transactionSearchRequest.resultRange.endNumber'=>end_number,\n :'transactionSearchRequest.resultRange.startNumber'=>start_number,\n :'transactionSearchRequest.searchClients.clientId'=>1,\n :'transactionSearchRequest.searchClients.clientName'=>'DataSearchService',\n :'transactionSearchRequest.userInput'=>nil,\n :'transactionSearchRequest.ignoreUserInput'=>true,\n :'transactionSearchRequest.searchFilter.currencyCode'=>'USD',\n :'transactionSearchRequest.searchFilter.postDateRange.fromDate'=>1.year.ago.strftime('%m-%d-%YT00:00:00.000Z'),\n :'transactionSearchRequest.searchFilter.postDateRange.toDate'=>Time.zone.now.strftime('%m-%d-%YT00:00:00.000Z'),\n :'transactionSearchRequest.searchFilter.transactionSplitType'=> 'ALL_TRANSACTION',\n :'transactionSearchRequest.searchFilter.itemAccountId.identifier' => item_account_id\n } \n })\n else\n nil\n end\n end",
"def search\n response = make_request\n begin\n response_hash = JSON.parse(response.body)\n rescue JSON::ParserError\n raise RequestException\n else\n response_hash\n end\n end",
"def do_search(url, use_get = false)\n if use_get\n request = Net::HTTP::Get.new(url)\n Rails.logger.debug(\"GET Search url: #{url}\")\n else\n request = Net::HTTP::Post.new(url)\n Rails.logger.debug(\"POST Search url: #{url} \")\n end\n response = do_http_request(request)\n if response.code.to_s != '200'\n raise RequestFailedException.new(\"#{response.code}: #{response.body}\")\n end\n results = ASUtils.json_parse(response.body)\n results\n end",
"def transaction_request(transaction,total=nil)\n transaction_request = Cielo::TransactionRequest.new\n resul = send_request(transaction_request.serialize(transaction))\n end",
"def search(term, location)\n url = \"#{API_HOST}#{SEARCH_PATH}\"\n params = {\n term: term,\n location: location,\n limit: SEARCH_LIMIT\n }\n#this takes info from params hash\n response = HTTP.auth(bearer_token).get(url, params: params)\n response.parse[\"businesses\"]\nend",
"def gettransaction(txid)\n @api.request 'gettransaction', txid\n end",
"def gettransaction(txid)\n @api.request 'gettransaction', txid\n end",
"def search\n query = {\n 'res_id' => params[:id]\n }\n @search = HTTParty.get('https://developers.zomato.com/api/v2.1/restaurant?', query: query, headers: headers)\n end",
"def query(params)\n request(Resources::RESOURCE_QUERY, HTTP_METHOD_POST, params)\n end",
"def search(query)\n @client.get('/BikePoint/Search', { query: query })\n end",
"def transaction_data_view(searchIdentifier, start_number=1,end_number=100)\n if searchIdentifier\n query({\n :endpoint => '/jsonsdk/TransactionSearchService/getUserTransactions',\n :method => :POST,\n :params => {\n :cobSessionToken => cobrand_token,\n :userSessionToken => token,\n :'searchFetchRequest.searchIdentifier.identifier' => searchIdentifier,\n :'searchFetchRequest.searchResultRange.startNumber' => start_number,\n :'searchFetchRequest.searchResultRange.endNumber' => end_number\n } \n })\n else\n nil\n end\n end",
"def get_transaction(tx_id:)\n client.make_request('/get-transaction', 'post', params: {tx_id: tx_id})\n end",
"def get_transaction(account_id, transaction_id)\n query_api_object Transaction, \"/rest/accounts/#{account_id}/transactions/#{transaction_id}\"\n end",
"def send_request(args)\n set_settings(args[:settings])\n\n XingApi::Job.search(args[:keywords], {:limit => args[:page_size], :offset => 0})\n rescue XingApi::Error => e\n {:code => e.status_code, :msg => e.text}\n end",
"def search(query)\n @search_svc.search query\n end",
"def make_request(search_term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\")\n final_response = JSON.parse(response)\nend",
"def make_search(url)\n #make the web request\n data = RestClient.get url\n JSON.parse(data)\nend",
"def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end",
"def find_by_id(transaction_id, args = {})\n raise ArgumentError, 'transaction_id is required' if transaction_id.blank?\n\n resp = connection.get \"/api/v2/transactions/#{transaction_id}\", args\n handle_response(resp)\n end",
"def transaction_service_search(space_id, query, opts = {})\n data, _status_code, _headers = transaction_service_search_with_http_info(space_id, query, opts)\n return data\n end",
"def search\n @crypto = HTTParty.get(\"https://api.coinmarketcap.com/v1/ticker/?limit=10\")\n @crypto_id = params[:id]\n end",
"def search(query, options = {}, remote_ip = nil)\n (headers 'X-Forwarded-For' => remote_ip.to_s) unless remote_ip.nil?\n self.parameters = { 'q' => query }\n options[:page] ||= 1\n options[:count] ||= 5\n parameters['filter'] = options[:filter] if options[:filter]\n parameters['startIndex'] = options[:count] * (options[:page] - 1)\n parameters['maxResults'] = options[:count]\n parameters['key'] = options[:api_key] if options[:api_key]\n parameters['orderBy'] = 'newest' if options[:order_by].eql?('newest')\n parameters['country'] = options[:country] if options[:country]\n Response.new(get(url.to_s))\n end",
"def make_request\n query = {'income': @income, 'zipcode': @zipcode, 'age': @age}\n begin\n response = HTTParty.get(BASE_URL, query: query)\n # I know I can do better than this\n rescue Exception => e\n raise RequestException\n else\n response\n end\n end",
"def get(transaction_id:)\n client.get(path: \"#{sub_path}/#{transaction_id}\", api_key: api_key)\n end",
"def search\n return @transactions.select{|el| el.created_at.to_s.starts_with?(params[:search_transaction]) || \n el.id.to_s.starts_with?(params[:search_transaction]) || \n el.sender_id.to_s.starts_with?(params[:search_transaction]) || \n el.receiver_id.to_s.starts_with?(params[:search_transaction]) || \n el.amount.to_s.starts_with?(params[:search_transaction])}\n end",
"def search(transactions)\n return transactions.select{|el| el.sender_id.to_s.starts_with?(params[:search_transaction]) || \n el.receiver_id.to_s.starts_with?(params[:search_transaction]) || \n el.amount.to_s.starts_with?(params[:search_transaction]) || \n el.created_at.to_s.starts_with?(params[:search_transaction])}\n end",
"def get_transaction(id)\n submit GetTransaction.new(:transaction_id => id)\n end",
"def search(search_request=nil)\n url = Sumologic::API_BASE_URL + Sumologic::API_SEARCH_PATH\n resp = @request_client.get(url, search_request.to_hash, DEFAULT_HEADERS)\n\n raise SearchException, resp.body if resp.code.to_i != 200\n begin\n search_result = MultiJson.load(resp.body)\n rescue Exception => e\n raise SearchException(e)\n end\n\n SearchResponse.new(search_request, search_result)\n end",
"def fetch_wallets_transactions(filters = {})\n MangoPay.request(:get, url() + \"/transactions\", {}, filters)\n end",
"def tx_by_apikey( api_key )\n get(\"/txbyapikey/#{api_key}\")\n end",
"def query_transaction_with_http_info(sbp_query_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VApi#query_transaction ...\"\n end\n \n # verify the required parameter 'sbp_query_request' is set\n fail \"Missing the required parameter 'sbp_query_request' when calling query_transaction\" if sbp_query_request.nil?\n \n # resource path\n path = \"/v1/transaction/query\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sbp_query_request)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<SbpResponse>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VApi#query_transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def api_url\n \"http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsAdvanced\" +\n \"&SERVICE-VERSION=1.9.0\" +\n \"&SECURITY-APPNAME=#{Settings.ebay.app_id}\" +\n \"&RESPONSE-DATA-FORMAT=JSON\" +\n \"&REST-PAYLOAD\" +\n \"&keywords=#{query}\"\n end",
"def search(options={})\n params = []\n options.each do |key, value|\n params << \"#{key}=#{value}\"\n end\n ethon = ethon_easy_json_requester\n ethon.url = uri_escape(\"#{base_api_url}search/query?#{params.join('&')}\")\n ethon.perform\n check_and_raise_failure(ethon)\n server_responded_at = Time.now\n {\n requested_url: ethon.url,\n server_responded_at: server_responded_at,\n results: parse_search_response(ethon.response_body)\n }\n end",
"def index\n if session[:user_id]\n @transactions = Transaction.where(user_id: session[:user_id])\n elsif session[:admin_id]\n @transactions = Transaction.where(nil)\n else\n redirect_to login_path\n end\n\n @transactions = @transactions.search(params[:search_name], params[:search_phone] , params[:search_amount], params[:search_status], params[:search_date ])\n end",
"def search params = {}\n send_and_receive search_path(params), params.reverse_merge(qt: blacklight_config.qt)\n end",
"def make_api_request(query)\n response = timeout(configuration.timeout) do\n uri = URI.parse(query_url(query))\n http_client.start(uri.host, uri.port, :use_ssl => true) do |client|\n req = Net::HTTP::Post.new(uri.request_uri, configuration.http_headers)\n req.basic_auth(uri.user, uri.password) if uri.user and uri.password\n req.body = sensis_query_json(query)\n req.content_type = 'application/json'\n req['X-Auth-Token'] = configuration.api_key[0]\n req['X-Auth-Password'] = configuration.api_key[1]\n client.request(req)\n end\n end\n case response.code.to_i\n when 200\n return response\n when 400\n raise_error ::Geocoder::InvalidRequest, \"Bad Request: #{response.body}\"\n else\n raise_error ::Geocoder::Error, \"Unable to access Sensis API: #{response.code}. Body:\\n#{response.body}\"\n end\n response\n end",
"def search\n request.write_attributes request_attributes\n @search ||= request.call\n end",
"def search(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V2/search\", Yahoo::Api.merge(opts))\r\n end",
"def search\n @google = Rails.application.secrets.google_api_key\n puts query[\"query\"]\n @response = HTTParty.get(\"https://www.googleapis.com/books/v1/volumes?q=#{query[\"query\"]}&key=#{@google}\")\n render json: {data: @response}\n end",
"def index\n @search = params[:search] || Hash.new\n @search.each do |k,v|\n if !v.blank? && FundRequest::SEARCHABLE.include?( k.to_sym )\n if %w( with_state with_review_state ).include?( k )\n v = v.to_sym\n end\n @fund_requests = @fund_requests.send k, v\n end\n end\n @fund_requests = @fund_requests.page(params[:page])\n\n respond_to do |format|\n format.html { render :action => 'index' }\n format.xml { render :xml => @fund_requests }\n end\n end",
"def search_customers(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/search'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def values_search(params)\n @client.get(\"#{path}/values/search\", nil, params, \"Content-Type\" => \"application/json\")\n end",
"def request\n data = [\n exact_queries(%w[name user type]),\n switch_queries(%w[stable reviewed]),\n array_queries(%w[tags]),\n range_condition_queries(%w[downloads rating version]),\n sort_query,\n range_query\n ].reduce({}, :merge)\n\n url = \"/items/#{data.empty? ? '' : '?'}#{URI.encode_www_form(data)}\"\n @data = @api.request(url).map do |hash|\n hash['id'] = @api.normalize_id(hash['id'])\n hash\n end\n end",
"def search(query, options={})\n self.perform_get(\"/search\", {\n :q => query\n }.merge(options|| {}))\n end",
"def find(query)\n start = Time.now\n tail = query.map do |k, v|\n \"#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}\"\n end.join('&')\n http = clean(\n Typhoeus::Request.get(\n \"https://wts.zold.io/find?#{tail}\",\n headers: headers\n )\n )\n txns = http.body.split(\"\\n\").map { |t| Zold::Txn.parse(t) }\n @log.debug(\"#{txns.count} transactions found in #{Zold::Age.new(start)}\")\n txns\n end",
"def tx_by_address( address, api_key )\n address = encode( address )\n get(\"/txbyaddress/#{address}/#{api_key}\")\n end",
"def perform(params)\n if use_with_connection\n with_connection { search(params) }\n else\n search(params)\n end\n end",
"def index \n unless(params[:search==nil]) \n @requests = Request.search(params[:search]) \n end \n end",
"def search\n @response = HTTParty.get(\"https://travelbriefing.org/#{params[:searchterm]}?format=json\",\n :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'})\n\n @response = JSON.parse(@response.parsed_response)\n @currency = @response[\"currency\"][\"rate\"].to_f/@response[\"currency\"][\"compare\"][5][\"rate\"].to_f\n\n gon.currency = @currency\n end",
"def getResultsFromSearch(query, type, guts, ppOverride)\n request('getResultsFromSearch', {'query' => query, 'type' => type, 'guts' => guts, 'ppOverride' => ppOverride})\nend",
"def search\n \n @transcripts = Transcript.search(params)\n \n end",
"def transaction(tx_hash)\n call :get, \"/tx/#{tx_hash}\"\n end",
"def transactions_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_get ...'\n end\n # resource path\n local_var_path = '/api/v1/transactions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'addrs'] = opts[:'addrs'] if !opts[:'addrs'].nil?\n query_params[:'confirmed'] = opts[:'confirmed'] if !opts[:'confirmed'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transactions_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def search(query, opts = {})\r\n page = opts[:page] || 1\r\n uri = url_for('search', opts)\r\n response = RestClient.get(uri, params: { q: query, page: page })\r\n JSON.parse response\r\n end",
"def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsTransactionsApi.get_transactions ...\"\n end\n # resource path\n local_var_path = \"/transactions\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_invoice'] = opts[:'filter_invoice'] if !opts[:'filter_invoice'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceTransactionResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsTransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def make_request\n { RequestParameters: {}, SearchParameters: { 'ins1:Postcode' => postcode.upcase },\n SelectionOptions: { 'ins1:MaximumNumberOfRows' => 200, 'ins1:IncludeNonGeographicAddresses' => false,\n 'ins1:IncludeBFPOAddresses' => false, 'ins1:IncludeMultiResidenceAddresses' => false,\n 'ins1:IncludeNIAddresses' => true } }\n end",
"def search\n # The exercise says the HTML page has to show only if the address has coverage,\n # but I would show what type too\n\n address = Address.find_by_address(params[:address])\n\n if address.blank?\n status = :not_found\n ret = {\n status: :not_found,\n message: 'Address not found in the DB',\n has_coverage: nil\n }\n else\n status = :ok\n message = address.has_coverage? ? \"Coverage #{address.coverage_name}\" : 'No coverage'\n ret = {\n status: :ok,\n message: message,\n has_coverage: address.has_coverage?\n }\n end\n\n render json: ret, status: status\n end",
"def set_search_api\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n # converts response to a Ruby hash \n @search_coin = JSON.parse(@response)\n @symbol = params[:sym]\n\n if @symbol\n @symbol = @symbol.upcase\n end \n end",
"def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions ...'\n end\n if @api_client.config.client_side_validation && opts[:'transactions_type'] && !['automated', 'manual'].include?(opts[:'transactions_type'])\n fail ArgumentError, 'invalid value for \"transactions_type\", must be one of automated, manual'\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?\n query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?\n query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?\n query_params[:'transactions_type'] = opts[:'transactions_type'] if !opts[:'transactions_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TransactionListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index_request( params={} )\n res = @http_client.post_form( URI.parse(\"#{self.url}/select\"), params.update({ \"wt\" => \"ruby\" }) )\n\n if res.code.to_i != 200\n raise IndexSearchError, \"Index Search Error: #{res.body}\"\n else\n return eval(res.body)\n end\n end",
"def recipe_search_results_for(search, number=100)\n Faraday.get \"#{RECIPE_SEARCH_URL}#{search}&number=#{number}&apiKey=#{spoonacular_key}\"\n end",
"def transactions(account_id, opts = {})\n query = {}\n query['cursor'] = opts[:cursor] if opts[:cursor]\n query['start'] = opts[:start] if opts[:start]\n query['end'] = opts[:end] if opts[:end]\n query['time_field'] = opts[:time_field] if opts[:time_field]\n\n api_get(path(account_id), query)\n end",
"def query(query, params={})\n query_url = \"#{API_URL}/query.json?#{query}\"\n perform_get_request(query_url, params)\n end",
"def search(query, pagination_options = {})\n validate_search_query!(query)\n page = pagination_options[:page]\n validate_search_pagination!(page)\n qs = pagination_query_string(page: page)\n url = qs.length > 0 ? \"search/#{endpoint}?#{qs}&query=#{query.to_query}\" : \"search/#{endpoint}?query=#{query.to_query}\"\n @http.get(url)\n end",
"def transactions_by_ref(merchant_ref)\n client.get \"transactions/#{inst_id}/byRef?merchantRef=#{merchant_ref}\"\n end",
"def search(search_params = {})\n artifacts.search(search_params)\n end",
"def lookup(options)\n # q6z5e0on\n @client.get_request('/moms/transaction.lookup', options) \n end",
"def apiSearch\n if params[:search]\n\t@service = Service.find(:all, :conditions => ['name LIKE ?', \"%#{params[:search]}%\"], :limit => \"10\")\n end\n if params[:buy] && params[:search]\n @service = Service.find(:all, :conditions => ['buy LIKE ? AND name LIKE ?', \"#{params[:buy]}\", \"%#{params[:search]}%\"], :limit => \"20\")\n end\n if params[:sell] && params[:search]\n @service = Service.find(:all, :conditions => ['sell LIKE ? AND name LIKE ?', \"#{params[:sell]}\", \"%#{params[:search]}%\" ], :limit => \"20\")\n end\n @signature = params[:signature]\n params = request.query_parameters.reject {|key, value| key.to_s == \"signature\"}\n params.sort_by {|key, value| key.to_s.underscore}.join('')\n @parameters = params.to_s\n @secret = ApplicationAccount.api_secret_field\n @app_key = ApplicationAccount.api_key_field\n respond_to do |format|\n format.html # show.html.erb\n if params[:app_key] == @app_key\n if @signature == Digest::MD5.hexdigest(\"#{@app_key}#{@parameters}#{@secret}\").to_s\n\t #format.xml { render :xml => Digest::MD5.hexdigest(\"#{@app_key}#{@parameters}#{@secret}\").to_s }\n if @service != nil\n format.xml { render :xml => @service.to_xml(:only => [:id, :name, :description, :contact_name, :contact_title, :contact_email, :buy, :sell, :created_at, :updated_at]) }\n else\n format.xml { render :xml => \"<WARNING>there is not such a service</WARNING>\" }\n end\n else\n @test = Digest::MD5.hexdigest(\"#{@app_key}#{@parameters}#{@secret}\").to_s\n format.xml { render :xml => \"<WARNING>El signature debe ser: #{@test} </WARNING>\" }\n end\n end\n end\n end",
"def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end",
"def search(params = {})\n url = build_url('item_summary', 'search')\n http.headers(build_headers).get(url, params: params)\n end",
"def retrieve_transaction(location_id:,\n transaction_id:)\n warn 'Endpoint retrieve_transaction in TransactionsApi is deprecated'\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/locations/{location_id}/transactions/{transaction_id}',\n 'default')\n .template_param(new_parameter(location_id, key: 'location_id')\n .should_encode(true))\n .template_param(new_parameter(transaction_id, key: 'transaction_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def search(params)\n block = Block.find_by(block_hash: /^(0x)?#{params[:search][:hash]}/)\n if block.present?\n redirect_to block_path(block) and return\n end\n tx = Transaction.find_by(tx_hash: /^(0x)?#{params[:search][:hash]}/)\n if tx.present?\n redirect_to transaction_path(tx) and return\n end\n end",
"def search_orders(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/orders/search'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(_response, data: decoded, errors: _errors)\n end",
"def g_et_ordersearch_with_http_info(partner_billing_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrdersearchApi#g_et_ordersearch ...\"\n end\n \n # verify the required parameter 'partner_billing_key' is set\n fail \"Missing the required parameter 'partner_billing_key' when calling g_et_ordersearch\" if partner_billing_key.nil?\n \n # resource path\n local_var_path = \"/ordersearch/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'partnerBillingKey'] = partner_billing_key\n query_params[:'genericValues'] = opts[:'generic_values'] if opts[:'generic_values']\n query_params[:'lastName'] = opts[:'last_name'] if opts[:'last_name']\n query_params[:'email'] = opts[:'email'] if opts[:'email']\n query_params[:'postalCode'] = opts[:'postal_code'] if opts[:'postal_code']\n query_params[:'startDate'] = opts[:'start_date'] if opts[:'start_date']\n query_params[:'endDate'] = opts[:'end_date'] if opts[:'end_date']\n query_params[:'uniqueUserId'] = opts[:'unique_user_id'] if opts[:'unique_user_id']\n query_params[:'partnerId'] = opts[:'partner_id'] if opts[:'partner_id']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'page'] = opts[:'page'] if opts[:'page']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SubmittedOrderList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrdersearchApi#g_et_ordersearch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def search(params = {})\n http.get(\"/nfse\", params: filter(params)) do |response|\n respond_with_collection(response)\n end\n end",
"def execute_search(query)\n search_resource.retrieve(query)\n end"
] |
[
"0.7584854",
"0.7413088",
"0.71697396",
"0.7103187",
"0.70791155",
"0.6963362",
"0.689927",
"0.686924",
"0.6684079",
"0.6673873",
"0.6670443",
"0.6656846",
"0.66339236",
"0.6610096",
"0.6567763",
"0.64440227",
"0.64122164",
"0.6392311",
"0.63895357",
"0.6381804",
"0.6381804",
"0.6375021",
"0.63517135",
"0.6330496",
"0.6290469",
"0.6253071",
"0.62528604",
"0.62356496",
"0.6230833",
"0.6230139",
"0.6230139",
"0.6216009",
"0.62127364",
"0.6200545",
"0.6198339",
"0.6172225",
"0.6154355",
"0.61496836",
"0.61418295",
"0.61385036",
"0.61321175",
"0.61295927",
"0.6088175",
"0.6082083",
"0.6071066",
"0.60590935",
"0.60407215",
"0.6029993",
"0.6026942",
"0.6025127",
"0.6021135",
"0.6020335",
"0.60188246",
"0.6016117",
"0.5992293",
"0.5987025",
"0.5986627",
"0.5978592",
"0.59770465",
"0.5976869",
"0.59595317",
"0.59569734",
"0.59420115",
"0.5932959",
"0.5912398",
"0.5909739",
"0.5900505",
"0.58877456",
"0.5875095",
"0.5868892",
"0.5853973",
"0.58495915",
"0.5846577",
"0.58434445",
"0.58407867",
"0.5837946",
"0.5823441",
"0.5821029",
"0.5819636",
"0.58037335",
"0.57973236",
"0.57947695",
"0.57864726",
"0.5781151",
"0.5773263",
"0.5772439",
"0.5770074",
"0.5767358",
"0.57665896",
"0.5766313",
"0.57604474",
"0.575725",
"0.575429",
"0.5748895",
"0.57449675",
"0.5743826",
"0.57409173",
"0.57325476",
"0.5731493",
"0.5717699"
] |
0.75911456
|
0
|
Make a request to the transaction endpoint of the API The endpoint requires a format of /v3/transaction_search so the primary request parameter is concatenated. After getting the response back it's checked to see if there are any API errors and raises the relevant one if there is.
|
def transaction_request(transaction_type, location)
result = @client.connection.get (PATH +
ERB::Util.url_encode(transaction_type) + '/search'), location
Error.check_for_error(result)
result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def transaction_search(transaction_type, location)\n result = transaction_request(transaction_type, location)\n Responses::Transaction.new(JSON.parse(result.body))\n end",
"def search_with_http_info(space_id, query, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionService.search ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling TransactionService.search\" if space_id.nil?\n # verify the required parameter 'query' is set\n fail ArgumentError, \"Missing the required parameter 'query' when calling TransactionService.search\" if query.nil?\n # resource path\n local_var_path = \"/transaction/search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n \n # connection timeout\n timeout = @api_client.get_connection_timeout()\n\n # http body (model)\n post_body = @api_client.object_to_http_body(query)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :timeout => timeout,\n :auth_names => auth_names,\n :return_type => 'Array<Transaction>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionService#search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def transaction_service_search_with_http_info(space_id, query, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionService.transaction_service_search ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling TransactionService.transaction_service_search\" if space_id.nil?\n # verify the required parameter 'query' is set\n fail ArgumentError, \"Missing the required parameter 'query' when calling TransactionService.transaction_service_search\" if query.nil?\n # resource path\n local_var_path = \"/transaction/search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(query)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Transaction>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionService#transaction_service_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def getTransaction( transaction_id)\n params = Hash.new\n params['transaction_id'] = transaction_id\n return doCurl(\"get\",\"/transaction\",params)\n end",
"def transaction_request(transaction,total=nil)\n transaction_request = Cielo::TransactionRequest.new\n resul = send_request(transaction_request.serialize(transaction))\n end",
"def gettransaction(txid)\n request :gettransaction, txid\n end",
"def transaction_with_http_info(txid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transaction ...'\n end\n # verify the required parameter 'txid' is set\n if @api_client.config.client_side_validation && txid.nil?\n fail ArgumentError, \"Missing the required parameter 'txid' when calling DefaultApi.transaction\"\n end\n # resource path\n local_var_path = '/api/v1/transaction'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'txid'] = txid\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Transaction' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_single_transaction_query(params = {})\r\n @PARAM_HASH[\"REPORT_START_DATE\"] = params[:report_start_date]\r\n @PARAM_HASH[\"REPORT_END_DATE\"] = params[:report_end_date]\r\n @PARAM_HASH[\"id\"] = params[:transaction_id]\r\n @PARAM_HASH[\"EXCLUDE_ERRORS\"] = params[:exclude_errors] || ''\r\n @api = \"stq\" \r\n end",
"def get_single_transaction_query(params = {})\r\n @PARAM_HASH[\"REPORT_START_DATE\"] = params[:report_start_date]\r\n @PARAM_HASH[\"REPORT_END_DATE\"] = params[:report_end_date]\r\n @PARAM_HASH[\"id\"] = params[:transaction_id]\r\n @PARAM_HASH[\"EXCLUDE_ERRORS\"] = params[:exclude_errors] || ''\r\n @api = \"stq\" \r\n end",
"def search_request(params)\n result = @client.connection.get PATH, params\n Error.check_for_error(result)\n result\n end",
"def query(transaction_id)\n params = {transaction_id: transaction_id}\n query_response params\n end",
"def search_transaction_data(parameters)\n url = make_url('SearchTrade')\n\n data = {}\n data[:Version] = '105'\n data[:ShopID] = @options[:login]\n data[:ShopPass] = @options[:password]\n data[:OrderID] = parameters[:OrderID]\n\n [url, data.to_query]\n end",
"def gettransaction(txid)\n @api.request 'gettransaction', txid\n end",
"def gettransaction(txid)\n @api.request 'gettransaction', txid\n end",
"def query_transaction_with_http_info(sbp_query_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VApi#query_transaction ...\"\n end\n \n # verify the required parameter 'sbp_query_request' is set\n fail \"Missing the required parameter 'sbp_query_request' when calling query_transaction\" if sbp_query_request.nil?\n \n # resource path\n path = \"/v1/transaction/query\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sbp_query_request)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<SbpResponse>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VApi#query_transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end",
"def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions ...'\n end\n if @api_client.config.client_side_validation && opts[:'transactions_type'] && !['automated', 'manual'].include?(opts[:'transactions_type'])\n fail ArgumentError, 'invalid value for \"transactions_type\", must be one of automated, manual'\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?\n query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?\n query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?\n query_params[:'transactions_type'] = opts[:'transactions_type'] if !opts[:'transactions_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TransactionListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_transaction(tx_id:)\n client.make_request('/get-transaction', 'post', params: {tx_id: tx_id})\n end",
"def retrieve_transaction(location_id:,\n transaction_id:)\n warn 'Endpoint retrieve_transaction in TransactionsApi is deprecated'\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/locations/{location_id}/transactions/{transaction_id}',\n 'default')\n .template_param(new_parameter(location_id, key: 'location_id')\n .should_encode(true))\n .template_param(new_parameter(transaction_id, key: 'transaction_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def get_transaction(account_id, transaction_id)\n query_api_object Transaction, \"/rest/accounts/#{account_id}/transactions/#{transaction_id}\"\n end",
"def get(transaction_id:)\n client.get(path: \"#{sub_path}/#{transaction_id}\", api_key: api_key)\n end",
"def transactions_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_get ...'\n end\n # resource path\n local_var_path = '/api/v1/transactions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'addrs'] = opts[:'addrs'] if !opts[:'addrs'].nil?\n query_params[:'confirmed'] = opts[:'confirmed'] if !opts[:'confirmed'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transactions_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def find_by_id(transaction_id, args = {})\n raise ArgumentError, 'transaction_id is required' if transaction_id.blank?\n\n resp = connection.get \"/api/v2/transactions/#{transaction_id}\", args\n handle_response(resp)\n end",
"def search limit: nil, npa: nil, nxx: nil, page: nil, ratecenter: nil, state: nil, tn: nil\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/available-tns/tns/\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\r\n \"limit\" => limit,\r\n \"npa\" => npa,\r\n \"nxx\" => nxx,\r\n \"page\" => page,\r\n \"ratecenter\" => ratecenter,\r\n \"state\" => state,\r\n \"tn\" => tn,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"accept\" => \"application/json\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'GET',\r\n query_url:query_url,\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsTransactionsApi.get_transactions ...\"\n end\n # resource path\n local_var_path = \"/transactions\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_invoice'] = opts[:'filter_invoice'] if !opts[:'filter_invoice'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceTransactionResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsTransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_transaction(id)\n submit GetTransaction.new(:transaction_id => id)\n end",
"def request_search(options, format = :xml)\r\n\t\t\turi = URI \"#{API_URL}edsapi/rest/Search?#{options}\"\r\n\t\t\t@log << uri.to_s << \" -- \"\r\n\t\t\t#return uri.request_uri\r\n\t\t\treq = Net::HTTP::Get.new(uri.request_uri)\r\n\r\n\t\t\treq['x-authenticationToken'] = @auth_token\r\n\t\t\treq['x-sessionToken'] = @session_token\r\n\t\t\treq['Accept'] = 'application/json' #if format == :json\r\n\r\n\t\t\tNet::HTTP.start(uri.hostname, uri.port, :read_timeout => 10) { |http|\r\n \t\t\tbegin\r\n\t\t\t return http.request(req).body\r\n\t\t\trescue Timeout::Error, Net::ReadTimeout, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\r\n\t\t\t raise \"No response from server\"\r\n\t\t\tend\r\n\t\t\t}\r\n end",
"def retrieve_transaction_with_http_info(location_id, transaction_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionsApi.retrieve_transaction ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling TransactionsApi.retrieve_transaction\" if location_id.nil?\n # verify the required parameter 'transaction_id' is set\n fail ArgumentError, \"Missing the required parameter 'transaction_id' when calling TransactionsApi.retrieve_transaction\" if transaction_id.nil?\n # resource path\n local_var_path = \"/v2/locations/{location_id}/transactions/{transaction_id}\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RetrieveTransactionResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#retrieve_transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def make_request\n query = {'income': @income, 'zipcode': @zipcode, 'age': @age}\n begin\n response = HTTParty.get(BASE_URL, query: query)\n # I know I can do better than this\n rescue Exception => e\n raise RequestException\n else\n response\n end\n end",
"def search_request(params)\n result = @client.connection.get(PATH, params)\n Yelp::Fusion::Error.check_for_error(result)\n result\n end",
"def make_request\n url = 'https://www.googleapis.com/qpxExpress/v1/trips/search?key=' + @api_key\n request = compose_request\n response = RestClient.post url, request, content_type: :json, accept: :json\n response.body\n end",
"def tx_by_apikey( api_key )\n get(\"/txbyapikey/#{api_key}\")\n end",
"def get_transaction_with_http_info(transaction_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transaction ...'\n end\n # verify the required parameter 'transaction_id' is set\n if @api_client.config.client_side_validation && transaction_id.nil?\n fail ArgumentError, \"Missing the required parameter 'transaction_id' when calling TransactionsApi.get_transaction\"\n end\n # resource path\n local_var_path = '/transactions/{Transaction ID}'.sub('{' + 'Transaction ID' + '}', transaction_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TransactionResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#get_transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def getrawtransaction(txid, verbose = 0)\n @api.request 'getrawtransaction', txid, verbose\n end",
"def getrawtransaction(txid, verbose = 0)\n @api.request 'getrawtransaction', txid, verbose\n end",
"def transaction(tx_hash)\n call :get, \"/tx/#{tx_hash}\"\n end",
"def send_search_money_request(mercado_pago_id)\n url = create_url(money_request_url(mercado_pago_id), access_token: access_token)\n headers = {:accept => 'application/json'}\n get url, headers, quiet: true\n end",
"def transaction_data(item_account_id=nil,higher_limit=500,lower_limit=1, end_number=100, start_number=1)\n if cobrand_token && token\n query({\n :endpoint => '/jsonsdk/TransactionSearchService/executeUserSearchRequest',\n :method => :POST,\n :params => {\n :cobSessionToken => cobrand_token,\n :userSessionToken => token,\n :'transactionSearchRequest.containerType'=>'All',\n :'transactionSearchRequest.higherFetchLimit'=>higher_limit,\n :'transactionSearchRequest.lowerFetchLimit'=>lower_limit,\n :'transactionSearchRequest.resultRange.endNumber'=>end_number,\n :'transactionSearchRequest.resultRange.startNumber'=>start_number,\n :'transactionSearchRequest.searchClients.clientId'=>1,\n :'transactionSearchRequest.searchClients.clientName'=>'DataSearchService',\n :'transactionSearchRequest.userInput'=>nil,\n :'transactionSearchRequest.ignoreUserInput'=>true,\n :'transactionSearchRequest.searchFilter.currencyCode'=>'USD',\n :'transactionSearchRequest.searchFilter.postDateRange.fromDate'=>1.year.ago.strftime('%m-%d-%YT00:00:00.000Z'),\n :'transactionSearchRequest.searchFilter.postDateRange.toDate'=>Time.zone.now.strftime('%m-%d-%YT00:00:00.000Z'),\n :'transactionSearchRequest.searchFilter.transactionSplitType'=> 'ALL_TRANSACTION',\n :'transactionSearchRequest.searchFilter.itemAccountId.identifier' => item_account_id\n } \n })\n else\n nil\n end\n end",
"def api_transactions_command(transfer_json_data, customer_id = ENV['CIRCLE_CUSTOMER_ID'], customer_session_token = ENV['CIRCLE_CUSTOMER_SESSION_TOKEN'], circle_bank_account_id = ENV['CIRCLE_BANK_ACCOUNT_ID'])\n btc_transfer_json_data = transfer_json_data.to_json\n content_length = btc_transfer_json_data.length\n\n api_url = \"https://www.circle.com/api/v2/customers/#{customer_id}/accounts/#{circle_bank_account_id}/transactions\"\n\n path_header = \"/api/v2/customers/#{customer_id}/accounts/#{circle_bank_account_id}/transactions\"\n\n curl = Curl::Easy.http_post(api_url, btc_transfer_json_data) do |http|\n http.headers['host'] = 'www.circle.com'\n http.headers['method'] = 'POST'\n http.headers['path'] = path_header\n http.headers['scheme'] = 'https'\n http.headers['version'] = 'HTTP/1.1'\n http.headers['accept'] = 'application/json, text/plain, */*'\n http.headers['accept-encoding'] = 'gzip,deflate'\n http.headers['accept-language'] = 'en-US,en;q=0.8'\n http.headers['content-length'] = content_length\n http.headers['content-type'] = 'application/json;charset=UTF-8'\n http.headers['cookie'] = circle_cookie\n http.headers['origin'] = 'https://www.circle.com'\n http.headers['referer'] = \"https://www.circle.com/send/confirm\"\n http.headers['user-agent'] = \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36\"\n http.headers['x-app-id'] = 'angularjs'\n http.headers['x-app-version'] = \"0.0.1\"\n http.headers['x-customer-id'] = customer_id\n http.headers['x-customer-session-token'] = customer_session_token\n end\n\n json_data = ActiveSupport::Gzip.decompress(curl.body_str)\n parsed_json = JSON.parse(json_data)\n\n btc_transfer_response_status = parsed_json\n response_code = btc_transfer_response_status['response']['status']['code']\n if response_code == 0\n # puts 'Successful BTC tansfer!'\n # puts 'Transfer Details:'\n # puts btc_transfer_response_status\n else\n puts '** ERROR ** BTC Transfer Unsuccessful'\n puts 'Transfer Details:'\n puts btc_transfer_response_status\n end\n response_code\n end",
"def wallet_transaction_with_http_info(wallet_transaction_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.wallet_transaction ...'\n end\n # verify the required parameter 'wallet_transaction_request' is set\n if @api_client.config.client_side_validation && wallet_transaction_request.nil?\n fail ArgumentError, \"Missing the required parameter 'wallet_transaction_request' when calling DefaultApi.wallet_transaction\"\n end\n # resource path\n local_var_path = '/api/v1/wallet/transaction'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(wallet_transaction_request) \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || ['csrfAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#wallet_transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def transaction_service_confirm_with_http_info(space_id, transaction_model, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionService.transaction_service_confirm ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling TransactionService.transaction_service_confirm\" if space_id.nil?\n # verify the required parameter 'transaction_model' is set\n fail ArgumentError, \"Missing the required parameter 'transaction_model' when calling TransactionService.transaction_service_confirm\" if transaction_model.nil?\n # resource path\n local_var_path = \"/transaction/confirm\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(transaction_model)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Transaction')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionService#transaction_service_confirm\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def transaction_raw_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transaction_raw ...'\n end\n # resource path\n local_var_path = '/api/v2/transaction/raw'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'txid'] = opts[:'txid'] if !opts[:'txid'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transaction_raw\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def accounts_transactions_get_with_http_info(account_id, authorization, psu_ip_address, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountsApi.accounts_transactions_get ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling AccountsApi.accounts_transactions_get\"\n end\n # verify the required parameter 'authorization' is set\n if @api_client.config.client_side_validation && authorization.nil?\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling AccountsApi.accounts_transactions_get\"\n end\n # verify the required parameter 'psu_ip_address' is set\n if @api_client.config.client_side_validation && psu_ip_address.nil?\n fail ArgumentError, \"Missing the required parameter 'psu_ip_address' when calling AccountsApi.accounts_transactions_get\"\n end\n if @api_client.config.client_side_validation && !opts[:'start_date'].nil? && opts[:'start_date'] !~ Regexp.new(/^-?\\\\d{1,12}$/)\n fail ArgumentError, \"invalid value for 'opts[:\\\"start_date\\\"]' when calling AccountsApi.accounts_transactions_get, must conform to the pattern /^-?\\\\d{1,12}$/.\"\n end\n\n if @api_client.config.client_side_validation && !opts[:'end_date'].nil? && opts[:'end_date'] !~ Regexp.new(/^-?\\\\d{1,12}$/)\n fail ArgumentError, \"invalid value for 'opts[:\\\"end_date\\\"]' when calling AccountsApi.accounts_transactions_get, must conform to the pattern /^-?\\\\d{1,12}$/.\"\n end\n\n # resource path\n local_var_path = '/v2/accounts/{accountId}/transactions'.sub('{' + 'accountId' + '}', account_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Authorization'] = authorization\n header_params[:'PSU-IP-Address'] = psu_ip_address\n header_params[:'PSU-Accept-Language'] = opts[:'psu_accept_language'] if !opts[:'psu_accept_language'].nil?\n header_params[:'PSU-User-Agent'] = opts[:'psu_user_agent'] if !opts[:'psu_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountKycStatusOutput')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#accounts_transactions_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def make_api_request(query)\n response = timeout(configuration.timeout) do\n uri = URI.parse(query_url(query))\n http_client.start(uri.host, uri.port, :use_ssl => true) do |client|\n req = Net::HTTP::Post.new(uri.request_uri, configuration.http_headers)\n req.basic_auth(uri.user, uri.password) if uri.user and uri.password\n req.body = sensis_query_json(query)\n req.content_type = 'application/json'\n req['X-Auth-Token'] = configuration.api_key[0]\n req['X-Auth-Password'] = configuration.api_key[1]\n client.request(req)\n end\n end\n case response.code.to_i\n when 200\n return response\n when 400\n raise_error ::Geocoder::InvalidRequest, \"Bad Request: #{response.body}\"\n else\n raise_error ::Geocoder::Error, \"Unable to access Sensis API: #{response.code}. Body:\\n#{response.body}\"\n end\n response\n end",
"def get_transaction(*params); raise('Stub or mock required.') end",
"def get_programreserve_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProgramReserveApi.get_programreserve_transactions ...'\n end\n # resource path\n local_var_path = '/programreserve/transactions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'start_index'] = opts[:'start_index'] if !opts[:'start_index'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'ProgramReserveTransactionListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"ProgramReserveApi.get_programreserve_transactions\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProgramReserveApi#get_programreserve_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def confirm_with_http_info(space_id, transaction_model, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionService.confirm ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling TransactionService.confirm\" if space_id.nil?\n # verify the required parameter 'transaction_model' is set\n fail ArgumentError, \"Missing the required parameter 'transaction_model' when calling TransactionService.confirm\" if transaction_model.nil?\n # resource path\n local_var_path = \"/transaction/confirm\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n \n # connection timeout\n timeout = @api_client.get_connection_timeout()\n\n # http body (model)\n post_body = @api_client.object_to_http_body(transaction_model)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :timeout => timeout,\n :auth_names => auth_names,\n :return_type => 'Transaction')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionService#confirm\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def searchrawtransactions(bitcoinaddress, verbose=1)\n @api.request 'searchrawtransactions', bitcoinaddress, verbose\n end",
"def get_transactions(*params); raise('Stub or mock required.') end",
"def validate_transactions_with_http_info(transaction_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.validate_transactions ...'\n end\n # verify the required parameter 'transaction_request' is set\n if @api_client.config.client_side_validation && transaction_request.nil?\n fail ArgumentError, \"Missing the required parameter 'transaction_request' when calling TransactionsApi.validate_transactions\"\n end\n # resource path\n local_var_path = '/transactions/validate'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(transaction_request)\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TransactionResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#validate_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_transaction_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsTransactionsApi.get_transaction ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling PaymentsTransactionsApi.get_transaction\"\n end\n # resource path\n local_var_path = \"/transactions/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TransactionResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsTransactionsApi#get_transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def txs_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.txs_get ...'\n end\n # resource path\n local_var_path = '/txs'\n\n # query parameters\n query_params = {}\n query_params[:'message.action'] = opts[:'message_action'] if !opts[:'message_action'].nil?\n query_params[:'message.sender'] = opts[:'message_sender'] if !opts[:'message_sender'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'tx.minheight'] = opts[:'tx_minheight'] if !opts[:'tx_minheight'].nil?\n query_params[:'tx.maxheight'] = opts[:'tx_maxheight'] if !opts[:'tx_maxheight'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PaginatedQueryTxs')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#txs_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def transaction_verify_with_http_info(transaction_verify_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transaction_verify ...'\n end\n # verify the required parameter 'transaction_verify_request' is set\n if @api_client.config.client_side_validation && transaction_verify_request.nil?\n fail ArgumentError, \"Missing the required parameter 'transaction_verify_request' when calling DefaultApi.transaction_verify\"\n end\n # resource path\n local_var_path = '/api/v2/transaction/verify'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(transaction_verify_request) \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || ['csrfAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transaction_verify\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def transactionGet(options={})\n assert_valid_keys(options, :transactionId)\n assert_keys_exists(options, :transactionId)\n execute(:transactionGet, options)\n end",
"def transactionGet(options={})\n assert_valid_keys(options, :transactionId)\n assert_keys_exists(options, :transactionId)\n execute(:transactionGet, options)\n end",
"def transactions_by_ref(merchant_ref)\n client.get \"transactions/#{inst_id}/byRef?merchantRef=#{merchant_ref}\"\n end",
"def get_transaction(key_value_pair)\n query_params = {\n username: @options[:username],\n password: @options[:password],\n account_id: @options[:account_id],\n }\n\n key, value = key_value_pair.first\n response = case key\n when :reference\n query_params[:reference] = value\n client.get(\"webpayments/paymentservice/rest/QueryTransactionByReference\", query_params)\n when :txn_id\n query_params[:txn_id] = value\n client.get(\"webpayments/paymentservice/rest/QueryTransactionByTxnId\", query_params)\n when :particular\n query_params[:particular] = value[0..40]\n client.get(\"webpayments/paymentservice/rest/QueryTransactionByParticular\", query_params)\n else\n raise Paymark::Error, \"Unsupported get by: #{key}\"\n end\n\n if response.status == 200\n CreditCardTransaction.new(response.body['CreditCardTransaction'])\n elsif response.body.is_a? Hash\n raise Paymark::Error, response.body.dig('CreditCardTransaction','error_message')\n else\n raise Paymark::Error response.body || \"HTTP #{response.status}\"\n end\n end",
"def getTransactionBy_paypal_transaction_id( paypal_transaction_id)\n params = Hash.new\n params['paypal_transaction_id'] = paypal_transaction_id\n return doCurl(\"get\",\"/transaction/by_paypal_transaction_id\",params)\n end",
"def transaction_data_view(searchIdentifier, start_number=1,end_number=100)\n if searchIdentifier\n query({\n :endpoint => '/jsonsdk/TransactionSearchService/getUserTransactions',\n :method => :POST,\n :params => {\n :cobSessionToken => cobrand_token,\n :userSessionToken => token,\n :'searchFetchRequest.searchIdentifier.identifier' => searchIdentifier,\n :'searchFetchRequest.searchResultRange.startNumber' => start_number,\n :'searchFetchRequest.searchResultRange.endNumber' => end_number\n } \n })\n else\n nil\n end\n end",
"def tx_by_address( address, api_key )\n address = encode( address )\n get(\"/txbyaddress/#{address}/#{api_key}\")\n end",
"def call_api\n url = \"#{@base_uri}/stock\"\n params = {symbol: @symbol, api_token: @api_key}\n\n if @exchange\n params[:stock_exchange] = @exchange\n end\n\n Lita.logger.debug \"call_api: #{url} #{params.inspect}\"\n\n @response = RestClient.get url, {params: params}\n\n Lita.logger.debug \"response: #{@response}\"\n end",
"def tranaactions_request(url_parameters)\n transactions = []\n\n page_number = 1\n\n loop do\n request_result = history_request url: 'history/transactions', api_version: API_V2,\n url_parameters: url_parameters.merge(pageNumber: page_number)\n\n transactions += @dealing_platform.instantiate_models Transaction, request_result.fetch(:transactions)\n\n break if page_number == request_result.fetch(:metadata).fetch(:page_data).fetch(:total_pages)\n\n page_number += 1\n end\n\n transactions\n end",
"def find_by_code(company_code, transaction_code, args = {})\n raise ArgumentError, 'company_code is required' if company_code.blank?\n raise ArgumentError, 'transaction_code is required' if transaction_code.blank?\n\n resp = connection.get \"/api/v2/companies/#{company_code}/transactions/#{transaction_code}\", args\n handle_response(resp)\n end",
"def transaction_inject_with_http_info(rawtx, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transaction_inject ...'\n end\n # verify the required parameter 'rawtx' is set\n if @api_client.config.client_side_validation && rawtx.nil?\n fail ArgumentError, \"Missing the required parameter 'rawtx' when calling DefaultApi.transaction_inject\"\n end\n # resource path\n local_var_path = '/api/v1/injectTransaction'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'application/xml'])\n header_params[:'rawtx'] = rawtx\n header_params[:'no_broadcast'] = opts[:'no_broadcast'] if !opts[:'no_broadcast'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'String' \n\n # auth_names\n auth_names = opts[:auth_names] || ['csrfAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transaction_inject\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_transaction_status_using_get_with_http_info(transaction_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionStatusApi.get_transaction_status_using_get ...'\n end\n # verify the required parameter 'transaction_id' is set\n if @api_client.config.client_side_validation && transaction_id.nil?\n fail ArgumentError, \"Missing the required parameter 'transaction_id' when calling TransactionStatusApi.get_transaction_status_using_get\"\n end\n # resource path\n local_var_path = '/transaction_status/{transaction_id}'.sub('{' + 'transaction_id' + '}', transaction_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TransactionSuccessResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionStatusApi#get_transaction_status_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def transaction_service_search(space_id, query, opts = {})\n data, _status_code, _headers = transaction_service_search_with_http_info(space_id, query, opts)\n return data\n end",
"def transaction_service_read_with_http_info(space_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionService.transaction_service_read ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling TransactionService.transaction_service_read\" if space_id.nil?\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling TransactionService.transaction_service_read\" if id.nil?\n # resource path\n local_var_path = \"/transaction/read\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n query_params[:'id'] = id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['*/*']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Transaction')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionService#transaction_service_read\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def make_request(search_term)\n JSON.parse(RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"))\nend",
"def auth_transaction\n data = full_params.merge(\n 'x_unique_id' => unique_id,\n 'x_invoice_num' => invoice_num,\n 'x_type' => \"AUTH_ONLY\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def transactionGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :transactionId)\n assert_keys_exists(options, :transactionId)\n execute(:transactionGet, options)\n end",
"def send_request(args)\n set_settings(args[:settings])\n\n XingApi::Job.search(args[:keywords], {:limit => args[:page_size], :offset => 0})\n rescue XingApi::Error => e\n {:code => e.status_code, :msg => e.text}\n end",
"def perform_get(rest_url, request)\n query_params = request.api_params.blank? ? '' : to_query_params(request.api_params)\n url = \"#{rest_url}&#{query_params}\"\n\n response = RestClient::Request.execute(\n method: request.http_method,\n url: url,\n headers: request.header_params,\n read_timeout: 30,\n open_timeout: 15\n )\n JSON.parse(response)\n end",
"def check_transaction_status\n data = basic_credentials.merge(\n 'x_trans_key' => @x_trans_key,\n 'x_invoice_num' => invoice_num,\n 'x_type' => (type || 0)\n )\n\n astro_curl(@transtatus_url, data)\n end",
"def apiSearch\n if params[:search]\n\t@service = Service.find(:all, :conditions => ['name LIKE ?', \"%#{params[:search]}%\"], :limit => \"10\")\n end\n if params[:buy] && params[:search]\n @service = Service.find(:all, :conditions => ['buy LIKE ? AND name LIKE ?', \"#{params[:buy]}\", \"%#{params[:search]}%\"], :limit => \"20\")\n end\n if params[:sell] && params[:search]\n @service = Service.find(:all, :conditions => ['sell LIKE ? AND name LIKE ?', \"#{params[:sell]}\", \"%#{params[:search]}%\" ], :limit => \"20\")\n end\n @signature = params[:signature]\n params = request.query_parameters.reject {|key, value| key.to_s == \"signature\"}\n params.sort_by {|key, value| key.to_s.underscore}.join('')\n @parameters = params.to_s\n @secret = ApplicationAccount.api_secret_field\n @app_key = ApplicationAccount.api_key_field\n respond_to do |format|\n format.html # show.html.erb\n if params[:app_key] == @app_key\n if @signature == Digest::MD5.hexdigest(\"#{@app_key}#{@parameters}#{@secret}\").to_s\n\t #format.xml { render :xml => Digest::MD5.hexdigest(\"#{@app_key}#{@parameters}#{@secret}\").to_s }\n if @service != nil\n format.xml { render :xml => @service.to_xml(:only => [:id, :name, :description, :contact_name, :contact_title, :contact_email, :buy, :sell, :created_at, :updated_at]) }\n else\n format.xml { render :xml => \"<WARNING>there is not such a service</WARNING>\" }\n end\n else\n @test = Digest::MD5.hexdigest(\"#{@app_key}#{@parameters}#{@secret}\").to_s\n format.xml { render :xml => \"<WARNING>El signature debe ser: #{@test} </WARNING>\" }\n end\n end\n end\n end",
"def request(params = {})\n params.merge!(default_params)\n\n uri = URI.parse(base_uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n encoded = URI.encode_www_form(params)\n path = [uri.path, encoded].join(\"?\")\n\n request = Net::HTTP::Get.new(path)\n\n STDERR.puts path if debug?\n\n response = http.request(request) \n\n case response.code.to_i\n when 200\n STDERR.puts response.body if debug?\n\n response = MultiXml.parse(response.body)\n if response[\"interface_response\"][\"ErrCount\"].to_i == 0\n return response\n else\n raise InterfaceError, response[\"interface_response\"][\"errors\"].values.join(\", \")\n end\n end\n end",
"def request(params)\n\n # Add auth header\n headers = params[:headers] || {}\n headers['x-vcloud-authorization'] = @auth_key if !@auth_key.nil? || !@auth_key.equal?('')\n\n # set connection options\n options = {:url => params[:url],\n :body => params[:body] || '',\n :expects => params[:expects] || 200,\n :headers => headers || {},\n :method => params[:method] || 'GET'\n }\n\n # connect\n res = RestClient::Request.execute options\n\n raise res if (res.code!=params[:expects] && res.code!=200)\n\n res\n\n\n end",
"def transactions(account_id, opts = {})\n query = {}\n query['cursor'] = opts[:cursor] if opts[:cursor]\n query['start'] = opts[:start] if opts[:start]\n query['end'] = opts[:end] if opts[:end]\n query['time_field'] = opts[:time_field] if opts[:time_field]\n\n api_get(path(account_id), query)\n end",
"def calculate_transactions_with_http_info(transaction_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.calculate_transactions ...'\n end\n # verify the required parameter 'transaction_request' is set\n if @api_client.config.client_side_validation && transaction_request.nil?\n fail ArgumentError, \"Missing the required parameter 'transaction_request' when calling TransactionsApi.calculate_transactions\"\n end\n # resource path\n local_var_path = '/transactions/calculate'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(transaction_request)\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TransactionResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#calculate_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def send_request(operation = 'GET', path = '', data = nil, headers = {}, search_path = {})\n request = nil\n encoded_search = ''\n\n vault_scheme = resource[:api_scheme]\n vault_server = resource[:api_server]\n vault_port = resource[:api_port]\n\n if URI.respond_to?(:encode_www_form)\n encoded_search = URI.encode_www_form(search_path)\n else\n # Ideally we would have use URI.encode_www_form but it isn't\n # available with Ruby 1.8.x that ships with CentOS 6.5.\n encoded_search = search_path.to_a.map do |x|\n x.map { |y| CGI.escape(y.to_s) }.join('=')\n end\n encoded_search = encoded_search.join('&')\n end\n uri = URI.parse '%s://%s:%d%s?%s' % [vault_scheme, vault_server, vault_port, path, encoded_search]\n\n case operation.upcase\n when 'POST'\n request = Net::HTTP::Post.new(uri.request_uri, headers)\n request.body = data.to_json\n when 'PUT'\n request = Net::HTTP::Put.new(uri.request_uri, headers)\n request.body = data.to_json\n when 'GET'\n request = Net::HTTP::Get.new(uri.request_uri, headers)\n when 'DELETE'\n request = Net::HTTP::Delete.new(uri.request_uri, headers)\n else\n raise Puppet::Error, 'Unsupported HTTP operation %s' % operation\n end\n\n request.content_type = 'application/json'\n\n resp = nil\n Net::HTTP.start(vault_server, vault_port,\n use_ssl: vault_scheme == 'https',\n verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|\n resp = http.request(request)\n end\n\n # check response for success, redirect or error\n case resp\n when Net::HTTPSuccess then\n return JSON.parse(resp.body) if resp.body\n resp\n when Net::HTTPRedirection then\n send_request(operation, resp['location'], data, headers)\n else\n message = 'code=' + resp.code\n message += ' message=' + resp.message\n message += ' body=' + resp.body\n raise resp.error_type.new(message, resp)\n end\n end",
"def decoderawtransaction(transaction)\n @api.request 'decoderawtransaction', transaction\n end",
"def index\n @search = @source.source_transactions.search(params[:q])\n @transactions = @search.result\n end",
"def do_search(url, use_get = false)\n if use_get\n request = Net::HTTP::Get.new(url)\n Rails.logger.debug(\"GET Search url: #{url}\")\n else\n request = Net::HTTP::Post.new(url)\n Rails.logger.debug(\"POST Search url: #{url} \")\n end\n response = do_http_request(request)\n if response.code.to_s != '200'\n raise RequestFailedException.new(\"#{response.code}: #{response.body}\")\n end\n results = ASUtils.json_parse(response.body)\n results\n end",
"def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end",
"def search(params = {})\n @api.get(\"api.json\", params)\n end",
"def request(http_method, url, params, schema = nil, required_root_key = nil)\n\n if params.is_a?(Hash)\n params = add_defaults!(params)\n end\n\n if schema\n validate_data_with_schema!(params, schema)\n end\n\n # perform request\n response = ::Hypercharge.config.faraday.send(http_method, url, params) do |req|\n\n if url.to_s[-4..-1] == 'json'\n req['Content-Type'] = 'application/json'\n req['Accept'] = 'application/json'\n else\n req['Content-Type'] = 'text/xml'\n req['Accept'] = 'text/xml'\n end\n end\n\n handle_response(response, required_root_key)\n rescue Faraday::Error::ClientError => e\n raise Errors.map_faraday_error(e), e\n end",
"def get_internal_transaction_by_transaction_hash_and_operation_id_with_http_info(blockchain, network, operation_id, transaction_hash, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InternalApi.get_internal_transaction_by_transaction_hash_and_operation_id ...'\n end\n # verify the required parameter 'blockchain' is set\n if @api_client.config.client_side_validation && blockchain.nil?\n fail ArgumentError, \"Missing the required parameter 'blockchain' when calling InternalApi.get_internal_transaction_by_transaction_hash_and_operation_id\"\n end\n # verify enum value\n allowable_values = [\"ethereum\", \"binance-smart-chain\", \"ethereum-classic\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(blockchain)\n fail ArgumentError, \"invalid value for \\\"blockchain\\\", must be one of #{allowable_values}\"\n end\n # verify the required parameter 'network' is set\n if @api_client.config.client_side_validation && network.nil?\n fail ArgumentError, \"Missing the required parameter 'network' when calling InternalApi.get_internal_transaction_by_transaction_hash_and_operation_id\"\n end\n # verify enum value\n allowable_values = [\"mainnet\", \"testnet\", \"mordor\", \"goerli\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(network)\n fail ArgumentError, \"invalid value for \\\"network\\\", must be one of #{allowable_values}\"\n end\n # verify the required parameter 'operation_id' is set\n if @api_client.config.client_side_validation && operation_id.nil?\n fail ArgumentError, \"Missing the required parameter 'operation_id' when calling InternalApi.get_internal_transaction_by_transaction_hash_and_operation_id\"\n end\n # verify the required parameter 'transaction_hash' is set\n if @api_client.config.client_side_validation && transaction_hash.nil?\n fail ArgumentError, \"Missing the required parameter 'transaction_hash' when calling InternalApi.get_internal_transaction_by_transaction_hash_and_operation_id\"\n end\n # resource path\n local_var_path = '/blockchain-data/{blockchain}/{network}/transactions/{transactionHash}/internal/{operationId}'.sub('{' + 'blockchain' + '}', CGI.escape(blockchain.to_s)).sub('{' + 'network' + '}', CGI.escape(network.to_s)).sub('{' + 'operationId' + '}', CGI.escape(operation_id.to_s)).sub('{' + 'transactionHash' + '}', CGI.escape(transaction_hash.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'context'] = opts[:'context'] if !opts[:'context'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'GetInternalTransactionByTransactionHashAndOperationIdR'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiKey']\n\n new_options = opts.merge(\n :operation => :\"InternalApi.get_internal_transaction_by_transaction_hash_and_operation_id\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InternalApi#get_internal_transaction_by_transaction_hash_and_operation_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def transactions_post_with_http_info(method, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_post ...'\n end\n # verify the required parameter 'method' is set\n if @api_client.config.client_side_validation && method.nil?\n fail ArgumentError, \"Missing the required parameter 'method' when calling DefaultApi.transactions_post\"\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n query_params[:'method'] = method\n query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].nil?\n query_params[:'mobile'] = opts[:'mobile'] if !opts[:'mobile'].nil?\n query_params[:'holdername'] = opts[:'holdername'] if !opts[:'holdername'].nil?\n query_params[:'cardnumber'] = opts[:'cardnumber'] if !opts[:'cardnumber'].nil?\n query_params[:'cvv'] = opts[:'cvv'] if !opts[:'cvv'].nil?\n query_params[:'exp'] = opts[:'exp'] if !opts[:'exp'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'account'] = opts[:'account'] if !opts[:'account'].nil?\n query_params[:'reference'] = opts[:'reference'] if !opts[:'reference'].nil?\n query_params[:'genericmsg'] = opts[:'genericmsg'] if !opts[:'genericmsg'].nil?\n query_params[:'token'] = opts[:'token'] if !opts[:'token'].nil?\n query_params[:'bouquet'] = opts[:'bouquet'] if !opts[:'bouquet'].nil?\n query_params[:'payoption'] = opts[:'payoption'] if !opts[:'payoption'].nil?\n query_params[:'meternumber'] = opts[:'meternumber'] if !opts[:'meternumber'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apipassword', 'apiusername']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse200')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transactions_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def queryTransactionsDetailJSON(params)\n begin\n { \n :TransactionDetailFormat => 'CWSTransaction',\n :PagingParameters => { \n :Page => 0, \n :PageSize => 10\n },\n :QueryTransactionsParameters => { \n :Amounts => nil,\n :ApprovalCodes => nil,\n :BatchIds => batch_ids(params),\n :CaptureDateRange =>nil,\n :CaptureStates => nil,\n :TransactionIds => mul_trd(params),\n :MerchantProfileIds => nil,\n :CardTypes => nil,\n :IsAcknowledged=> \"false\",\n :OrderNumbers => nil,\n :QueryType => \"OR\",\n :ServiceIds => nil,\n :ServiceKeys => nil,\n :TransactionClassTypePairs=> nil,\n :TransactionDateRange=> transaction_date_range(params),\n :TransactionStates => nil,\n },\n :IncludeRelated => 'false' \n }.to_json\n rescue Exception => ex\n return \"Some value not set in querytransactiondetail, batchid, transactionid or transactiondates!\"\n end\n end",
"def service_quote(params={})\n url = \"#{params[:url]}?type=quote&amount=#{params[:amount]}%2F#{params[:currency]}&destination=#{params[:destination]}&domain=#{params[:domain]}}\"\n\n # Add extra_fields to url\n if params.key?(:extra_fields)\n params[:extra_fields].each do |key, value|\n url = \"#{url}&#{key}=#{value}\"\n end\n end\n\n\n puts \"URL: \" + url\n\n begin\n response = connection.get url\n rescue Faraday::Error::ConnectionFailed\n raise ConnectionFailed\n rescue Faraday::Error::TimeoutError\n raise Timedout\n end\n\n # Check for error\n if response.body.result == 'error'\n # Error\n raise FederationError, response.body.error_message\n end\n if response.body.Result == \"Error\"\n raise FederationError, response.body.Message\n end\n\n quote = response.body.quote\n destination_amount = Ripple::Model::Amount.new(quote['send'].first)\n\n {\n destination_account: quote.address,\n destination_amount: destination_amount,\n destination_tag: quote.destination_tag,\n invoice_id: quote.invoice_id\n }\n end",
"def send_request(type,params)\n request_url = prepare_url(type,params)\n log \"Request URL: #{request_url}\"\n res = nil\n RemoteUtil.do_with_retry(exceptions: [TimeoutError, InternalServerError]) do |except|\n begin\n if not except.nil?\n puts \"Error calling BestBuy API, will retry: \" + except.to_s\n end\n res = Net::HTTP.get_response(URI::parse(request_url))\n rescue Timeout::Error\n raise BestBuyApi::TimeoutError, \"Timeout calling #{request_url}\"\n end\n if res.kind_of? Net::HTTPSuccess\n # Successful HTTP result.\n elsif res.kind_of? Net::HTTPInternalServerError\n raise BestBuyApi::InternalServerError, \"HTTP Response: #{res.code} #{res.message} for #{request_url}\"\n else\n raise BestBuyApi::RequestError, \"HTTP Response: #{res.code} #{res.message} for #{request_url}\"\n end\n end\n begin\n JSON.parse(res.body)\n rescue JSON::ParserError\n raise BestBuyApi::RequestError, \"Bad Response: JSON Parser Error for #{request_url}\"\n end\n \n end",
"def make_request(search_term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\")\n final_response = JSON.parse(response)\nend",
"def payin_transaction_with_http_info(transaction_id, payin_method_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.payin_transaction ...'\n end\n # verify the required parameter 'transaction_id' is set\n if @api_client.config.client_side_validation && transaction_id.nil?\n fail ArgumentError, \"Missing the required parameter 'transaction_id' when calling TransactionsApi.payin_transaction\"\n end\n # verify the required parameter 'payin_method_request' is set\n if @api_client.config.client_side_validation && payin_method_request.nil?\n fail ArgumentError, \"Missing the required parameter 'payin_method_request' when calling TransactionsApi.payin_transaction\"\n end\n # resource path\n local_var_path = '/transactions/{Transaction ID}/payin'.sub('{' + 'Transaction ID' + '}', transaction_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(payin_method_request)\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TransactionResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#payin_transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def send_request(path, params={}, data=nil)\n data = data.to_xml if data.respond_to?(:to_xml)\n if data\n http_context = connection.post(path, data, params, post_headers)\n else\n http_context = connection.get(path, params)\n end\n raise RSolr::RequestError.new(http_context[:body]) unless http_context[:status_code] == 200\n http_context\n end",
"def perform_get_request\n # Validate preventing request error\n\n # setup params, like API Key if needed\n\n # Perform the request\n get_request\n end",
"def send_request(method, options = {})\n http_method = :get\n endpoint = REST_API_ENDPOINT\n options.merge!(:api_key => @api_key, :method => method)\n sign_request(options)\n \n rsp = http_request(options, http_method, endpoint)\n \n rsp = '<rsp stat=\"ok\"></rsp>' if rsp == \"\"\n xm = XmlMagic.new(rsp)\n \n if xm[:stat] == 'ok'\n xm\n else\n raise Rocinante::Errors.error_for(xm.err[:code].to_i, xm.err[:msg])\n end\n end",
"def perform_request url\n response = self.class.get(url)\n raise NotFound.new(\"404 Not Found\") if response.respond_to?(:code) && response.not_found?\n raise InvalidAPIResponse.new(response[\"status\"][\"message\"]) if response.is_a?(Hash) && response[\"status\"]\n\n response\n end",
"def list_transactions_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionsApi.list_transactions ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling TransactionsApi.list_transactions\" if location_id.nil?\n if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of DESC, ASC'\n end\n # resource path\n local_var_path = \"/v2/locations/{location_id}/transactions\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?\n query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?\n query_params[:'sort_order'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2018-07-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListTransactionsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#list_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def lookup(options)\n # q6z5e0on\n @client.get_request('/moms/transaction.lookup', options) \n end",
"def get_business_client_transaction_all_using_get_with_http_info(business_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BusinessApi.get_business_client_transaction_all_using_get ...'\n end\n # verify the required parameter 'business_id' is set\n if @api_client.config.client_side_validation && business_id.nil?\n fail ArgumentError, \"Missing the required parameter 'business_id' when calling BusinessApi.get_business_client_transaction_all_using_get\"\n end\n # resource path\n local_var_path = '/nucleus/v1/business/{business_id}/transaction'.sub('{' + 'business_id' + '}', business_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'currency_conversion'] = opts[:'currency_conversion'] if !opts[:'currency_conversion'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PagePortfolioTransaction')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BusinessApi#get_business_client_transaction_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def search(transactions)\n return transactions.select{|el| el.sender_id.to_s.starts_with?(params[:search_transaction]) || \n el.receiver_id.to_s.starts_with?(params[:search_transaction]) || \n el.amount.to_s.starts_with?(params[:search_transaction]) || \n el.created_at.to_s.starts_with?(params[:search_transaction])}\n end"
] |
[
"0.70431465",
"0.6969769",
"0.6944244",
"0.6600387",
"0.642537",
"0.64236534",
"0.64223266",
"0.64206314",
"0.64206314",
"0.64198583",
"0.63627535",
"0.6361853",
"0.63490045",
"0.63490045",
"0.6319004",
"0.62986666",
"0.6293366",
"0.6283354",
"0.6263393",
"0.6258303",
"0.6238492",
"0.62074006",
"0.6197367",
"0.6135774",
"0.6088897",
"0.6033629",
"0.60200614",
"0.59690315",
"0.59549993",
"0.595257",
"0.59425247",
"0.5902835",
"0.5888098",
"0.58371586",
"0.58371586",
"0.5827133",
"0.582438",
"0.58090776",
"0.58023095",
"0.58012813",
"0.5790986",
"0.5789043",
"0.578852",
"0.578378",
"0.57607555",
"0.57354736",
"0.5731578",
"0.571505",
"0.5714695",
"0.5712081",
"0.5702979",
"0.5700452",
"0.56639415",
"0.5630179",
"0.5630179",
"0.56007296",
"0.55986196",
"0.5598309",
"0.5592345",
"0.55802345",
"0.55788773",
"0.5559252",
"0.555923",
"0.5555356",
"0.55524755",
"0.55363107",
"0.55263984",
"0.5524548",
"0.5523462",
"0.55230945",
"0.55218434",
"0.55133325",
"0.5503033",
"0.5494253",
"0.5489843",
"0.548977",
"0.54850703",
"0.5483959",
"0.5480204",
"0.547216",
"0.5471663",
"0.5469601",
"0.5460675",
"0.54583186",
"0.54554516",
"0.5452435",
"0.5450428",
"0.5450067",
"0.5445228",
"0.54404473",
"0.54383636",
"0.5436397",
"0.5428396",
"0.5428256",
"0.5418508",
"0.5417443",
"0.5412725",
"0.5412344",
"0.5409942",
"0.5405911"
] |
0.74454635
|
0
|
note: this extremely convoluted code is not how Ruby normally works, but Ruby's standard library's HTTP support is pretty horrible. most people use but we wanted to minimise dependencies here.
|
def post_request(device_id, epoch_time)
uri = URI.parse(BASE_URL)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = false
request = Net::HTTP::Post.new("/#{device_id}/#{epoch_time}")
response = http.request(request)
response.code == "200"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def http; end",
"def net_http_res; end",
"def getHttp(fpUri,fpVerb=\"GET\",fpData=\"\")\n\t#@fpUserAgent = \"CMU/2.2 CFNetwork/672.0.8 Darwin/14.0.0\"\n\t@fpUserAgent = \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:49.0) Gecko/20100101 Firefox/49.0\"\n\n\thttp = Net::HTTP.new(fpUri.host, fpUri.port)\n\n\tcase fpUri.scheme.upcase\n\t\twhen \"https\".upcase\n\t\t\thttp.use_ssl = true\n\t\t \t# For signature checks it doesn't matter if a valid certificate is present.\n\t\t \thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE if fpUri.scheme.upcase == \"https\".upcase\n\t\telse\n\t\tend\n\n\tcase fpVerb.upcase\n\t\twhen \"Get\".upcase\n\t\t\t# For now forcing encoding to text as some devices being tested have broken compression implemented.\n\t\t\trequest = Net::HTTP::Get.new(fpUri,initheader = {'Accept-Encoding' => 'gzip, default, br', 'User-Agent' => @fpUserAgent}) if fpVerb.upcase == \"Get\".upcase\n\t\t\t# request = Net::HTTP::Get.new(fpUri) if fpVerb.upcase == \"Get\".upcase # Default Header\n\t\t\t\n\t\t\tputs \"GET #{fpUri}\"\n\n\t\twhen \"Post\".upcase\n\t\t\trequest = Net::HTTP::Post.new(fpUri.request_uri) if fpVerb.upcase == \"Post\".upcase\n\t\t\trequest.set_form_data(fpData) if fpVerb.upcase == \"Post\".upcase\n\t\t\n\t\telse\n\t\t\trequestFail = true\n\t\tend\n\n\tresponse = http.request(request) if !requestFail\n\treturn response\nend",
"def new_http(uri); end",
"def make_request(url,headers,query)\n c = HTTPClient.new\n c.get_content(url,query,headers)\nend",
"def read_http(url)\n uri = URI(url)\n Net::HTTP.get_response(uri)\nend",
"def read_http(url)\n uri = URI(url)\n Net::HTTP.get_response(uri)\nend",
"def fetch_url(https,req)\n res = https.request(req)\n case res\n when Net::HTTPSuccess\n answer=JSON.parse(res.body)\n return answer\n else\n puts \"HTTP Error #{res.code} calling #{https}\"\n res.error!\n end\nend",
"def http_request(url_s, method, body = nil, headers = {}, www_authenticate = nil, redirect_limit = 5)\n cachekey = url_s.to_s\n\n cached_value = @cache[cachekey]\n if cached_value\n sock = Net::BufferedIO.new(StringIO.new(cached_value))\n info = Net::HTTPResponse.read_new(sock)\n info.reading_body(sock, true) {}\n\n if method == Net::HTTP::Put and info.key? 'etag' and not headers['If-Match']\n headers['If-Match'] = info['etag']\n end\n end\n\n if cached_value and not [Net::HTTP::Get, Net::HTTP::Head].member? method\n @cache.delete(cachekey)\n elsif cached_value\n entry_disposition = _entry_disposition(info, headers)\n\n if entry_disposition == :FRESH\n info.extend Atom::HTTPResponse\n\n return info\n elsif entry_disposition == :STALE\n if info.key? 'etag' and not headers['If-None-Match']\n headers['If-None-Match'] = info['etag']\n end\n if info.key? 'last-modified' and not headers['Last-Modified']\n headers['If-Modified-Since'] = info['last-modified']\n end\n end\n end\n\n req, url = new_request(url_s, method, headers)\n\n # two reasons to authenticate;\n if @always_auth\n self.send(\"#{@always_auth}_authenticate\", req, url)\n elsif www_authenticate\n dispatch_authorization www_authenticate, req, url\n end\n\n http_obj = Net::HTTP.new(url.host, url.port)\n http_obj.use_ssl = true if url.scheme == \"https\"\n\n res = http_obj.start do |h|\n h.request(req, body)\n end\n\n # a bit of added convenience\n res.extend Atom::HTTPResponse\n\n case res\n when Net::HTTPUnauthorized\n if @always_auth or www_authenticate or not res[\"WWW-Authenticate\"] # XXX and not stale (Digest only)\n # we've tried the credentials you gave us once\n # and failed, or the server gave us no way to fix it\n raise Unauthorized, \"Your authorization was rejected\"\n else\n # once more, with authentication\n res = http_request(url_s, method, body, headers, res[\"WWW-Authenticate\"])\n\n if res.kind_of? Net::HTTPUnauthorized\n raise Unauthorized, \"Your authorization was rejected\"\n end\n end\n when Net::HTTPRedirection\n if res.code == \"304\" and method == Net::HTTP::Get\n res.end2end_headers.each { |k| info[k] = res[k] }\n\n res = info\n\n res[\"Content-Length\"] = res.body.length\n\n res.extend Atom::HTTPResponse\n\n _updateCache(headers, res, @cache, cachekey)\n elsif res[\"Location\"] and (allow_all_redirects or [Net::HTTP::Get, Net::HTTP::Head].member? method)\n raise HTTPException, \"Too many redirects\" if redirect_limit.zero?\n\n res = http_request res[\"Location\"], method, body, headers, nil, (redirect_limit - 1)\n end\n when Net::HTTPOK, Net::HTTPNonAuthoritativeInformation\n unless res.key? 'Content-Location'\n res['Content-Location'] = url_s\n end\n _updateCache(headers, res, @cache, cachekey)\n end\n\n res\n end",
"def fetch(uri, method = T.unsafe(nil), headers = T.unsafe(nil), params = T.unsafe(nil), referer = T.unsafe(nil), redirects = T.unsafe(nil)); end",
"def create_http_connection(uri); end",
"def http_request(url, options = {})\n\t\t\treq = Net::HTTP::Get.new(url)\n\t\t\treq[\"user-agent\"] = \"Mozilla/5.0 Gecko/20070219 Firefox/2.0.0.2\" # ensure returns XML\n\t\t\treq[\"cookie\"] = \"cookieMenu=all; cookieLangId=\" + options[:lang] + \"; cookies=true;\"\n\t\t\t\n\t\t\treq[\"cookie\"] += options[:cookie] if options[:cookie]\n\t\t\t\n\t\t\turi = URI.parse(url)\n\t\t\t\n\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\n\t\t\tif (options[:secure])\n\t\t\t\tputs \"Secure authentication\" if options[:debug]\n\n\t\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\t\t\thttp.use_ssl = true\n\t\t\tend\n\t\t \n\t\t\t\n\t\t\tbegin\n\t\t\t http.start do\n\t\t\t res = http.request req\n\t\t\t\t\t# response = res.body\n\t\t\t\t\t\n\t\t\t\t\ttries = 0\n\t\t\t\t\tresponse = case res\n\t\t\t\t\t\twhen Net::HTTPSuccess, Net::HTTPRedirection\n\t\t\t\t\t\t\tres.body\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttries += 1\n\t\t\t\t\t\t\tif tries > @@max_connection_tries\n\t\t\t\t\t\t\t\traise Wowr::Exceptions::NetworkTimeout.new('Timed out')\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tretry\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t end\n\t\t\trescue \n\t\t\t\traise Wowr::Exceptions::ServerDoesNotExist.new('Specified server at ' + url + ' does not exist.');\n\t\t\tend\n\t\tend",
"def make_get_request(uri)\n response = Net::HTTP.get_response(uri)\n response.is_a?(Net::HTTPSuccess) ? response.body : nil\nend",
"def make_http_request\n Net::HTTP.get_response('localhost', '/ping', 3000).body\nend",
"def http_get_direct(url)\n log(\"http get : #{url}\") if $opt[\"debug\"]\n begin\n html = Net::HTTP.get_response(URI.parse(url)).body\n # XXX must fix the rescue its not working\n rescue => err\n log(\"Error: #{err}\")\n exit 2\n end\n html\nend",
"def getHTTP(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == 'https'\n request = Net::HTTP::Get.new(uri.request_uri)\n http.request(request)\nend",
"def ident_http_request(method, uri_string, credentials=nil, headers={}, data=nil, limit = 3, open_timeout=15, read_timeout=15)\n\n response = nil\n begin\n\n # set user agent\n user_agent = \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36\"\n headers[\"User-Agent\"] = user_agent\n\n attempts=0\n max_attempts=limit\n found = false\n timeout = false\n\n uri = URI.parse uri_string\n\n # keep track of redirects\n response_urls = [\"#{uri}\"]\n\n unless uri\n _log error \"Unable to parse URI from: #{uri_string}\"\n return\n end\n\n until( found || attempts >= max_attempts)\n @task_result.logger.log \"Getting #{uri}, attempt #{attempts}\" if @task_result\n attempts+=1\n\n if $global_config\n if $global_config.config[\"http_proxy\"]\n proxy_config = $global_config.config[\"http_proxy\"]\n proxy_addr = $global_config.config[\"http_proxy\"][\"host\"]\n proxy_port = $global_config.config[\"http_proxy\"][\"port\"]\n proxy_user = $global_config.config[\"http_proxy\"][\"user\"]\n proxy_pass = $global_config.config[\"http_proxy\"][\"pass\"]\n end\n end\n\n # set options\n opts = {}\n if uri.instance_of? URI::HTTPS\n opts[:use_ssl] = true\n opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n http = Net::HTTP.start(uri.host, uri.port, proxy_addr, proxy_port, opts)\n http.open_timeout = open_timeout\n http.read_timeout = read_timeout\n\n path = \"#{uri.path}\"\n path = \"/\" if path==\"\"\n\n # add in the query parameters\n if uri.query\n path += \"?#{uri.query}\"\n end\n\n ### ALLOW DIFFERENT VERBS HERE\n if method == :get\n request = Net::HTTP::Get.new(uri)\n elsif method == :post\n # see: https://coderwall.com/p/c-mu-a/http-posts-in-ruby\n request = Net::HTTP::Post.new(uri)\n request.body = data\n elsif method == :head\n request = Net::HTTP::Head.new(uri)\n elsif method == :propfind\n request = Net::HTTP::Propfind.new(uri.request_uri)\n request.body = \"Here's the body.\" # Set your body (data)\n request[\"Depth\"] = \"1\" # Set your headers: one header per line.\n elsif method == :options\n request = Net::HTTP::Options.new(uri.request_uri)\n elsif method == :trace\n request = Net::HTTP::Trace.new(uri.request_uri)\n request.body = \"blah blah\"\n end\n ### END VERBS\n\n # set the headers\n headers.each do |k,v|\n request[k] = v\n end\n\n # handle credentials\n if credentials\n request.basic_auth(credentials[:username],credentials[:password])\n end\n\n # USE THIS TO PRINT HTTP REQUEST\n #request.each_header{|h| _log_debug \"#{h}: #{request[h]}\" }\n # END USE THIS TO PRINT HTTP REQUEST\n\n # get the response\n response = http.request(request)\n\n if response.code==\"200\"\n break\n end\n\n if (response.header['location']!=nil)\n newuri=URI.parse(response.header['location'])\n if(newuri.relative?)\n newuri=URI.parse(\"#{uri}#{response.header['location']}\")\n end\n response_urls << ident_encode(newuri.to_s)\n uri=newuri\n\n else\n found=true #resp was 404, etc\n end #end if location\n end #until\n\n final_url = uri\n\n ### TODO - create a global $debug config option\n \n rescue ArgumentError => e\n #puts \"Unable to connect #{uri}: #{e}\"\n rescue Net::OpenTimeout => e\n #puts \"Unable to connect #{uri}: #{e}\"\n timeout = true\n rescue Net::ReadTimeout => e\n #puts \"Unable to connect #{uri}: #{e}\"\n timeout = true\n rescue Errno::ENETDOWN => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Errno::ETIMEDOUT => e\n #puts \"Unable to connect #{uri}: #{e}\" \n timeout = true\n rescue Errno::EINVAL => e\n #puts \"Unable to connect #{uri}: #{e}\"\n rescue Errno::ENETUNREACH => e\n #puts \"Unable to connect #{uri}: #{e}\"\n rescue Errno::EHOSTUNREACH => e\n #puts \"Unable to connect #{uri}: #{e}\"\n rescue URI::InvalidURIError => e\n #\n # XXX - This is an issue. We should catch this and ensure it's not\n # due to an underscore / other acceptable character in the URI\n # http://stackoverflow.com/questions/5208851/is-there-a-workaround-to-open-urls-containing-underscores-in-ruby\n #\n #puts \"Unable to connect #{uri}: #{e}\"\n rescue OpenSSL::SSL::SSLError => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Errno::ECONNREFUSED => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Errno::ECONNRESET => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Net::HTTPBadResponse => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Zlib::BufError => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Zlib::DataError => e # \"incorrect header check - may be specific to ruby 2.0\"\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue EOFError => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue SocketError => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Encoding::InvalidByteSequenceError => e\n #puts \"Encoding issue #{uri}: #{e}\" \n rescue Encoding::UndefinedConversionError => e\n #puts \"Encoding issue #{uri}: #{e}\" \n end\n\n # generate our output\n out = {\n :timeout => timeout,\n :start_url => uri_string,\n :final_url => final_url.to_s,\n :request_type => :ruby,\n :request_method => method,\n :request_credentials => credentials,\n :request_headers => headers,\n :request_data => data,\n :request_attempts_limit => limit,\n :request_attempts_used => attempts,\n :request_user_agent => user_agent,\n :request_proxy => proxy_config,\n :response_urls => response_urls,\n :response_object => response\n }\n\n # verify we have a response before adding these\n if response\n out[:response_headers] = response.each_header.map{|x| ident_encode \"#{x}: #{response[x]}\" }\n out[:response_body] = ident_encode(response.body)\n end\n\n out\n end",
"def http_peek(url)\n @log.debug \"http_peek... #{url}\"\n uri = Addressable::URI.parse url\n if uri.port\n http = Net::HTTP.new(uri.host, uri.port)\n else\n http = Net::HTTP.new(uri.host,\n Addressable::URI.port_mapping[uri.scheme])\n end\n http.open_timeout = 5\n\n # Unfortunately the net/http(s) API can't seem to do this for us,\n # even if we require net/https from the beginning (ruby 1.8)\n if uri.scheme == \"https\"\n require 'net/https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n if bot.config[\"log_level\"] == \"debug\"\n http.set_debug_output $stderr\n end\n\n begin\n res = http.start { |http|\n @log.debug \"http.start, http object: \" + \n PP.singleline_pp(http, '')\n req = Net::HTTP::Get.new(uri.request_uri,\n { 'User-Agent' => 'campfire-bot/20110709 ' +\n '(x86_64-unknown-linux-gnu) ruby-stdlib-net/1.8.7' })\n\n if uri.user != nil && uri.user != \"\" &&\n uri.password != nil && uri.password != \"\"\n req.basic_auth uri.user, uri.password\n end\n\n response = http.request req\n @log.debug \"http.start, response: \" + \n PP.singleline_pp(response, '')\n response\n }\n\n rescue Exception => e\n @log.error \"Exception... #{e.class.name}, #{e.message}\"\n end\n\n case res\n when Net::HTTPRedirection\n uri.merge({ :host => res.header['Location'] })\n @log.debug \"following HTTPRedirection... res: #{res}, uri: \" +\n \"#{uri.omit(:user, :password)}, header: #{res.header['Location']}\"\n [res.header['Location'], res]\n\n else # Net::HTTPSuccess or error\n @log.debug \"proper non-redirected location... res: #{res}, uri: #{uri.omit(:user, :password)}\"\n [url, res]\n end\n end",
"def http_request(url, options = {})\n\t\t\treq = Net::HTTP::Get.new(url)\n\t\t\treq[\"user-agent\"] = @@user_agent # ensure returns XML\n\t\t\treq[\"cookie\"] = \"cookieMenu=all; cookieLangId=\" + options[:lang] + \"; cookies=true;\"\n\t\t\t\n\t\t\treq[\"cookie\"] += options[:cookie] if options[:cookie]\n\n\t\t\turi = URI.parse(URI.escape(url))\n\t\t\t\n\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\n\t\t\tif (options[:secure])\n\t\t\t\tputs \"Secure authentication\" if options[:debug]\n\n\t\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\t\t\thttp.use_ssl = true\n\t\t\tend\n\t\t \n\t\t\t\n\t\t\tbegin\n\t\t\t\ttries = 0\n\t\t\t http.start do\n\t\t\t\t puts \"Get URL \"+ url if options[:debug]\n\t\t\t res = http.request req\n\t\t\t\t\t# response = res.body\n\t\t\t\t\t\n\t\t\t\t\t# FIXME WoW Armory rate limiter. Simple version\n\t\t\t\t\t# Needs to work across instances and not sleep for 1.5 if the\n\t\t\t\t\t# request took more than 1.5\n\t\t\t\t\t# just need a 1.5 second wait until the start of the next request\n \n if options[:rate_limit]\n\t\t\t\t\t puts \"Sleeping for 1.5 seconds\" if options[:debug]\n \t\t\t\t\tsleep 1.5\n\t\t\t\t\tend\n\n\t\t\t\t\tresponse = case res\n\t\t\t\t\t\twhen Net::HTTPSuccess, Net::HTTPRedirection\n\t\t\t\t\t\t\tres.body\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttries += 1\n\t\t\t\t\t\t\tif tries > @@max_connection_tries\n\t\t\t\t\t\t\t\traise Wowr::Exceptions::NetworkTimeout.new('Timed out')\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tredo\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t end\n\t\t\trescue Timeout::Error => e\n raise Wowr::Exceptions::NetworkTimeout.new('Timed out - Timeout::Error Exception')\n\t\t\trescue SocketError, Net::HTTPExceptions => e\n\t\t\t\traise Wowr::Exceptions::ServerDoesNotExist.new('Specified server at ' + url + ' does not exist.')\n\t\t\tend\n\t\tend",
"def getHTTPHdrs(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == 'https'\n request = Net::HTTP::Head.new(uri.request_uri)\n http.request(request)\nend",
"def request(uri, method, cookies)\n #puts \"Current URI: #{uri}\"\n uri = URI(uri)\n http = nil\n if USE_PROXY\n \t http = Net::HTTP.new(uri.host, uri.port, PROXY_HOST, PROXY_PORT)\n else\n \t http = Net::HTTP.new(uri.host, uri.port)\n end\n\n http.read_timeout = 4 # 4 seconds read timeout\n http.open_timeout = 4\n if uri.scheme == \"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n request = nil\n if method == \"OPTIONS\"\n request = Net::HTTP::Options.new(uri.request_uri, cookies)\n else # otherwise GET\n request = Net::HTTP::Get.new(uri.request_uri, cookies)\n end\n \n begin\n\t response = http.request(request)\n\n\t case response\n\t when Net::HTTPSuccess\n\t then \n\t return response\n\t when Net::HTTPRedirection # if you get a 3xx response\n\t then \n\t # handles stupid implementations like Location: /Login\n\t location = response['Location']\n\t #puts \"Location redirect to: #{location}\"\n\t if response['Set-cookie'] != nil && !@current_cookies.include?(response['Set-cookie'])\n\t \t@current_cookies += response['Set-cookie']\n\t end\n\t cookies = {'Cookie'=> @current_cookies}\n\n\t if location.start_with?(\"/\")\n\t \tlocation = \"#{uri.scheme}://#{uri.host}:#{uri.port}#{location}\"\n\t \t#puts \"Final location: #{location}\"\n\t end\n\t return request(location, \"GET\", cookies)\n\t else\n\t return [nil, \"Response error\"]\n\t end\n # ctaching different exceptions in case we need to do something on it in the future\n rescue SocketError => se # domain not resolved\n \treturn [nil, \"Domain not resolved\"]\n rescue Timeout::Error => timeout # timeout in open/read\n \treturn [nil, \"Timeout in open or read\"]\n rescue Errno::ECONNREFUSED => refused # connection refused\n \treturn [nil, \"Connection refused\"]\n rescue Exception => e\n \t#puts e.message\n \t#puts e.backtrace\n \treturn [nil, e.message]\n end\nend",
"def form_request(client)\n # read and tokenize the first line\n # we want to parse this line to retrieve the port, hostname, version, and filename\n first_line_tokens = client.gets.split\n\n # read the headers and store them in a hash\n header_hash = Hash.new()\n \n while next_line = client.gets do\n break if next_line.eql?(\"\\r\\n\") \n # we expect this line to be of the form (header): (header value)\n first_colon_index = next_line.index(\":\")\n unless first_colon_index.nil?\n header_hash[next_line[0..first_colon_index-1]] = next_line[first_colon_index+1..next_line.length - 1]\n end\n end\n\n #populate our metadata with temporary values\n port = 80\n version = \"\"\n filename = \"/\"\n request_type = first_line_tokens[0]\n \n if (!first_line_tokens[0].eql?(\"GET\") && !first_line_tokens[0].eql?(\"POST\"))\n # then this is not a GET or POST request, and we return nil\n return nil\n else\n # then this is a GET or POST request, and we will parse out the\n # port, hostname, version, and filename associated with this request\n\n # the rest of our attributes can be parsed from the second token, and\n # the token should be of the form: http://(hostname)(:port)/(filename)\n # or of the form: /(filename)\n url = first_line_tokens[1]\n # ignore the prefix\n url = url.split(\"//\")[1]\n\n # now, extract the hostname and port\n first_slash_index = url.index(\"/\")\n first_colon_index = url.index(\":\")\n if first_colon_index.nil? || first_colon_index>first_slash_index\n # then the port was not specified. Default to 80\n port = 80\n # then the hostname is the substring up to the first slash, or it\n # is instead specified in a header\n if first_slash_index > 0\n header_hash[\"Host\"] = url[0..first_slash_index-1]\n end\n else first_colon_index<first_slash_index\n # then the port is specified\n port = url[first_colon_index+1..first_slash_index-1]\n header_hash[\"Host\"] = url[0..first_colon_index-1]\n end\n \n # extract the filename from the url\n filename = url[first_slash_index..url.length-1]\n end\n return Request.new(header_hash[\"Host\"], port, filename, url, header_hash, request_type)\nend",
"def ensure_http \n url.ensure_http\n end",
"def get_response(uri, req)\n Net::HTTP.start(uri.hostname, uri.port){|http| http.request(req) }\nend",
"def request(url, options)\n\t\tmy_url = URI.parse(URI.encode(url))\n\n\t\tbegin\n\t\t\tmy_url = URI.parse(url)\n\t\trescue URI::InvalidURIError\n\t\t\tmy_url = URI.parse(URI.encode(url))\n\t\tend\n\nstart_time = Time.now\n\t\tproxy_host = 'ubio.cnio.es'\n\t\tproxy_port = 3128\n\t\treq = Net::HTTP::Get.new(my_url.request_uri)\n#\t\tres = Net::HTTP.start(my_url.host, my_url.port, proxy_host, proxy_port) { |http|\n\t\tres = Net::HTTP.start(my_url.host, my_url.port) { |http|\n\t\t\thttp.request(req)\n\t\t}\n\n\n\n\t\t#http_session = proxy.new(my_url.host, my_url.port)\n\t\t#\n\t\t#res = nil\n\t\t#proxy.new(my_url.host, my_url.port).start { |http|\n\t\t#Net::HTTP::Proxy(proxy_host, proxy_port).start(my_url.host) { |http|\n\t\t#\treq = Net::HTTP::Get.new(my_url.request_uri)\n\t\t#\tres, data = http.request(req)\n\t\t#\n\t\t#\tputs \"shitting data: #{data}\\n\"\n\t\t#\tputs \"res.code: #{res.code}\\n\"\n\t\t#}\n\t\t#\n\t\t#\n\t\t#res = Net::HTTP.start(my_url.host, my_url.port) { |http|\n\t\t#\treq = Net::HTTP::Get.new(my_url.request_uri)\n\t\t#\thttp.request(req)\n\t\t#}\n\n\n#end_time = Time.now\n#elapsed_time = (end_time - start_time) * 1000\n#puts \"***=> Time elapsed for #{url}: #{elapsed_time} ms\\n\"\n#\n#puts \"response code: #{res ? res.code: 'res not available here'}\"\n\n\t\tres\n\tend",
"def run_request(method, url, body, headers); end",
"def http=(_arg0); end",
"def http_get(uri_string, headers={}, limit = 10, open_timeout=15, read_timeout=15)\n\n #@task_result.logger.log \"http_get Connecting to #{uri}\" if @task_result\n response = nil\n begin\n\n attempts=0\n max_attempts=10\n user_agent=\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36\"\n found = false\n\n uri = URI.parse uri_string\n\n until( found || attempts >= max_attempts)\n #@task_result.logger.log \"Getting #{uri}, attempt #{attempts}\" if @task_result\n attempts+=1\n\n http = Net::HTTP.new(uri.host,uri.port)\n http.read_timeout = 10\n http.open_timeout = 10\n\n path = uri.path\n path = \"/\" if path==\"\"\n\n #request = Net::HTTP::Get.new(path,{'User-Agent'=>user_agent})\n if uri.instance_of? URI::HTTPS\n http.use_ssl=true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n response = http.get(path)\n\n if response.code==\"200\"\n break\n end\n\n if (response.header['location']!=nil)\n newuri=URI.parse(response.header['location'])\n if(newuri.relative?)\n #@task_result.logger.log \"url was relative\" if @task_result\n newuri=uri+response.header['location']\n end\n uri=newuri\n\n else\n found=true #resp was 404, etc\n end #end if location\n end #until\n\n ### TODO - this code may be be called outside the context of a task,\n ### meaning @task_result is not available to it. Below, we check to\n ### make sure that it exists before attempting to log anything,\n ### but there may be a cleaner way to do this (hopefully?). Maybe a\n ### global logger or logging queue?\n ###\n #rescue TypeError\n # # https://github.com/jaimeiniesta/metainspector/issues/125\n # @task_result.logger.log_error \"TypeError - unknown failure\" if @task_result\n rescue Net::OpenTimeout => e\n @task_result.logger.log_error \"Timeout : #{e}\" if @task_result\n rescue Net::ReadTimeout => e\n @task_result.logger.log_error \"Timeout : #{e}\" if @task_result\n rescue URI::InvalidURIError => e\n #\n # XXX - This is an issue. We should catch this and ensure it's not\n # due to an underscore / other acceptable character in the URI\n # http://stackoverflow.com/questions/5208851/is-there-a-workaround-to-open-urls-containing-underscores-in-ruby\n #\n @task_result.logger.log_error \"Unable to request URI: #{uri} #{e}\" if @task_result\n rescue OpenSSL::SSL::SSLError => e\n @task_result.logger.log_error \"SSL connect error : #{e}\" if @task_result\n rescue Errno::ECONNREFUSED => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n rescue Errno::ECONNRESET => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n rescue Net::HTTPBadResponse => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n rescue Zlib::BufError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n rescue Zlib::DataError => e # \"incorrect header check - may be specific to ruby 2.0\"\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n rescue EOFError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n rescue SocketError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n #rescue SystemCallError => e\n # @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n #rescue ArgumentError => e\n # @task_result.logger.log_error \"Argument Error: #{e}\" if @task_result\n rescue Encoding::InvalidByteSequenceError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n rescue Encoding::UndefinedConversionError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n end\n\n response\n end",
"def getfile(host, path)\n puts \"getting https://#{host}#{path}\"\n https = Net::HTTP.new(host, 443)\n https.use_ssl = true\n https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n https.start { |w| w.get2(path).body }\nend",
"def http_get(url)\n require \"open-uri\"\n URI.parse(url).read\n end",
"def parseHTTPRequest(request)\n httpRequestRE = /(GET|HEAD) (?:http:\\/\\/[^\\/]+)?(\\/?\\S+) HTTP\\/1.[10]\\r\\n.*Host: ?([^:\\r]+)(?::(\\d*))?\\r\\n.*/m # note optional (in my opinion) space after Host: , and optional port. HTTP/1.0 for wget, which is odd\n answers = httpRequestRE.match(request)\n file = host = port = start = endy = nil\n if answers \n requestType = answers[1]\n file = answers[2]\n host = answers[3]\n port = (answers[4] || '80').to_i\n start = nil\n endy = nil\n end\n \n httpRequestRE = /.*\\r\\nRange: bytes=(\\d+)-(\\d+)?/\n answers = httpRequestRE.match(request)\n if answers # ltodo test case straight download from a peer of size 100, block size 33\n start = answers[1].to_i\n if answers[2] # if it's nil, then don't do \".to_i\" on it. heh.\n endy = answers[2].to_i\n assert endy >= start # note: can be equal, which means 'serve one byte'\n else\n endy = nil\n end\n end\n fullUrl = \"http://#{host}:#{port}#{file}\" \n return file, host, port, start, endy, requestType, fullUrl\n end",
"def setup_http_request(obj, cookie=nil, args={})\n if args.has_key?(:url) and args[:url] != nil\n if args[:url].scan(/%[s|d]/).length > 0\n if args[:url].scan(/%[s|d]/).length != args[:url_arg].length\n ALERT.call(caller_locations, __callee__, \"URL contains %d '%%s' or '%%d' argument... Fix your code\" % args[:url].scan(/%[s|d]/).length)\n exit 2\n end\n req = obj[:method].new(args[:url] % args[:url_arg])\n else\n req = obj[:method].new(args[:url])\n end\n else\n if args.has_key?(:url_arg)\n if obj[:url].scan(/%[s|d]/).length > 0\n if obj[:url].scan(/%[s|d]/).length != args[:url_arg].length\n ALERT.call(caller_locations, __callee__, \"URL contains %d '%%s' or '%%d' argument... Fix your code\" % obj[:url].scan(/%[s|d]/).length)\n exit 2\n end\n req = obj[:method].new(obj[:url] % args[:url_arg])\n else\n req = obj[:method].new(obj[:url])\n end\n else\n req = obj[:method].new(obj[:url])\n end\n end\n req[\"Host\"] = \"www.blablacar.fr\"\n req[\"origin\"] = \"https://www.blablacar.fr\"\n req[\"User-Agent\"] = \"Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0\"\n req[\"Accept\"] = \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\"\n if obj.has_key?(:referer)\n req['Referer'] = obj[:referer]\n else\n req[\"Referer\"] = \"https://www.blablacar.fr/dashboard\"\n end\n req.add_field(\"Connection\", \"keep-alive\")\n if cookie\n req.add_field(\"Cookie\", cookie)\n end\n if obj.has_key?(:header)\n obj[:header].each_slice(2).map{|h|\n req.add_field(h[0], h[1])\n }\n end\n if obj.has_key?(:data)\n if obj[:data].scan(/%[s|d]/).length > 0\n if obj[:data].scan(/%[s|d]/).length != args[:arg].length\n ALERT.call(caller_locations, __callee__, \"Body request contains %d '%%s' or '%%d' argument... Fix your code\" % obj[:data].scan(/%[s|d]/).length)\n exit 2\n else\n req.body = obj[:data] % args[:arg]\n end\n else\n req.body = obj[:data]\n end\n req['Content-Length'] = req.body.length\n end\n req\nend",
"def get(url)\n uri = URI(url)\n Net::HTTP.get(uri)\nend",
"def checkHTTP(base)\n # We don't check the pattern on the form for two reasons:\n # - not all browsers support it\n # - allows the input to be more flexible\n\n # Fix up the URL\n base.strip!\n base += '/' unless base.end_with? '/'\n base = 'http://' + base unless base.start_with? 'http'\n # Now check the syntax:\n\n I \"Checking #{base} ...\"\n\n unless URLMATCH.match(base)\n F \"Invalid URL syntax: #{base}\"\n return\n end\n\n setup\n\n response = getHTTPHdrs(base)\n server = response['server']\n if server =~ /Apache/\n I \"Server: #{server}\"\n else\n W \"Server: '#{server}' - expected 'Apache' in server response\"\n end\n\n # Check the mirror time (and that zzz/ is readable)\n time = check_page(base, 'zzz/time.txt', severity = :F)\n if time\n match = /^(\\d+) \\S+$/.match(time)\n if match\n now = Time.now.to_i\n stamp = match[1].to_i\n age = (now - stamp)/60 # minutes\n if age > 60*24\n W \"Mirror is over 1 day old: #{age} minutes\"\n else\n I \"Mirror is less than 1 day old: #{age} minutes\"\n end\n else\n F \"Invalid time.txt contents: #{time}\"\n end\n else\n return # cannot process further (already recorded the error\n end\n\n # check the main body\n body = check_page(base, '')\n checkHdrFtr(base, body)\n if %r{<(img|IMG) (src|SRC)=\"/icons/}.match(body)\n I \"Index page has icons as expected\"\n else\n W \"Missing or unexpected img icon tags\"\n end\n checkIndex(body, :tlps)\n\n ibody = check_page(base, 'incubator/')\n checkHdrFtr(base+'incubator/', ibody)\n checkIndex(ibody, :podlings)\n\n check_page(base, 'harmony/', :E, expectedStatus=\"404\")\n\n zbody = check_page(base, HTTPDIR)\n# Not sure this is useful on its own anymore\n# It was originally used to detect sites with advertising wrappers,\n# but most recent examples have been tables around directory listings\n# which is obviously OK as it does not affect the user experience.\n# if %r{<table}i.match(zbody)\n# W \"#{HTTPDIR} - TABLE detected\"\n# else\n# I \"#{HTTPDIR} - No TABLE detected, OK\"\n# end\n checkHdrFtr(base+HTTPDIR, zbody)\n if HDRMATCH.match(zbody)\n I \"Index page for #{HTTPDIR} contains the expected header text\"\n else\n W \"Index page for #{HTTPDIR} does not contain the expected header text\"\n end\n if FTRMATCH.match(zbody)\n I \"Index page for #{HTTPDIR} contains the expected footer text\"\n else\n W \"Index page for #{HTTPDIR} does not contain the expected footer text\"\n end\n\n check_page(base,HTTP404,:E, expectedStatus=\"404\")\n\n # Check that archives don't have Content-Encoding\n MIRRORTEST_FILES.each do |file|\n check_CT(base, MIRRORTEST + file)\n end\n check_redirect(base, 'zzz/mirror-tests/redirect-test/xyz', 'http://www.apache.org/')\nend",
"def url_tester(method,schema,base_domain,page,query,expected_code,timeout,headers,https_verify,logger)\n\n uri = URI.join(\"#{schema}://#{base_domain}\",page)\n http = Net::HTTP.new(uri.host, uri.port)\n if schema == \"https\"\n http.use_ssl = true\n http.verify_mode = https_verify ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE\n end\n http.open_timeout = timeout\n\n # Catch errors and set http status codes manually\n begin\n request = Net::HTTP::Get.new(uri.request_uri)\n if !headers.empty?\n headers.each { |header|\n header_array = header.split(':', 2)\n logger.debug_message \"header_array: #{header_array}\"\n request.initialize_http_header({header_array[0] => header_array[1]})\n }\n end\n start_time = Time.now\n response = http.request(request)\n end_time = Time.now\n response_time = end_time - start_time\n return uri.to_s, response.code.to_i, response_time \n # Catch time outs and set code to HTTPGatewayTimeOut: 504.\n rescue Net::OpenTimeout\n return uri.to_s, 504\n end\nend",
"def get(url); end",
"def get (dir) #DIR is path to RES\r\n\tbegin\r\n\t\taddress=$server+dir\r\n\t\turi = URI.parse(address)\r\n\t\tdebugging \"Get URI: #{uri}\"\r\n\t\trequest = Net::HTTP.get_response(uri)\r\n\t\tdebugging \"Response #{request}\"\t\r\n\t\tbody=request.body\r\n\t\tdebugging \"Body: #{body}\"\t\r\n\t\tbody=JSON.parse (body)\r\n\t\tcode=request.code\r\n\t\tdebugging \"Response Code: #{code}\"\r\n\t\tresponse={'body'=>body,'code'=>code,'exception'=>false}\r\n\t\tdebugging \"Response content: #{response}\"\r\n\t\treturn response\r\n\trescue Exception =>msg\r\n\t\tresponse={'body'=>msg,'code'=>401, 'exception' =>true}\r\n\t\tdebugging \"Response content: #{response}\"\r\n\t\treturn response\r\n\tend\r\n\r\nend",
"def get(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n response = http.get(\"#{uri.path}?auto\")\n\n unless response.code == \"200\"\n puts \"Failed to retrieve #{url}: #{response.code}\"\n exit 3\n end\n\n response.body\nend",
"def http_response \n url = @options['url'] || @options[:url]\n\n uri = URI.parse(url)\n\n response = nil\n retry_url_trailing_slash = true\n retry_url_execution_expired = true\n begin\n Net::HTTP.start(uri.host) {|http|\n http.open_timeout = TIMEOUT_LENGTH\n req = Net::HTTP::Get.new((uri.path != '' ? uri.path : '/' ) + (uri.query ? ('?' + uri.query) : ''))\n if uri.user && uri.password\n req.basic_auth uri.user, uri.password\n end\n response = http.request(req)\n }\n rescue Exception => e\n # forgot the trailing slash...add and retry\n if e.message == \"HTTP request path is empty\" and retry_url_trailing_slash\n url += '/'\n uri = URI.parse(url)\n h = Net::HTTP.new(uri.host)\n retry_url_trailing_slash = false\n retry\n elsif e.message =~ /execution expired/ and retry_url_execution_expired\n retry_url_execution_expired = false\n retry\n else\n response = e.to_s\n end\n end\n \n return response\n end",
"def _new_http resource\n uri = ::URI.parse(resource.auth_uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.read_timeout = 3\n http.open_timeout = 3\n http\nend",
"def _new_http resource\n uri = ::URI.parse(resource.auth_uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.read_timeout = 3\n http.open_timeout = 3\n http\nend",
"def fetch_process(uri)\n case r = fetch(uri)\n when Net::HTTPSuccess\n process_result(r.body)\n else\n r.error!\n end\nend",
"def request(uri, *args)\nbegin\nresponse = open(uri, *args)\nrescue OpenURI::HTTPError => e\nresponse = e.io\nend\n\nputs \" Status code: #{response.status.inspect}\"\nputs \" Representation size: #{response.size}\"\nlast_modified = response.meta['last-modified']\netag = response.meta['etag']\nputs \" Last-modified: #{last_modified}\"\nputs = \" Etag: #{etag}\"\nreturn last_modified, etag\nend",
"def makeRequest(url,input)\n #GET\n if input.class == String\n begin\n rawData = Net::HTTP.get_response(URI.parse(url+input))\n if rawData.code == \"404\"\n data = nil\n else\n data = rawData.body\n end\n rescue\n puts \"Error: #{$!}\"\n end\n #POST\n else\n uri = URI.parse(url+\"/\")\n begin\n data = Net::HTTP.new(uri.host).post(uri.path,input.join(\",\")).body\n rescue\n puts \"Error: #{$!}\"\n end\n end\n return data\n end",
"def get_response( src )\n uri = URI.parse( src )\n\n # new code: honor proxy env variable HTTP_PROXY\n proxy = ENV['HTTP_PROXY']\n proxy = ENV['http_proxy'] if proxy.nil? # try possible lower/case env variable (for *nix systems) is this necessary??\n\n if proxy\n proxy = URI.parse( proxy )\n logger.debug \"using net http proxy: proxy.host=#{proxy.host}, proxy.port=#{proxy.port}\"\n if proxy.user && proxy.password\n logger.debug \" using credentials: proxy.user=#{proxy.user}, proxy.password=****\"\n else\n logger.debug \" using no credentials\"\n end\n else\n logger.debug \"using direct net http access; no proxy configured\"\n proxy = OpenStruct.new # all fields return nil (e.g. proxy.host, etc.)\n end\n\n http_proxy = Net::HTTP::Proxy( proxy.host, proxy.port, proxy.user, proxy.password )\n\n redirect_limit = 6\n response = nil\n cookie_jar = nil\n original_uri = uri\n retried_once = 0\n\n until false\n raise ArgumentError, 'HTTP redirect too deep' if redirect_limit == 0\n redirect_limit -= 1\n\n http = http_proxy.new( uri.host, uri.port )\n\n logger.debug \"GET #{uri.request_uri} uri=#{uri}, redirect_limit=#{redirect_limit}\"\n\n headers = { 'User-Agent' => \"fetcher gem v#{VERSION}\" }\n headers['Cookie'] = cookie_jar unless cookie_jar.nil?\n\n if use_cache?\n ## check for existing cache entry in cache store (lookup by uri)\n ## todo/fix: normalize uri!!!! - how?\n ## - remove query_string ?? fragement ?? why? why not??\n\n ## note: using uri.to_s should return full uri e.g. http://example.com/page.html\n\n\n cache_entry = cache[ uri.to_s ]\n if cache_entry\n logger.info \"found cache entry for >#{uri.to_s}<\"\n if cache_entry['etag']\n logger.info \"adding header If-None-Match (etag) >#{cache_entry['etag']}< for conditional GET\"\n headers['If-None-Match'] = cache_entry['etag']\n end\n if cache_entry['last-modified']\n logger.info \"adding header If-Modified-Since (last-modified) >#{cache_entry['last-modified']}< for conditional GET\"\n headers['If-Modified-Since'] = cache_entry['last-modified']\n end\n end\n end\n\n request = Net::HTTP::Get.new( uri.request_uri, headers )\n if uri.instance_of? URI::HTTPS\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n response = http.request( request )\n\n if response.code == '200'\n logger.debug \"#{response.code} #{response.message}\"\n logger.debug \" content_type: #{response.content_type}, content_length: #{response.content_length}\"\n break # will return response\n elsif( response.code == '304' ) # -- Not Modified - for conditional GETs (using etag,last-modified)\n logger.debug \"#{response.code} #{response.message}\"\n break # will return response\n elsif( response.code == '301' || response.code == '302' || response.code == '303' || response.code == '307' )\n # 301 = moved permanently\n # 302 = found\n # 303 = see other\n # 307 = temporary redirect\n logger.debug \"#{response.code} #{response.message} location=#{response.header['location']}\"\n newuri = URI.parse( response.header['location'] )\n if newuri.relative?\n logger.debug \"url relative; try to make it absolute\"\n newuri = uri + response.header['location']\n end\n\n cookie = response.get_fields('set-cookie')\n if cookie.respond_to?('each')\n cookies_array = Array.new\n cookie.each { | cookie |\n cookies_array.push(cookie.split('; ')[0])\n }\n cookie_jar = cookies_array.join('; ')\n end\n\n if (cookie_jar.to_s.strip.empty?) && ((newuri.host != original_uri.host) || (retried_once == 1))\n uri = newuri\n else\n logger.debug \"Detected redirection to original host. Trying the original request with cookie.\"\n uri = original_uri\n redirect_limit = 6\n retried_once = 1\n end\n\n logger.debug \"Set cookie: #{cookie_jar}\"\n else\n puts \"*** error - fetch HTTP - #{response.code} #{response.message}\"\n break # will return response\n end\n end\n\n response\n end",
"def create_http_request(http_method, path, *arguments)\n http_method = http_method.to_sym\n\n if [:post, :put, :patch].include?(http_method)\n data = arguments.shift\n end\n\n # if the base site contains a path, add it now\n uri = URI.parse(site)\n path = uri.path + path if uri.path && uri.path != '/'\n\n headers = arguments.first.is_a?(Hash) ? arguments.shift : {}\n\n case http_method\n when :post\n request = Net::HTTP::Post.new(path,headers)\n request[\"Content-Length\"] = '0' # Default to 0\n when :put\n request = Net::HTTP::Put.new(path,headers)\n request[\"Content-Length\"] = '0' # Default to 0\n when :patch\n request = Net::HTTP::Patch.new(path,headers)\n request[\"Content-Length\"] = '0' # Default to 0\n when :get\n request = Net::HTTP::Get.new(path,headers)\n when :delete\n request = Net::HTTP::Delete.new(path,headers)\n when :head\n request = Net::HTTP::Head.new(path,headers)\n else\n raise ArgumentError, \"Don't know how to handle http_method: :#{http_method.to_s}\"\n end\n\n if data.is_a?(Hash)\n request.body = OAuth::Helper.normalize(data)\n request.content_type = 'application/x-www-form-urlencoded'\n elsif data\n if data.respond_to?(:read)\n request.body_stream = data\n if data.respond_to?(:length)\n request[\"Content-Length\"] = data.length.to_s\n elsif data.respond_to?(:stat) && data.stat.respond_to?(:size)\n request[\"Content-Length\"] = data.stat.size.to_s\n else\n raise ArgumentError, \"Don't know how to send a body_stream that doesn't respond to .length or .stat.size\"\n end\n else\n request.body = data.to_s\n request[\"Content-Length\"] = request.body.length.to_s\n end\n end\n\n request\n end",
"def resolve_url url_array\n url_array.each do |url_str|\n url = URI.parse(url_str)\n req = Net::HTTP.new(url.host, url.port)\n\n begin\n Timeout.timeout(5) do\n res = req.request_head(url.path)\n\n if res.code == \"200\"\n return url_str\n end\n end\n rescue Timeout::Error\n puts \"URL #{url_str} did not respond in 5 seconds.\"\n next\n end\n end\n return \"\"\nend",
"def url_test\n response = HTTParty.get('http://www.baidu.com')\n res = Rack::Response.new\n res.write response.body\n res.finish\n end",
"def http( *args )\n p http_get( *args )\n end",
"def http_minor; end",
"def makeRequest(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(uri.request_uri)\n\n r = http.request(request)\n return r\nend",
"def http_fetch(url)\n uri = URI.parse url\n http = Net::HTTP.new(uri.host, uri.port)\n\n # Unfortunately the net/http(s) API can't seem to do this for us,\n # even if we require net/https from the beginning (ruby 1.8)\n if uri.scheme == \"https\"\n require 'net/https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n res = http.start { |http|\n req = Net::HTTP::Get.new uri.request_uri\n cred = netrc_credentials uri.host\n req.basic_auth *cred if cred\n http.request req\n }\n end",
"def try_request httpmethod, uri, stream, auth, options\n requesturl = uri.path\n requesturl = requesturl + \"?\" + uri.query unless uri.query.nil?\n request = RubyDav::get_request_class(httpmethod).new requesturl\n\n (%w(destination if_match if_none_match if_modified_since) +\n %w(if_unmodified_since)).each do |k|\n add_request_header request, options, k\n end\n\n add_request_header request, options, :overwrite do |v|\n v == false ? \"F\" : \"T\"\n end\n \n add_request_header request, options, :depth do |v|\n v == INFINITY ? 'infinity' : v.to_s\n end\n\n add_request_header request, options, :timeout do |v|\n v == INFINITY ? 'Infinite, Second-4100000000' : 'Second-' + v.to_s\n end\n\n add_request_header(request, options, :lock_token) { |v| \"<#{v}>\" }\n\n add_request_header(request, options, :if) do |v|\n strict_if = options[:strict_if] == false ? false : true\n\n if v.is_a? Hash\n v2 = {}\n v.each do |k, v|\n v2[fullurl(k)] = v\n end\n v = v2\n end\n \n IfHeader.if_header strict_if, v\n end\n\n add_request_header(request, options, :cookie) do |v|\n cookies = []\n v.each{|n,v| cookies << \"\"+n.to_s+\"=\"+v }\n cookies.join \",\"\n end\n\n add_request_header(request, options, :apply_to_redirect_ref) do |v|\n v ? \"T\" : \"F\"\n end\n\n add_request_header(request, options, :accept_encoding)\n\n add_request_header(request, options, :x_requested_with)\n\n unless stream.nil?\n add_request_header request, options, :content_type\n request.add_field('Expect', '100-continue')\n # request.add_field('Transfer-Encoding', 'chunked')\n stream.rewind if stream.respond_to?(:rewind)\n request.body_stream = stream\n request.add_field('Content-Length', stream.size)\n end\n \n request.add_field('Authorization', auth.authorization(request.method, requesturl)) unless auth.nil?\n\n options[:headers].each { |k, v| request[k] = v } if\n options.include? :headers\n\n http_response = @connection_pool.request(uri, request)\n\n @logger.debug { http_response.body }\n ResponseFactory.get(uri.path, http_response.code, http_response.to_hash,\n http_response.body, httpmethod)\n end",
"def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n req_options = req_options.merge(options)\n \n raise ConfigurationError.new \"No endpoint defined\" if !path || path.empty?\n raise ConfigurationError.new \"No hostname defined\" if !req_options[:base_uri] || req_options[:base_uri].empty?\n \n # prepare request\n req = HTTParty::Request.new http_method, path, req_options\n\n # Sanitized request for logs\n safe_req_options = strip_unsafe_params(http_method, req_options)\n req_to_output = HTTParty::Request.new http_method, path, safe_req_options\n req_for_airbrake = { :method => http_method, :path => path, :options => safe_req_options }\n\n begin\n response = req.perform\n rescue => ex\n raise CityGridExceptions::RequestError.new req_for_airbrake, ex\n ensure\n if CityGrid.print_curls? \n if defined?(Rails.logger)\n Rails.logger.info req_to_output.to_curl\n else\n puts req_to_output.to_curl\n end\n end\n end\n\n \n begin \n # catch unparsable responses (html etc)\n if !response.parsed_response.is_a?(Hash)\n #pp \"[gem] the response was unparsable (response was not a hash)\"\n raise CityGridExceptions::ResponseParseError.new req_for_airbrake, response\n # catch responses not in new response format\n elsif response[\"errors\"]\n #pp \"[gem] An error in the old response format was caught. Raising a general response error...\"\n raise CityGridExceptions::ResponseError.new req_for_airbrake, response[\"errors\"], response\n\n # Parse and handle new response codes \n elsif (response[\"response\"] && response[\"response\"][\"code\"] != \"SUCCESS\") && \n (response[\"response\"] && response[\"response\"][\"code\"] != 200) && \n (response[\"response\"] && response[\"response\"][\"code\"] != 400) \n error_code = response[\"response\"][\"code\"]\n #pp \"[gem] The response was contained in the first level of the response hash. Below:\"\n #pp response\n #pp \"found error code: #{error_code}\"\n #pp \"****************************************************************************\"\n raise CityGridExceptions.appropriate_error(error_code).new req_for_airbrake, response, response[\"response\"][\"message\"].to_s #+ \" \" + CityGridExceptions.print_superclasses(error_code)\n # if the response is a nested hash/nested hash containing arrays\n elsif response[\"totalNumEntries\"] && response[\"response\"].nil?\n #pp \"[gem] now parsing a response with multiple entries: #{response}\"\n error_code = parse_multiple_responses(response)\n #pp \"the error code that came back is #{error_code}\"\n if error_code.nil? || error_code == []\n #pp \"[gem] passing over this for now\"\n return CityGrid::API::Response.new response # pass over for now\n elsif error_code[0] == \"SUCCESS\" || error_code[0] == 200 || error_code[0] == 400\n return CityGrid::API::Response.new response\n else \n #pp \"[gem] we found an error and it was #{error_code[1]}\"\n raise CityGridExceptions.appropriate_error(error_code[0]).new req_for_airbrake, response, error_code[1].to_s + \" \"# + CityGridExceptions.print_superclasses(error_code[0])\n end\n else\n return CityGrid::API::Response.new response\n end\n rescue => ex\n pp \"The gem threw an error: #{ex}\"\n raise ex if CityGrid.raise_errors?\n end\n end",
"def build_request()\n @http = Net::HTTP.new(@uri.host, @uri.port)\n @http.use_ssl = true\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n end",
"def http_call( opts )\n # [review] - Don't use DEBUG inside Remote class but pull from calling method's class?\n # [review] - Not sure if this is the best/proper way to do things but it works...\n\n # Identify method entry\n debug_print \"#{ self.class } : #{ __method__ }\\n\"\n\n # Merge default options with those passed in by user to form complete opt list\n opts = HTTP_opts.merge(opts)\n\n\n # Check URL in hash and get URI from it, then set up HTTP connection\n if opts[:url] =~ /^#{URI::regexp}$/\n _uri = URI(opts[:url])\n else\n debug_print \"No URL specified in input opts, exiting HTTP call\\n\"\n return false\n end\n\n _http = Net::HTTP.new(_uri.host, _uri.port)\n\n # Print out verbose HTTP request if :verbose is set\n # For hardcore debugging when shit really doesn't work\n _http.set_debug_output $stderr if opts[:verbose] == true\n\n # If SSL is set in hash, set HTTP connection to use SSL\n _http.use_ssl = true if opts[:ssl] == true\n\n # Create request based on HTTP method\n # [review] - Not sure if to fail with no method or default to GET?\n case opts[:method].upcase\n when \"GET\"\n _req = Net::HTTP::Get.new(_uri.request_uri)\n\n when \"POST\"\n _req = Net::HTTP::Post.new(_uri.request_uri)\n\n else\n debug_print \"No method specified, cannot make HTTP request\\n\"\n return false\n end\n\n # Check for basic authentication key in hash\n if opts[:basic_auth].size == 2\n _req.basic_auth(opts[:basic_auth][0], opts[:basic_auth][1])\n end\n\n # Check for Authentication token key in hash to be used in header\n # I think this is pretty universal, but specifically works for GitHub\n # This is standard for OAuth I think...\n if opts[:auth]\n _req[\"Authorization\"] = \"token #{ opts[:auth] }\"\n end\n\n # But sometimes we need we need other headers\n # Set specific header (GitLab requires PRIVATE_TOKEN)\n opts[:headers].each do |header|\n _req[\"#{ header[:field] }\"] = header[:value]\n end\n\n\n # [review] - Add :data_format to use set_form_data vs json body?\n # For now, use Hash or Array, this is to differentiate between\n # putting post data in body vs putting it in the form\n\n # If a POST method, :data is present, and is a Hash, fill request body with data\n if opts[:method].upcase == \"POST\" && opts[:data] && opts[:data].is_a?(Hash)\n _req.body = opts[:data].to_json\n end\n\n # If a POST method, :data is present, and is an Array, use set_form_data\n if opts[:method].upcase == \"POST\" && opts[:data] && opts[:data].is_a?(Array)\n _req.set_form_data(opts[:data][0])\n end\n\n # Make HTTP request\n _resp = _http.request(_req)\n\n # Debug prints for status and message\n debug_print \"HTTP Response Code: #{ _resp.code }\\n\"\n debug_print \"HTTP Response Msg: #{ _resp.message }\\n\"\n\n # [fix] - Not sure if 401 is the only code that gives nonparseable body?\n # Figure out what other response codes are bad news for JSON.parse\n _json = _resp.code == \"401\" ? Hash.new : JSON.parse(_resp.body)\n debug_print \"JSON: \\n #{ _json }\\n\"\n\n # [review] - Returning hash of json + response the right thing to do?\n # return {:json => _json, :resp => _resp}\n return _json, _resp\n end",
"def send_request(req_type, host, port, url, fields_hash, up_file, ssl)\n res = false\n conn_start(host, port, ssl) do |http|\n request = Module.module_eval(\"Net::HTTP::#{req_type}\").new(url)\n fields_hash.each_pair{|n,v| request[n] = v} # Add user defined header fields\n request.content_length = up_file.lstat.size \n request.body_stream = up_file # For uploads using streaming\n begin\n response = http.request(request)\n \n rescue Exception => ex\n response = ex.to_s\n end\n\n # Handle auth errors and other errors!\n if !response.is_a?(Net::HTTPOK)\n #puts 'Failed to upload!'\n #log_request(request, response)\n else\n res = true\n end\n end\nend",
"def fetchURL(url)\n open(url) {|response| response.read}\nend",
"def open(url)\n Net::HTTP.get(URI.parse(url))\nend",
"def open(url)\n Net::HTTP.get(URI.parse(url))\nend",
"def initialize(url_str)\n $LOG.info \"Getting URL '#{url_str}'\"\n uri = URI.parse(url_str)\n unless VALID_SCHEMES.include?(uri.scheme)\n $LOG.fatal \"URL protocol is not one of #{VALID_SCHEMES.join(',')}\"\n exit 1\n end\n if proxy = ENV['HTTP_PROXY']\n prx_uri = URI.parse(proxy)\n prx_host = prx_uri.host\n prx_port = prx_uri.port\n end\n\n h = Net::HTTP.new(uri.host, uri.port, prx_host, prx_port)\n h.set_debug_output($stderr) if $DEBUG\n h.use_ssl = uri.scheme == \"https\"\n h.verify_mode = OpenSSL::SSL::VERIFY_NONE # OpenSSL::SSL::VERIFY_PEER\n\n @body = ''\n begin\n @get_resp = h.get2(uri.request_uri, Config[:http_get_header]){|resp| @body += resp.body}\n rescue Exception => ex\n $LOG.fatal \"Unable to get web page. Error: #{ex}\"\n exit 1\n end\n\n if http_redirect?\n $LOG.debug \"#{@get_resp.class} is a kind of HTTPRedirection\"\n $LOG.debug \"Redirect location = #{redirect_location}\"\n elsif http_success?\n $LOG.debug \"#{@get_resp.class} is a kind of HTTPSuccess\"\n else\n $LOG.debug \"#{@get_resp.class} is neither HTTPSuccess nor HTTPRedirection!!!\"\n end\n\n end",
"def proxy_google(path)\n res = Net::HTTP.start('www.google.com', 80) do |http|\n http.get path\n end\n res.body\nend",
"def http(url, opts = {})\n method = opts[:method] || :get\n response = HTTParty.send(method, url, opts)\n if (200..299).include?(response.code)\n response.body\n else\n raise HttpError.new(\"Bad response: #{response.code} #{response.body}\", response)\n end\n end",
"def request(verb, uri, opts = T.unsafe(nil)); end",
"def get_request(url)\n\n request = Net::HTTP::Get.new(url)\n request['content-type'] = 'application/x-www-form-urlencoded'\n request['accept'] = '*/*'\n return request\nend",
"def initialize_http(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http\n end",
"def get_response(url)\n uri = URI(url)\n Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new uri\n return http.request(request).body\n end\nend",
"def request_page(url, cookies)\n proxy_host, proxy_port = check_proxy\n headers = {\n 'Host' => 'www.jigsaw.com',\n 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0',\n 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',\n 'Accept-Language' => 'en-US,en;g=0.5',\n #\"Accept-Encoding\" => 'gzip, deflate',\n 'Content-Type' => 'text/plain',\n 'Pragma' => 'no-cache',\n 'Content-Length' => '0',\n 'Cache-Control' => 'no-cache',\n 'Connection' => 'keep-alive',\n 'DNT' => '1',\n 'Cookie' => cookies.to_s\n }\n puts output_http(headers, 'request') if @options[:debug]\n http = Net::HTTP.new('www.jigsaw.com', 80, proxy_host, proxy_port)\n resp, data = http.get(url, headers)\n puts output_http(resp.header.to_hash, 'response') if @options[:debug]\n return resp\nend",
"def build_http(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.set_debug_output($stdout) if trace?\n if (uri.scheme == 'https')\n http.use_ssl = true\n if (@options[:ssl_verify_mode].to_s.strip.downcase == 'peer')\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.ca_file = @options[:ssl_ca_file] if @options[:ssl_ca_file]\n else\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n end\n http.read_timeout=60\n http.open_timeout=60\n http\n end",
"def uri_target(options)\n uri = URI.parse(options[:uri])\n http = Net::HTTP.new(uri.host, uri.port)\n\n if uri.scheme == 'https' then\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n # Timeout handler, just in case.\n response = nil\n begin\n Timeout::timeout(options[:timeout]) do\n request = Net::HTTP::Get.new(uri.request_uri)\n if (options[:user] and options[:pass]) then\n request.basic_auth(options[:user], options[:pass])\n end\n if (options[:headers]) then\n options[:headers].each do |h|\n k,v = h.split(':')\n request[k] = v\n end\n end\n response = http.request(request)\n end\n # Not sure whether a timeout should be CRIT or UNKNOWN. -- phrawzty\n rescue Timeout::Error\n say(options[:v], 'The HTTP connection timed out after %i seconds.' % [options[:timeout]])\n msg = 'Connection timed out.'\n Nagios.do_exit(2, msg)\n rescue Exception => e\n say(options[:v], 'Exception occured: %s.' % [e])\n msg = 'HTTP connection failed.'\n Nagios.do_exit(3, msg)\n end\n\n # We must get a 200 response; if not, the user might want to know.\n if not response.code.to_i == 200 then\n level = options[:status_level_default]\n if options[:status_level] then\n options[:status_level].each do |s|\n k,v = s.split(':')\n if response.code.to_i == k.to_i\n level = v.to_i\n break\n end\n end\n end\n if not level == 0 then\n msg = 'Received HTTP code %s instead of 200.' % [response.code]\n Nagios.do_exit(level.to_i, msg)\n end\n end\n\n say(options[:v], \"RESPONSE:\\n---\\n%s\\n---\" % [response.body])\n\n begin\n # Make a JSON object from the response.\n json = JSON.parse response.body\n rescue Exception => e\n say(options[:v], 'Could not parse JSON from HTTP response: %s.' % [e])\n msg = 'Parsing JSON failed.'\n Nagios.do_exit(3, msg)\n end\n\n return json\nend",
"def http_post_request(req_body)\n\t\t#New http request (uri library deals with port and host on its own when parsing the url)\n\t\thttp = Net::HTTP.new(@uri.host, @uri.port)\n\t\t#Original api url get does not need SSL (bad solution but any other way would not seem to work properly)\n\t\tif caller[1][/`.*'/].nil? or not (caller[1][/`.*'/][1..-2] == \"initialize\")\n\t\t\t#Https security stuff (don't need security when getting initial api url)\n\t\t\thttp.use_ssl = true\n\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\tend\n\t\t#Post request using uri\n\t\trequest = Net::HTTP::Post.new(@uri.request_uri)\n\t\t#Sets request to use basic authentication using the given username and api_key\n\t\trequest.basic_auth(@username, @api_key)\n\t\t#Sets request to use json content type\n\t\trequest.content_type = \"application/json\"\n\t\t#Sets request body to json file passed\n\t\trequest.body = req_body\n\t\t#Executes setup request and returns body\n\t\thttp.request(request).body\n\tend",
"def execute_http_request (method, url, args)\n @http_request = method, url.clone, args.clone\n self.http_response = HTTParty.send method, url, args\n Log.debug \"#{@http_response.request.http_method.to_s.split('::').last.upcase} - URL: #{@http_response.request.last_uri}\"\n Log.debug 'HEADER:'\n Log.debug http_response.request.options[:headers]\n # Log.debug @http_response.request.options[:body] if @http_response.request.options[:body]\n Log.debug 'BODY:' if http_response\n Log.debug http_response if http_response\n http_response\n end",
"def _http_request(method, url, *args)\n request_args = get_hash_args(*args)\n url = get_url url unless url.to_s.start_with?('http://')\n request_args[:header] = @head\n request_args[:body] = \\\n JSON.dump(request_args[:body]) if request_args[:body]\n\n res = @http_session.request(method, url, request_args)\n status = res.status\n raise HTTPError, 'HTTPError: %s %s'\\\n % [status, (JSON.load(res.content)['message'] rescue res.reason)]\\\n if status >= 400 && status < 600\n res\n end",
"def http_major; end",
"def _http_get resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Get.new(path)\n _build_request resource, request\nend",
"def _http_get resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Get.new(path)\n _build_request resource, request\nend",
"def uri_fetch(uri_str)\n address = URI(uri_str) \n response = Net::HTTP.get_response(address)\n case response\n when Net::HTTPSuccess then \n return response\n else\n abort \"Something went wrong... the call to #{uri_str} failed; type #{response.class}\"\n end\nend",
"def test_very_long_request\n header_length = 10000\n \n result = Net::HTTP.start @@HOST, @@PORT do | http |\n request = Net::HTTP::Get.new '/index.html'\n request[ 'request_header' ] = ( 1..header_length ).collect { 'a' }.reduce(:+)\n \n begin \n http.request request\n rescue\n end \n end \n end",
"def open_resource(url_file_stream_or_string, options)\n options[:handlers] ||= []\n\n if url_file_stream_or_string.respond_to?(:read)\n return url_file_stream_or_string\n\n elsif url_file_stream_or_string == '-'\n return $stdin\n end\n \n # open-uri freaks out if there's leading spaces.\n url_file_stream_or_string.strip!\n \n \n uri = Addressable::URI.parse(url_file_stream_or_string)\n if uri && ['http','https','ftp'].include?(uri.scheme)\n auth = nil\n\n if uri.host && uri.password\n auth = Base64::encode64(\"#{uri.user}:#{uri.password}\").strip\n uri.password = nil\n url_file_stream_or_string = uri.to_s\n end\n\n req_headers = {} \n req_headers[\"User-Agent\"] = options[:agent] || USER_AGENT\n req_headers[\"If-None-Match\"] = options[:etag] if options[:etag]\n \n if options[:modified]\n if options[:modified].is_a?(String)\n req_headers[\"If-Modified-Since\"] = parse_date(options[:modified]).httpdate\n elsif options[:modified].is_a?(Time)\n req_headers[\"If-Modified-Since\"] = options[:modified].httpdate\n elsif options[:modified].is_a?(Array)\n req_headers[\"If-Modified-Since\"] = py2rtime(options[:modified]).httpdate\n end\n end\n \n req_headers[\"Referer\"] = options[:referrer] if options[:referrer]\n req_headers[\"Accept-encoding\"] = 'gzip, deflate' # FIXME make tests\n req_headers[\"Authorization\"] = \"Basic #{auth}\" if auth\n req_headers['Accept'] = ACCEPT_HEADER if ACCEPT_HEADER\n req_headers['A-IM'] = 'feed' # RFC 3229 support \n \n begin\n return open(url_file_stream_or_string, req_headers) \n rescue OpenURI::HTTPError => e\n return e.io\n rescue\n end\n end\n\n # try to open with native open function (if url_file_stream_or_string is a filename)\n begin \n return open(url_file_stream_or_string)\n rescue\n end\n # treat url_file_stream_or_string as string \n return StringIO.new(url_file_stream_or_string.to_s)\n end",
"def build_http(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.set_debug_output($stdout) if @logger.debug?\n if (uri.scheme == 'https')\n http.use_ssl = true\n OpenSSL.debug = @logger.debug?\n if (@options[:ssl_verify_mode].to_s.strip.downcase == 'peer')\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.ca_file = @options[:ssl_ca_file] if @options[:ssl_ca_file]\n else\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n end\n http.read_timeout=60\n http.open_timeout=60\n http\n end",
"def http_request(url)\n uri = URI.parse(url)\n begin\n http = uri.read(read_timeout: 4)\n rescue OpenURI::HTTPError => e\n raise RequestError, YAML::dump(e)\n end\n end",
"def build_http(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n if (uri.scheme == 'https')\n http.use_ssl = true\n if (@options[:ssl_verify_mode].to_s.strip.downcase == 'peer')\n http.ca_file = @options[:ssl_ca_file] if @options[:ssl_ca_file]\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n OpenSSL.debug = @options[:log_level].to_s.strip.downcase == 'trace'\n else\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n OpenSSL.debug = false\n end\n end\n http.read_timeout = (@options[:read_timeout] || 60).to_i\n http.open_timeout = (@options[:open_timeout] || 60).to_i\n http\n end",
"def http *xs\n env.http *xs\n end",
"def get(url)\n uri = URI.parse(url)\n response = nil\n opt = {:use_ssl => true}\n #start(address, port=nil, p_addr=nil, p_port=nil, p_user=nil, p_pass=nil, opt, &block)\n Net::HTTP.start(uri.host, uri.port, p_addr=nil, p_port=nil, p_user=nil, p_pass=nil, opt) { |http|\n request = Net::HTTP::Get.new uri\n request['Referer'] = REFERER\n response = http.request request # Net::HTTPResponse object\n }\n return response\nend",
"def http_get(endpoint)\n uri= URI.parse \"#{@main_url}#{endpoint}\"\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(@username, @api_key)\n response = http.request(request)\n response.body\nend",
"def http_get(request)\n tries = 3\n begin\n curl = Curl::Easy.new request\n curl.useragent = USER_AGENT\n curl.perform\n begin\n JSON.parse curl.body_str\n rescue JSON::ParserError => err\n @log.warn \"Could not parse response for #{request} - this is probably not a json response: #{curl.body_str}\"\n return nil\n end\n rescue Curl::Err::ConnectionFailedError => err\n @log.error \"Connection failed: #{err}\"\n tries -= 1\n sleep 3\n if tries > 0\n retry\n else\n nil\n end\n rescue Curl::Err::RecvError => err\n @log.error \"Failure when receiving data from the peer: #{err}\"\n tries -= 1\n sleep 3\n if tries > 0\n retry\n else\n nil\n end\n rescue Curl::Err => err\n @log.error \"Failure in Curl call: #{err}\"\n tries -= 1\n sleep 3\n if tries > 0\n retry\n else\n nil\n end\n end\n end",
"def do_request url\n Nokogiri::HTML(HTTParty.get(url))\nend",
"def create_http_request(http_method,path,*arguments)\n http_method=http_method.to_sym\n if [:post,:put].include?(http_method)\n data=arguments.shift\n end\n headers=(arguments.first.is_a?(Hash) ? arguments.shift : {})\n case http_method\n when :post\n request=Net::HTTP::Post.new(path,headers)\n request[\"Content-Length\"]=0 # Default to 0\n when :put\n request=Net::HTTP::Put.new(path,headers)\n request[\"Content-Length\"]=0 # Default to 0\n when :get\n request=Net::HTTP::Get.new(path,headers)\n when :delete\n request=Net::HTTP::Delete.new(path,headers)\n when :head\n request=Net::HTTP::Head.new(path,headers)\n else\n raise ArgumentError, \"Don't know how to handle http_method: :#{http_method.to_s}\"\n end\n if data.is_a?(Hash)\n request.set_form_data(data)\n elsif data\n request.body=data.to_s\n request[\"Content-Length\"]=request.body.length\n end\n request\n end",
"def http_get(opts={})\n raw_content = opts[:raw_content] || false\n ret=http_get_low(opts)\n if !raw_content then\n\tif ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n authdefault\n ret=http_get_low(opts)\n return ret\n else\n return ret\n\tend\n else\n\treturn ret\n end\n end",
"def http\n @http || prepare_http_connection\n end",
"def parse(uri, response, body); end",
"def new_http()\n http = Net::HTTP.new(@uri.host, @uri.port)\n if @uri.to_s.include?(\"https\")\n @log.debug(\"uri contains https. Enabling https\")\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n return http\nend",
"def api(path,lastmodified = nil) #Returns the FRC API file for the specified path in JSON format.\n #Warning: api() returns an HTTP response while reqapi() returns a JSON string.\n begin\n \tputs \"I am accessing the API at path #{path}\"\n \toptions = { 'User-Agent' => \"https://github.com/2468scout/2468Scout-Ruby-Server\", #Dunno what this is but Isaac did it\n 'Authorization' => \"Basic #{$token}\", #Standard procedure outlined by their API\n 'accept' => \"application/json\" #We want JSON files, so we will ask for JSON\n \t}\n \t#FMS-OnlyModifiedSince will return just a 304\n \t#If-Modified-Since will return a 200 no matter what, for some reason\n \toptions['FMS-OnlyModifiedSince'] = lastmodified if lastmodified\n #puts options['If-Modified-Since']\n #open(\"#{$server}#{path}\", options).read\n toreturn = {}\n\n if $toggle_manual_input\n \tputs \"I want to access #{path}, but manual input is turned on! Please type the filename to use in its place.\"\n \tfilename = \"\"\n \twhile(!File.exists? filename)\n \t\tputs \"Try file name: \"\n \t\tfilename = gets\n \t\tputs \"Searching for the file #{filename}...\"\n \tend\n \tjsondata = retrieveJSON(filename)\n \ttoreturn = OpenStruct.new(:body => jsondata, :meta => {}, :staus => ['200', 'OK']) \n else\n\t open(\"#{$server}#{path}\", options) do |response|\n\t \tbody = \"\"\n\t \tresponse.each_line do |line|\n\t \t\tbody << line.to_s\n\t \tend\n\t \t#response.base_uri.to_s\n\t \ttoreturn = OpenStruct.new(:body => body, :meta => response.meta, :status => response.status)\n\t \t#must create a persistent object out of the response, as response is not accessible outside this method\n\t end\n\tend\n toreturn\n rescue => e\n \tputs \"Something went wrong #{e.class}, message is #{e.message}\"\n toreturn = '{}'\n if (e.message.include? '304') \n \ttoreturn = OpenStruct.new(:body => '{}', :status => ['304','Not Modified'])\n\tend\n\ttoreturn #If error, return empty JSON-ish, or 304 if 304\n end\nend",
"def read_https(url)\n response = nil\n uri = URI(url)\n \n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.start do |http|\n response = Net::HTTP.get_response(uri)\n end\n response\nend",
"def request (url_requested, api_key)\n url_builded = url_requested + \"&api_key=\" + api_key\n\n url = URI(url_builded)\n\n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n\n response = https.request(request)\n\n JSON.parse(response.read_body)\nend",
"def partial_request(uri, range)\nbegin\nresponse = open(uri, 'Range' => range)\nrescue OpenURI::HTTPError => e\nresponse = e.io\nend\n\nputs \"Status code: #{response.status.inspect}\"\nputs \"Representation size: #{Response.size}\"\nputs \" Content Range: #{response.meta['content-range']}\"\nputs \" Etag: #{response.meta['etag']}\"\nend",
"def get_content(mid)\r\n uri = URI.parse(\"https://www.googleapis.com/freebase/v1/rdf/\" << mid)\r\n http = Net::HTTP.new(uri.host, uri.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\r\n request = Net::HTTP::Get.new(uri.request_uri)\r\n response = http.request(request)\r\n if response.code == \"403\"\r\n response.code \r\n else\r\n response.body\r\n end\r\nend",
"def initialize(uri = T.unsafe(nil), response = T.unsafe(nil), body_io = T.unsafe(nil), code = T.unsafe(nil)); end",
"def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n req_options = req_options.merge(options)\n \n raise ConfigurationError.new \"No endpoint defined\" if !path || path.empty?\n raise ConfigurationError.new \"No hostname defined\" if !req_options[:base_uri] || req_options[:base_uri].empty?\n \n # prepare request\n req = HTTParty::Request.new http_method, path, req_options\n req.options[:timeout] = CityGrid.custom_timeout if req.options && CityGrid.custom_timeout_set?\n\n # Sanitized request for logs\n safe_req_options = strip_unsafe_params(http_method, req_options)\n req_to_output = HTTParty::Request.new http_method, path, safe_req_options\n req_for_airbrake = { :method => http_method, :path => path, :options => safe_req_options }\n\n begin\n response = req.perform\n rescue => ex \n if defined?(Rails.logger)\n Rails.logger.error safe_req_options\n Rails.logger.error req_to_output\n Rails.logger.error req_for_airbrake\n Rails.logger.error ex\n end\n raise CityGridExceptions::RequestError.new req_for_airbrake, nil, ex.message, req_to_output.to_curl\n ensure\n if CityGrid.print_curls? \n if defined?(Rails.logger)\n Rails.logger.info req_to_output.to_curl\n puts req_to_output.to_curl\n else\n puts req_to_output.to_curl\n end\n end\n end\n\n response_status = parse_response_status response\n \n begin \n # catch unparsable responses (html etc)\n if !response.parsed_response.is_a?(Hash)\n #pp \"[gem] the response was unparsable (response was not a hash)\"\n raise CityGridExceptions::ResponseParseError.new req_for_airbrake, response, \"the response was unparsable (response was not a hash)\", req_to_output.to_curl\n else\n # Parse and handle new response codes \n if !response_status.nil? && response_status[\"code\"] != \"SUCCESS\" && response_status[\"code\"] != 200\n raise CityGridExceptions.appropriate_error(response_status[\"code\"]).new req_for_airbrake, response, response_status[\"message\"].to_s, req_to_output.to_curl\n else\n return CityGrid::API::Response.new response\n end\n end\n rescue => ex\n pp \"API ERROR: #{ex}\"\n raise ex if CityGrid.raise_errors?\n end\n end",
"def reference_get(uri)\r\n hash = start_hash\r\n bytes = 0\r\n chunks = 0\r\n\r\n Net::HTTP.start(uri.host, uri.port) do |http|\r\n http.request_get(uri.path) do |response|\r\n response.read_body do |body|\r\n add_hash(hash, body)\r\n bytes += body.length\r\n chunks += 1\r\n end\r\n end\r\n end\r\n\r\n [bytes, chunks, complete_hash(hash)]\r\nend",
"def _http_url\n HTTPURI + _uri_path\n end"
] |
[
"0.7271585",
"0.70198554",
"0.6948352",
"0.67976016",
"0.6563417",
"0.6530013",
"0.6530013",
"0.65177315",
"0.6487354",
"0.64747363",
"0.64607257",
"0.6456502",
"0.6453718",
"0.64479053",
"0.6424643",
"0.64177495",
"0.6397112",
"0.63725424",
"0.63606185",
"0.63559896",
"0.63496363",
"0.6322425",
"0.6306072",
"0.6294029",
"0.6274549",
"0.62650865",
"0.62426466",
"0.6230733",
"0.6221246",
"0.6205664",
"0.6195842",
"0.6184762",
"0.6182886",
"0.6170378",
"0.61593413",
"0.61568946",
"0.61469567",
"0.6125139",
"0.60925657",
"0.60867625",
"0.60867625",
"0.6081832",
"0.607847",
"0.60728765",
"0.6069434",
"0.6066891",
"0.6065612",
"0.6057312",
"0.60270536",
"0.6021607",
"0.60021836",
"0.5985558",
"0.598211",
"0.598102",
"0.59805083",
"0.59774595",
"0.59762496",
"0.5972194",
"0.5970218",
"0.5970218",
"0.59569126",
"0.5952681",
"0.59453124",
"0.5945229",
"0.59414864",
"0.593424",
"0.5933895",
"0.59260875",
"0.5920272",
"0.5920027",
"0.5918139",
"0.59125936",
"0.5908394",
"0.5891193",
"0.5884413",
"0.5884413",
"0.5879997",
"0.58687794",
"0.58676106",
"0.5857228",
"0.5856379",
"0.5856301",
"0.5855367",
"0.5846346",
"0.5841574",
"0.5841397",
"0.5833146",
"0.58315897",
"0.58251953",
"0.58221036",
"0.58190995",
"0.58161116",
"0.58150977",
"0.5809159",
"0.57981795",
"0.5796793",
"0.57958657",
"0.5788261",
"0.5786577",
"0.57806385",
"0.5778674"
] |
0.0
|
-1
|
Get the list of target branches
|
def get_target_branches
unless @target_branches
fetch_all
base = @config['branches']['production']
allowed_branches = @config['branches'].values
allowed_branches << @config['prefixes']['release'] if @config['prefixes']['release']
banned_branches = ['HEAD']
target_branches = `git branch -r origin/#{base} | grep -ie '\\(#{allowed_branches.join("\\|")}\\)' | grep -iv '\\(#{banned_branches.join("\\|")}\\)' | sed -e 's/origin\\///g'`
@target_branches = target_branches.split("\n").map{|a| a.gsub(/\s+/, "")}
end
@target_branches
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def branch_targets\n []\n end",
"def branch_list\n raw_branches = `cd #{project_repo_path} && git branch -r`\n branches = raw_branches.split(/\\n/)\n return branches\n end",
"def ls_branches\n working_branches = get_branches\n if working_branches.empty?\n $stdout.puts \"No branches\"\n exit\n end\n working_branches.map.with_index { |branch, idx| \"#{idx}. #{branch}\" }\nend",
"def branches\n @branches ||= build_branches\n end",
"def all_branches\n @branches ||= git_call('branch -a').split(\"\\n\").collect { |s| s.strip }\n end",
"def branches\n @branch_heads.keys\n end",
"def branches\n client.branches(repo)\n end",
"def branches\n @branches = config.fetch('branches', ['master'])\n end",
"def branches\n @branches = config.fetch('branches', ['master'])\n end",
"def remote_branches\n @remote_branches ||= @project.branches.remote.map(&:full)\n end",
"def all_branches\n git(\"branch --all\")\n end",
"def remote_branches\n @rugged_repository.branches.each_name(:remote).sort\n end",
"def list\n Rugged::Branch.each_name(@git, :local).to_a\n end",
"def branches\n object.branches.map { |b| b.id }\n end",
"def branches\n @branches ||= get(\"/repos/show/#{owner.login}/#{name}/branches\")['branches'].map do |name, head|\n Branch.new(connection, \n :name => name,\n :head => head,\n :repo => self\n )\n end\n end",
"def branches(repo)\n api.branches(repo).index_by(&:name)\n end",
"def all_branches\n %x( git branch ).gsub!('*', '').gsub!(' ', '').split(\"\\n\")\nend",
"def refs\n select_branches(git.grit.refs)\n end",
"def get_branches\n xml = call(:branches).parsed_response\n xml.css('branches branch').map { |b| Branch.new(b, self) }\n end",
"def branches\n zombie_check\n pattern = self.class.branch_pattern(:name => @name)\n @repo.branches.select{ |b| b.name =~ pattern }\n end",
"def branches; end",
"def build_branch_list\n local_branches = `git branch`.split(' ')\n active_branch_index = local_branches.index('*')\n\n local_branches.reject { |i| i == '*' }.map.with_index do |b, i|\n BranchModel.new(b, i == active_branch_index)\n end\n end",
"def local_branches\n @local_branches ||= begin\n branches = []\n if not git.branches.local.empty?\n branches << git.branches.local.select{ |b| b.current }[0].name\n branches << git.branches.local.select{ |b| not b.current }.map{ |b| b.name }\n end\n branches.flatten\n end\n end",
"def list\n Dir.chdir @root do\n cmd = \"git branch\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n return stdout.split.map { |s|\n # Remove trailing/leading whitespace and astericks\n s.sub('*', '').strip\n }.reject { |s|\n # Drop elements created due to trailing newline\n s.size == 0\n }\n end\n end",
"def fetch_branches\n refs = @github_client.fetch_refs(@repo_user,@repo_name) \n branch_refs = filter_branch_refs refs \n branch_refs = fetch_and_set_dates(branch_refs)\n branch_refs = sort_by_date(branch_refs) \n branches(branch_refs)\n end",
"def branches\n Git::Branches.new(self)\n end",
"def test_branches_all\n branches = @lib.branches_all\n assert(branches.size > 0)\n assert(branches.select { |b| b[1] }.size > 0) # has a current branch\n assert(branches.select { |b| /\\//.match(b[0]) }.size > 0) # has a remote branch\n assert(branches.select { |b| !/\\//.match(b[0]) }.size > 0) # has a local branch\n assert(branches.select { |b| /master/.match(b[0]) }.size > 0) # has a master branch\n end",
"def git_branches(git)\n array = Array.new\n body = raw_file(http_uri + git)\n body.scan(/\" title=\".*>(.*)<\\/a><\\/li>/) do |branch|\n array << branch\n end\n array.flatten\n end",
"def branches\n if ancestor_ids.empty? then\n nil\n else\n read_attribute(self.base_class.ancestry_column).to_s.split(',')\n end\n end",
"def branches\n if ancestor_ids.empty? then\n nil\n else\n read_attribute(self.base_class.structure_column).to_s.split(',')\n end\n end",
"def get_repository_project_branches(repoName)\n self.log(INFO, repoName, \"Searching for project branches...\")\n branches = []\n b=`git branch -r`\n b.each_line do |remoteBranch|\n remoteBranch.gsub!(/\\n/, \"\")\n if remoteBranch =~ /origin\\/project/\n localBranch = \"#{remoteBranch}\"\n localBranch.slice! \"origin/\"\n branches << localBranch.strip! || localBranch\n end\n end\n self.log(INFO, repoName, \"Project branches found : #{branches}\")\n self.log(INFO, repoName, \"Done.\")\n return branches\n end",
"def local_branches(repo_path)\n result = []\n `(cd \"#{repo_path}\" && git branch | cut -c3-)`.split(\"\\n\").each do |branch|\n result << branch unless `(cd #{repo_path} && git log -1 --pretty=full #{branch})` =~ /git-svn-id:/\n end\n result\n end",
"def get_branch_names(repo)\n repo.heads.collect(&:name)\n end",
"def get_merged(br)\n __branches \"-l --merged #{br}\"\nend",
"def branches\n edges\n end",
"def remote_branches(remote)\n run(\"git branch -r\").split(\"\\n\")\n .map { |r| r.chomp.gsub(/^\\s+/, \"\") }\n .select { |r| r[remote] && ! r[\"HEAD\"] }\n .map { |r| r.gsub(\"#{remote}/\", \"\") }\n end",
"def build_branches\n branches_collection(coverage[:branches] || {})\n end",
"def branches(repo, options = {})\n paginate \"#{Repository.path repo}/branches\", options\n end",
"def recent_branches_fast\n\t\trefs = []\n\t\trefs.concat Pathname.glob(dot_git + 'refs/heads/**/*')\n\t\trefs.concat Pathname.glob(dot_git + 'refs/remotes/**/*')\n\n\t\tbranches = refs.reject {|r| r.directory? }.sort_by {|r| r.mtime }.last(@opts[:max_num]).map {|r|\n\t\t\tref = r.read.chomp\n\t\t\tif name = ref[/ref: (.+)/, 1]\n\t\t\t\tbegin\n\t\t\t\t\t(dot_git + name).read.chomp\n\t\t\t\trescue\n\t\t\t\t\t`git rev-parse #{name}`.chomp\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tref\n\t\t\tend\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend",
"def branches(*nodes)\n branches = []\n nodes = [changelog.tip] if nodes.empty?\n # for each node, find its first parent (adam and eve, basically)\n # -- that's our branch!\n nodes.each do |node|\n t = node\n # traverse the tree, staying to the left side\n # node\n # / \\\n # parent1 parent2\n # .... ....\n # This will get us the first parent. When it's finally NULL_ID,\n # we have a root -- this is the basis for our branch.\n loop do\n parents = changelog.parents_for_node t\n if parents[1] != NULL_ID || parents[0] == NULL_ID\n branches << [node, t, *parents]\n break\n end\n t = parents.first # get the first parent and start again\n end\n end\n \n branches\n end",
"def merge_branches\n Array(Configuration.merge_branch(deploy_type))\n end",
"def ostree_branches(id)\n criteria = {:type_ids => [Runcible::Extensions::OstreeBranch.content_type]}\n unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }\n end",
"def remotes\n select_branches(git.grit.remotes)\n end",
"def root_branches\n @root_branches = branches.select(&:root?)\n end",
"def all\n root.branch\n end",
"def retrieve_branch_details(branches)\n\t\tdetails = []\n\t\tIO.popen(\"-\", \"r+\") do |io|\n\t\t\tif io.nil?\n\t\t\t\targs = [ \"show\", \"--pretty=format:%H\\t%d\\t%ct\\t%cr\\t%an\\t%s\", *branches ]\n\t\t\t\targs << \"--\"\n\t\t\t\texec \"git\", *args\n\t\t\telse\n\t\t\t\twhile l = io.gets\n\t\t\t\t\tnext unless l =~ /^[a-z0-9]{40}/\n\t\t\t\t\thash, refs, time, rtime, author, subject = * l.chomp.split(/\\t/)\n\t\t\t\t\trefs.gsub!(/^\\s*\\(|\\)\\s*$/, '')\n\n\t\t\t\t\trefs.split(/\\s*,\\s*/).each do |ref|\n\t\t\t\t\t\tis_remote = ref[%r{refs/remotes}]\n\t\t\t\t\t\tref.gsub!(%r{refs/(remotes|heads)/}, '')\n\t\t\t\t\t\tdetails.push Ref.new(hash, ref, time.to_i, rtime, author, subject)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tdetails\n\tend",
"def branches_report\n @branches_report ||= build_branches_report\n end",
"def branches(type = :master, dir = Dir.pwd, _options = {})\n FalkorLib::Git.config(\"gitflow.branch.#{type}\", dir)\n #confs[type.to_sym]\n end",
"def branches *path\n return enum_for(:branches, *path) unless block_given?\n self.each_pair do |k,v|\n if k.slice(0, path.size) == path\n sub_key = k - k.slice(0,path.size)\n v = proxy?(v) ? v.deproxy : v\n yield sub_key[0], v unless sub_key.size != 1\n end\n end\n end",
"def branches?\n ! branch_targets.empty?\n end",
"def branch(target, options = {})\n branches << Branch.new(target, options)\n end",
"def descendents\n respond_to?(:values) ? values.map { |d| d.branch }.flatten : []\n end",
"def branches(hash={})\n Branch.all(:id => LoanHistory.parents_where_loans_of(Branch, {:loan => {:funding_line_id => funding_lines.map{|x| x.id}}, :branch => hash}))\n end",
"def target_tree\n tree = []\n\n tree << self.level.build.target if self.level.build?\n tree << self.level.patch.target if self.level.patch? || self.level.build?\n tree << self.level.version.target if self.level.version? || self.level.patch? || self.level.build?\n tree << self.level.era.target\n\n tree\n end",
"def branches\n @board.free_moves.map do |pos|\n move pos\n end.compact\n end",
"def ShowBranches()\r\n ret = _invoke(1610743819, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def branches\n bodies = when_branches.map(&:body)\n bodies.push(else_branch) if else?\n bodies\n end",
"def show\n @branches = @entity.branches\n end",
"def case_branches(branches)\n branches.select do |branch|\n id == branch.root_id && branch.start_line != start_line\n end\n end",
"def branch\n if request.args.first == \"list\"\n request.args[1]\n else\n request.args.first\n end\n end",
"def target_branch\n # TODO: Enable possibility to manually override this and set arbitrary branches.\n ENV['TARGET_BRANCH'] || 'master'\n end",
"def branches_containing_commit(commit_ref); end",
"def branches_containing_commit(commit_ref); end",
"def when_branches\n node_parts[1...-1]\n end",
"def branches_collection(given_branches, root_id = nil)\n @branches_collection ||= []\n given_branches.each do |branch_args_sym, value|\n branch_args = extract_branch_args(branch_args_sym.to_s)\n branch_args << root_id\n branch = SourceFile::Branch.new(*branch_args)\n\n if value.is_a?(Integer)\n branch.coverage = value\n else\n branches_collection(value, branch.id)\n end\n\n @branches_collection << branch\n end\n @branches_collection\n end",
"def index\n @branches = Branch.all\n end",
"def index\n @branches = Branch.all\n end",
"def index\n @branches = Branch.all\n end",
"def collect_branches_iter(query, vars, end_cursor, all_branches = [])\n \n # Shortcut during dev\n if vars[:stopafter] then\n $stdout.puts \" stopping early due to 'stopafter', have #{all_branches.size} branches\"\n return all_branches if (all_branches.size() > vars[:stopafter].to_i)\n end\n \n $stdout.puts \" fetching (currently have #{all_branches.size} branches)\"\n \n if end_cursor then\n vars[:after] = end_cursor\n end\n result = @client.query(query, variables: vars)\n # pp result\n \n all_branches += result.data.repository.refs.nodes\n paging = result.data.repository.refs.page_info\n if (paging.has_next_page) then\n collect_branches_iter(query, vars, paging.end_cursor, all_branches)\n else\n return all_branches\n end\n end",
"def covered_branches\n @covered_branches ||= root_branches.flat_map do |root_branch|\n root_branch.sub_branches(branches).select(&:covered?)\n end\n end",
"def create_branches(repo)\n @branch_names.collect {|branch_name| \n Branch.new(branch_name ,Grit::Commit.find_all(repo, branch_name).sort_by { |k| k.authored_date}.reverse)}\n end",
"def examples_branches(count = 4)\n all.first(count).map(&:to_s)\n end",
"def recent_branches_strict\n\t\tbranches = `git branch -a`.gsub!(/^\\*?\\s+|\\(no branch\\)\\s*/, \"\").split(/\\n/).map {|i|\n\t\t\ti.split(/ -> /)[0]\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend",
"def targets()\n if @target then\n return [self]\n else\n return []\n end\n end",
"def releases\n Release.branch(self)\n end",
"def extract_branches(decorate, remove_head = true)\n return [] if decorate.blank?\n decorate.strip[1...-1].split(', ').\n reject { |b| remove_head && b == 'HEAD' || b =~ /^tag:\\s/ }\n end",
"def targets\n @targets ||= []\n end",
"def branch(group:nil)\n case group\n when :remote\n flag = \"-r\"\n when :all\n flag = \"-a\"\n when nil, :local\n flag = \"\"\n end\n\n `git branch #{flag}`.lines.map do |line|\n fields = line.split\n\n if fields.first['*']\n fields[1].strip\n else\n fields.first.strip\n end\n end\nend",
"def target\n \"#{target_repo}/#{target_branch}\"\n end",
"def branches(branchobj=nil)\n branchobj ||= self\n return branchobj unless branchobj.is_a?(Hash) || branchobj.is_a?(Array)\n return branchobj if branchobj.is_a?(Hash) && branchobj.none? { |k, v| v.is_a?(Hash) }\n\n # Hash with hashes\n if branchobj.is_a?(Array)\n branchobj = branchobj.each_with_index.with_object({}) do |(bval, idx), obj|\n obj[\"#{idx}\"] = bval\n end\n end\n branchobj.each_with_object({}) do |(k, v), obj|\n next obj[k.to_s] = v if v.nil? || v == false # Falsey things will act weird in #branches\n\n bdata = branches(v)\n case bdata\n when Hash\n bdata.each do |bkey, bval|\n obj[\"#{k}.#{bkey}\"] = bval\n end\n else\n obj[\"#{k}\"] = bdata\n end\n end\n end",
"def get_all_commits_in_repo\n @branches.collect(&:commits).flatten.sort_by { |k| k.authored_date }.reverse\n end",
"def files_in branch:\n array_output_of(\"git ls-tree -r --name-only #{branch}\")\nend",
"def deep_branch_children\n if self.branch?\n arr = []\n children.each do |child|\n if child.branch?\n arr.concat child.deep_branch_children\n end\n end\n arr.push self\n arr\n else\n nil # caller shouldn't be asking for branch children anyway\n end\n end",
"def targets\n\t\tTarget.find(:all)\n\tend",
"def index\n @branches = Branch.all\n end",
"def get_targets\n {\n method: \"Target.getTargets\"\n }\n end",
"def list(path=nil)\n sha = path_to_sha(path)\n # ensure correct operation even if path doesn't exist in repo\n t = sha ? tree(sha) : tree(@current_branch, (path ? [path] : []))\n t ? tree_contents( t ) : {}\n end",
"def index\n @branch_trees = BranchTree.all\n end",
"def branch\n (@options[:branch] || 'master').to_s\n end",
"def branch\n (@options[:branch] || 'master').to_s\n end",
"def branchset\n\t\treturn Treequel::Branchset.new( self )\n\tend",
"def current_branch\n repo.branches.find(&:head?)\n end",
"def covered_branches\n coverage_statistics[:branch]&.covered\n end",
"def local_branch_information\n #This is sensitive to checkouts of branches specified with wrong case\n\n listing = capture_process_output(\"#{LOCAL_BRANCH_LISTING_COMMAND}\")[1]\n\n raise(NotOnGitRepositoryError, listing.chomp) if listing =~ /Not a git repository/i\n if listing =~ /\\(no branch\\)/\n raise InvalidBranchError, [\"Couldn't identify the current local branch. The branch listing was:\",\n LOCAL_BRANCH_LISTING_COMMAND.red, listing].join(\"\\n\")\n end\n\n current_branch = nil\n branches = listing.split(\"\\n\").map do |line|\n current = line.include? '*'\n clean_line = line.gsub('*','').strip\n current_branch = clean_line if current\n clean_line\n end\n\n return current_branch, branches\n end",
"def targets\n project.targets\n end",
"def branch_details(branches, remote_url)\n markaby do\n branches.map do |branch|\n h2.toggler.open \"Branch #{branch.name}\", :id => branch.name.gsub(/ /, '')\n div.toggle.branch do\n image_gallery(branch) if Babygitter.output_graphs\n div.branch_details do\n author_links(branch)\n branch_synopsis(branch)\n hr :class => \"end_of_info\"\n h3.toggler.open \"#{branch.name} commit history\"\n div.toggle do\n ul do\n branch_committer_detail(branch, branch.commits, remote_url)\n end\n end\n hr :class => \"end_of_info\"\n author_details(branch.name, branch.authors, remote_url, branch.total_commits)\n end\n end\n hr :class => \"end_of_branch_info\"\n end\n end\n end",
"def branches(user_name, repo_name, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless (user? && repo?)\n normalize! params\n\n response = get_request(\"/1.0/repositories/#{user}/#{repo.downcase}/branches/\", params)\n return response unless block_given?\n response.each { |el| yield el }\n end",
"def index\n @branches = @repository.branches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @branches }\n end\n end",
"def target_branch\n self.known_options.first || 'master'\n end",
"def get_list\n @list_of_repos\n end"
] |
[
"0.81760216",
"0.77343994",
"0.7691612",
"0.7672455",
"0.7603706",
"0.7532292",
"0.7505481",
"0.7361787",
"0.7361787",
"0.7281029",
"0.7242032",
"0.71532995",
"0.71283394",
"0.7102128",
"0.70990485",
"0.7092226",
"0.709189",
"0.7063478",
"0.7028348",
"0.70251083",
"0.69988316",
"0.6844345",
"0.68249285",
"0.6748194",
"0.672832",
"0.6719205",
"0.6706592",
"0.6681149",
"0.66783106",
"0.6675917",
"0.664359",
"0.662907",
"0.6572319",
"0.6499731",
"0.64473516",
"0.64223015",
"0.6415324",
"0.6385156",
"0.63562304",
"0.63452256",
"0.6324695",
"0.6222534",
"0.62114877",
"0.6202029",
"0.61857605",
"0.61810195",
"0.6161597",
"0.61384684",
"0.61281115",
"0.61069757",
"0.60500425",
"0.60453427",
"0.60435647",
"0.5996816",
"0.59966487",
"0.5968654",
"0.59018266",
"0.58964103",
"0.5892455",
"0.5886245",
"0.5880419",
"0.5860504",
"0.5858996",
"0.5848072",
"0.5836136",
"0.58359957",
"0.58359957",
"0.58359957",
"0.58062094",
"0.5796429",
"0.5794034",
"0.57920194",
"0.5781483",
"0.57781756",
"0.57691616",
"0.57621396",
"0.56975436",
"0.5696215",
"0.56786627",
"0.5656303",
"0.56328684",
"0.5627705",
"0.5621013",
"0.5618275",
"0.56172365",
"0.56149334",
"0.5611201",
"0.56032044",
"0.56027985",
"0.56027985",
"0.55789673",
"0.5575769",
"0.5568167",
"0.55676425",
"0.5566069",
"0.5566043",
"0.55619556",
"0.5549899",
"0.55341226",
"0.55270475"
] |
0.84020025
|
0
|
We only would like to push to a list of branches only
|
def valid_target? to
get_target_branches.include?(to)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pushToGitRemotes(branch = 'develop', force = 0)\n if force\n force = \"-f\"\n else\n force = \"\"\n end\n remotes = `git remote`.split(\"\\n\")\n remotes.each do |remote|\n remote.chomp!\n UI.important(\"Pushing #{branch} to remote: #{branch}\\\"\")\n sh(\"git push #{force} #{remote} #{branch}\")\n end\nend",
"def branches\n @branches = config.fetch('branches', ['master'])\n end",
"def branches\n @branches = config.fetch('branches', ['master'])\n end",
"def push_branch\n return puts \"Not pushing, isn't a branch: #{@name}\" unless valid?\n\n puts \"Checking if we can push something on #{@source.name}\"\n return puts \"...nothing to push for #{@source.name}\" unless dirty? && valid?\n\n puts \"...pushing #{@source.name}[#{shortsha(@source.name)}]\"\n @git.push('origin', @source.name)\n @pushed = true\n end",
"def add_commits_in_current_repo\n existing_branches.each do |branch_name|\n add_commits_in_branch branch_name\n end\n @commit_list\n end",
"def get_target_branches\n unless @target_branches\n fetch_all\n base = @config['branches']['production']\n allowed_branches = @config['branches'].values\n allowed_branches << @config['prefixes']['release'] if @config['prefixes']['release']\n banned_branches = ['HEAD']\n target_branches = `git branch -r origin/#{base} | grep -ie '\\\\(#{allowed_branches.join(\"\\\\|\")}\\\\)' | grep -iv '\\\\(#{banned_branches.join(\"\\\\|\")}\\\\)' | sed -e 's/origin\\\\///g'`\n @target_branches = target_branches.split(\"\\n\").map{|a| a.gsub(/\\s+/, \"\")}\n end\n @target_branches\n end",
"def push(_branch)\n puts 'TODO: Implement Git.push'\n end",
"def branches; end",
"def branches\n @branches ||= build_branches\n end",
"def branches?\n ! branch_targets.empty?\n end",
"def test_branches_all\n branches = @lib.branches_all\n assert(branches.size > 0)\n assert(branches.select { |b| b[1] }.size > 0) # has a current branch\n assert(branches.select { |b| /\\//.match(b[0]) }.size > 0) # has a remote branch\n assert(branches.select { |b| !/\\//.match(b[0]) }.size > 0) # has a local branch\n assert(branches.select { |b| /master/.match(b[0]) }.size > 0) # has a master branch\n end",
"def branch_list\n raw_branches = `cd #{project_repo_path} && git branch -r`\n branches = raw_branches.split(/\\n/)\n return branches\n end",
"def all_branches\n git(\"branch --all\")\n end",
"def local_branches(repo_path)\n result = []\n `(cd \"#{repo_path}\" && git branch | cut -c3-)`.split(\"\\n\").each do |branch|\n result << branch unless `(cd #{repo_path} && git log -1 --pretty=full #{branch})` =~ /git-svn-id:/\n end\n result\n end",
"def check_if_push_allowed\n if @source.is_a?(CDNSource)\n raise Informative, 'Cannot push to a CDN source, as it is read-only.'\n end\n\n remotes, = Executable.capture_command('git', %w(remote --verbose), :capture => :merge, :chdir => repo_dir)\n master_repo_urls = [\n 'git@github.com:CocoaPods/Specs.git',\n 'https://github.com/CocoaPods/Specs.git',\n ]\n is_master_repo = master_repo_urls.any? do |url|\n remotes.include?(url)\n end\n\n if is_master_repo\n raise Informative, 'To push to the CocoaPods master repo use ' \\\n \"the `pod trunk push` command.\\n\\nIf you are using a fork of \" \\\n 'the master repo for private purposes we recommend to migrate ' \\\n 'to a clean private repo. To disable this check remove the ' \\\n 'remote pointing to the CocoaPods master repo.'\n end\n end",
"def remote_branches\n @remote_branches ||= @project.branches.remote.map(&:full)\n end",
"def all_branches\n @branches ||= git_call('branch -a').split(\"\\n\").collect { |s| s.strip }\n end",
"def branch_targets\n []\n end",
"def git_push_if_changes( names ) ## optenfootball repo names e.g. world, england, etc.\n message = \"auto-update week #{Date.today.cweek}\"\n puts message\n\n names.each do |name|\n path = \"#{SportDb::Boot.root}/openfootball/#{name}\"\n\n Gitti::GitProject.open( path ) do |proj|\n puts ''\n puts \"###########################################\"\n puts \"## trying to commit & push repo in path >#{path}<\"\n puts \"Dir.getwd: #{Dir.getwd}\"\n output = proj.changes\n if output.empty?\n puts \"no changes found; skipping commit & push\"\n else\n proj.add( '.' )\n proj.commit( message )\n proj.push\n end\n end\n end\nend",
"def handle_repo_push_request\n return unless @repository\n\n branch_name = payload[\"ref\"].sub(%r{\\Arefs/heads/}, '')\n branch = @repository.branches.where(name: branch_name).first\n if branch.present? && branch.convergence? && @repository.run_ci?\n sha = payload[\"after\"]\n branch.kickoff_new_build_unless_currently_busy(sha)\n end\n end",
"def recent_branches_strict\n\t\tbranches = `git branch -a`.gsub!(/^\\*?\\s+|\\(no branch\\)\\s*/, \"\").split(/\\n/).map {|i|\n\t\t\ti.split(/ -> /)[0]\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend",
"def check_for_new_commits_on_branches\n setup_worker_data\n filtered_branch_name_to_commits = filter_branch_name_to_commits_mapping\n\n if filtered_branch_name_to_commits.empty?\n logger.debug(\n \"No new commits found for #{project.project_name} on branches <#{branches.to_a.join(', ')}>\"\n )\n return\n end\n logger.debug(\"Creating build task(s) for #{project.project_name} (#{repo_full_name})\")\n\n enqueue_new_builds(filtered_branch_name_to_commits)\n end",
"def branches\n client.branches(repo)\n end",
"def git_push(host, branch, git_repo_path)\n git_on(host, \"push origin #{branch}\", git_repo_path)\nend",
"def filter_branch_refs(refs)\n refs.select do |r|\n ref_name = r[\"ref\"]\n ref_name.start_with? \"refs/heads\"\n end\n end",
"def check_duplicata_pr_branch(pr)\n puts `git branch --list #{pr}`\n `git branch -D #{pr} 2>/dev/null` if $CHILD_STATUS.exitstatus.zero?\n end",
"def all_branches\n %x( git branch ).gsub!('*', '').gsub!(' ', '').split(\"\\n\")\nend",
"def fetch_branches\n refs = @github_client.fetch_refs(@repo_user,@repo_name) \n branch_refs = filter_branch_refs refs \n branch_refs = fetch_and_set_dates(branch_refs)\n branch_refs = sort_by_date(branch_refs) \n branches(branch_refs)\n end",
"def branches_containing_commit(commit_ref); end",
"def branches_containing_commit(commit_ref); end",
"def needs_pushing?(dir = Dir.pwd)\n rval = false\n branch = get_branch\n if is_origin_branch? branch\n Dir.chdir(dir) do\n rval = (%x{git diff \"#{branch}\"..origin/\"#{branch}\"}.size > 0)\n end\n end\n rval\nend",
"def remote_branches\n @rugged_repository.branches.each_name(:remote).sort\n end",
"def git_add_commit_push(host, branch, message, git_repo_path)\n git_add_everything(host, git_repo_path)\n git_commit_push(host, branch, message, git_repo_path)\nend",
"def build_branch_list\n local_branches = `git branch`.split(' ')\n active_branch_index = local_branches.index('*')\n\n local_branches.reject { |i| i == '*' }.map.with_index do |b, i|\n BranchModel.new(b, i == active_branch_index)\n end\n end",
"def update!(**args)\n @branches = args[:branches] if args.key?(:branches)\n end",
"def push!\n notify.write(\"Pushing to origin\")\n proj.push('origin', proj_branch)\n proj.push('origin', report_branch)\n end",
"def branches\n zombie_check\n pattern = self.class.branch_pattern(:name => @name)\n @repo.branches.select{ |b| b.name =~ pattern }\n end",
"def sync_addon_branch_to_blessed_repo(repoName, remoteBranch, localBranch, pushForce = false)\n self.log(INFO,repoName,\"Checkout #{remoteBranch} branch (it is perhaps not the default) for #{repoName}...\")\n s = system(\"git checkout #{localBranch}\")\n if !s\n print(\"[ERROR] No #{remoteBranch} branch in repository #{repoName}, Skip this repo!!!\\n\")\n self.log(INFO,repoName,\"Done.\")\n # Let's process the next one\n else\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Reset #{localBranch} to #{remoteBranch} for #{repoName} ...\")\n s = system(\"git reset --hard #{remoteBranch}\")\n if !s\n abort(\"[ERROR] Reset #{localBranch} to #{remoteBranch} for #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Push #{localBranch} branch content from exo-addons repository to blessed repository ...\")\n\n forceParam = \"\"\n if pushForce\n forceParam = \"--force\"\n end\n\n s = system(\"git push #{forceParam} blessed #{localBranch}\")\n if !s\n abort(\"[ERROR] Push of #{localBranch} branch updates to repository #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n end\n end",
"def create_branches(repo)\n @branch_names.collect {|branch_name| \n Branch.new(branch_name ,Grit::Commit.find_all(repo, branch_name).sort_by { |k| k.authored_date}.reverse)}\n end",
"def git_push_commits\n shellout(\"git push #{config[:remote]} #{config[:branch]}\")\n end",
"def sync_project_branches(repoName)\n projectBranches = get_repository_project_branches(repoName)\n projectBranches.each do |branch|\n self.log(INFO, repoName, \"Synchronize project branch #{branch}\")\n sync_addon_branch_to_blessed_repo(repoName, \"origin/#{branch}\", branch, true)\n end\n end",
"def manage_all_projects\n projects= [ \n [\"barjob\", \"git@github.com/foo/bar.git\"],\n [\"quxjob\", \"git@github.com/baz/qux.git\"],\n ]\n projects.each do |project_name, git_repo|\n manage_dynamic_branches_for_project(project_name, git_repo)\n end\nend",
"def local_branches\n @local_branches ||= begin\n branches = []\n if not git.branches.local.empty?\n branches << git.branches.local.select{ |b| b.current }[0].name\n branches << git.branches.local.select{ |b| not b.current }.map{ |b| b.name }\n end\n branches.flatten\n end\n end",
"def push(downstream, upstream, remote_branch='svn_git_port')\n name=get_dir_name(downstream, upstream)\n upstream_dir=File.join(name, 'upstream')\n Dir.chdir(upstream_dir) do\n puts `git checkout -b push`\n puts `git push upstream HEAD:#{remote_branch}`\n end\nend",
"def ls_branches\n working_branches = get_branches\n if working_branches.empty?\n $stdout.puts \"No branches\"\n exit\n end\n working_branches.map.with_index { |branch, idx| \"#{idx}. #{branch}\" }\nend",
"def track_missing\n lbranches = local_branches\n dbg \"track_missing: local branches = #{lbranches.join(', ')}\"\n remote = remote_name\n added = []\n remote_branches.reject { |b| /HEAD/.match(b) }.each do |branch|\n dbg \" considering remote branch #{branch}\"\n lbranch = branch.sub(/^#{remote}\\//, '')\n dbg \" local branch name would be #{lbranch}\"\n unless lbranches.include? lbranch\n dbg \" not already tracking #{lbranch}\"\n added << lbranch\n track lbranch\n end\n end\n added\n end",
"def list\n Rugged::Branch.each_name(@git, :local).to_a\n end",
"def is_branch_build\n self.pull_request_number == '-1'\n end",
"def merge_branches\n Array(Configuration.merge_branch(deploy_type))\n end",
"def push\n ensure_git_and_cucumber_available\n ensure_repository\n\n puts \"Not implemented yet... pull request for push please!\"\n end",
"def test_integration_branch_is_optional\n modified_payload = modify_payload(payload)\n svc = service({'server_url' => 'nowhere', 'username' => 'someone', 'password' => '12345', 'central_repository' => '1'}, modified_payload)\n svc.xmlrpc_client = @server\n svc.receive_push\n\n assert @server.closed_bugs.include?(1)\n assert @server.bug_posts.include?(4)\n end",
"def check_branch\n same_branch = `git branch -a` =~ /\\* #{@branch}/\n\n if current_remote = `git remote -v`.match(/\\s\\S+/)\n same_remote = current_remote[0].match(/#{@repo}/)\n end\n\n if same_remote && same_branch\n puts \"Deploy to #{@branch} canceled:\".red\n puts \"You cannot deploy to the same branch you are working in. This will overwrite the source for your site.\\n\"\n puts \"First, back up your site's source to a branch:\"\n puts \"\\n git checkout -b source\".yellow\n puts \" git push origin source\".yellow\n puts \"\\nWith that, you'll work in the #{\"source\".bold} branch and deploy to the #{@branch.bold} branch.\"\n abort\n end\n end",
"def branches\n @branches ||= get(\"/repos/show/#{owner.login}/#{name}/branches\")['branches'].map do |name, head|\n Branch.new(connection, \n :name => name,\n :head => head,\n :repo => self\n )\n end\n end",
"def build_branches\n branches_collection(coverage[:branches] || {})\n end",
"def sync_remotes_to_local(repo)\n local_branches = {}\n remote_branches = {}\n\n repo.branches.each {|branch|\n before, after = branch.name.split('/')\n if after.nil? # Test if this is a local branch\n local_branches[before] = branch\n else\n if branch.type == :direct # Ignore origin/HEAD etc.\n remote_branches[after] = [] unless remote_branches.key? after\n remote_branches[after].push branch\n end\n end\n }\n\n remote_branches.each {|name, remotes|\n begin\n max = remotes.max {|a, b|\n commit_compare repo, a.target, b.target\n }\n rescue ArgumentError\n raise Exception.new(\"Could not fast-forward sync #{a.name} with #{b.name}\")\n else\n if local_branches.key? name\n if repo.descendant_of? local_branches[name].target, max.target\n max.target = local_branches[name].target\n else\n logged_refupdate(repo, local_branches[name], max)\n end\n else\n puts \"Creating branch: #{name} <= #{max.name}\"\n local_branches[name] = repo.branches.create(name, max.target.oid)\n end\n end\n }\n local_branches\n end",
"def get_repository_project_branches(repoName)\n self.log(INFO, repoName, \"Searching for project branches...\")\n branches = []\n b=`git branch -r`\n b.each_line do |remoteBranch|\n remoteBranch.gsub!(/\\n/, \"\")\n if remoteBranch =~ /origin\\/project/\n localBranch = \"#{remoteBranch}\"\n localBranch.slice! \"origin/\"\n branches << localBranch.strip! || localBranch\n end\n end\n self.log(INFO, repoName, \"Project branches found : #{branches}\")\n self.log(INFO, repoName, \"Done.\")\n return branches\n end",
"def pushtobare(branch = 'master')\n remote = satelliterepo.remotes['bare']\n remote = satelliterepo.remotes.create 'bare', barerepo.path unless remote\n satelliterepo.push remote, [\"refs/heads/#{branch}\"]\n end",
"def pushtobare(branch = 'master')\n remote = satelliterepo.remotes['bare']\n remote = satelliterepo.remotes.create 'bare', barerepo.path unless remote\n satelliterepo.push remote, [\"refs/heads/#{branch}\"]\n end",
"def push_all!(args)\n collection_modifier_update('$pushAll', args)\n end",
"def needs_push(payloads=[])\n return true if payloads.empty?\n return true if push_mode==PUSHMODE_MIRROR\n \n refspec_parse = explicit_refspec.match(/^\\+?([^:]*)(:[^:]*)?$/)\n payloads.each do |payload|\n if splitpath = refcomp_parse(payload[:ref])\n return true if payload[:ref] == refspec_parse[1] # Explicit Reference Spec complete path\n return true if splitpath[:name] == refspec_parse[1] # Explicit Reference Spec no type\n return true if include_all_branches && splitpath[:type] == \"heads\"\n return true if include_all_tags && splitpath[:type] == \"tags\"\n end\n end\n false\n end",
"def alert_if_needs_pushing(dir = Dir.pwd)\n Dir.chdir(dir) {puts \"WARNING: #{dir} needs to be pushed to remote origin\" if needs_pushing? }\nend",
"def push\n if @tags.empty?\n gash.send(:git, 'push', @push_to, @refspec)\n else\n gash.send(:git, 'push', '--tags', @push_to, @refspec)\n end\n end",
"def push\n unless system(\"cd #{repo_path};git push origin #{branch}\")\n raise GitCloud::GitException.new(\"Push\")\n end\n end",
"def unmerged_commits?(branch_name, verbose = true)\n locations = []\n locations << ['', ''] if branch_exists?(:local, branch_name)\n locations << ['origin/', 'origin/'] if branch_exists?(:remote, branch_name)\n locations = locations + [['', 'origin/'], ['origin/', '']] if locations.size == 2\n if locations.empty?\n puts 'Nothing to do. All cleaned up already.' if verbose\n return false\n end\n # Compare remote and local branch with remote and local master.\n responses = locations.collect do |location|\n git_call \"cherry #{location.first}#{target_branch} #{location.last}#{branch_name}\"\n end\n # Select commits (= non empty, not just an error message and not only duplicate commits staring with '-').\n unmerged_commits = responses.reject do |response|\n response.empty? or response.include?('fatal: Unknown commit') or response.split(\"\\n\").reject { |x| x.index('-') == 0 }.empty?\n end\n # If the array ain't empty, we got unmerged commits.\n if unmerged_commits.empty?\n false\n else\n puts \"Unmerged commits on branch '#{branch_name}'.\"\n true\n end\n end",
"def clean_local_branch\n run_and_success?(\"#{git} show-branch #{ref} > /dev/null 2>&1 && #{git} branch -D #{ref} > /dev/null 2>&1\")\n end",
"def create_releases_for_branch?(branch)\n release_branch == branch\n end",
"def push_all(pushes)\n view.update_many(\"$push\" => collect_each_operations(pushes))\n end",
"def git_push(*remotes)\n remotes.each do |remote|\n git(:push => \"#{remote} master\")\n end\n end",
"def case_branches(branches)\n branches.select do |branch|\n id == branch.root_id && branch.start_line != start_line\n end\n end",
"def remote_branches(remote)\n run(\"git branch -r\").split(\"\\n\")\n .map { |r| r.chomp.gsub(/^\\s+/, \"\") }\n .select { |r| r[remote] && ! r[\"HEAD\"] }\n .map { |r| r.gsub(\"#{remote}/\", \"\") }\n end",
"def newMet\n puts \"Try to create a new branch and then push it back to remote\"\n end",
"def branches(repo)\n api.branches(repo).index_by(&:name)\n end",
"def is_origin_branch? branch\n branches ||= %x{git branch -r}.split # yeah, slow. should we cache it?\n branches.include? \"origin/#{branch}\"\nend",
"def add_commits_in_branch branch_name\n array_output_of(\"git log #{branch_name} --format='%h|%s|%an <%ae>' --topo-order --reverse\").each do |commit|\n sha, message, author = commit.split('|')\n next if message == 'Initial commit'\n @commit_list.add sha: sha, message: message, branch_name: branch_name, author: author\n end\n @commit_list\n end",
"def branch(group:nil)\n case group\n when :remote\n flag = \"-r\"\n when :all\n flag = \"-a\"\n when nil, :local\n flag = \"\"\n end\n\n `git branch #{flag}`.lines.map do |line|\n fields = line.split\n\n if fields.first['*']\n fields[1].strip\n else\n fields.first.strip\n end\n end\nend",
"def git_push_origin\n ErrorEmittingExecutor.execute(\"git push origin -u #{BRANCH_NAME}\")\nend",
"def branch; end",
"def confirm_push(repo_name, branch_name)\n stdout.out_success(\"\\nShowing last #{settings['git_log_number_of_lines']} lines of Repo '#{repo_name}', Branch '#{branch_name}' log\\n\")\n stdout.out git.show_git_log(settings['git_log_number_of_lines'])\n stdout.out_success(\"#{context_prompt} Confirm push of Repo '#{repo_name}', Branch '#{branch_name}' to Origin? [y/N]\")\n gets.chomp.upcase == 'Y'\n end",
"def intra_branch?(pr_id)\n q = <<-QUERY\n select IF(base_repo_id = head_repo_id, true, false) as intra_branch\n from pull_requests where id = ?\n QUERY\n if_empty(db.fetch(q, pr_id).all, :intra_branch)\n end",
"def has_remote_tracking_branch(repo)\n return false if $branch_name.empty?\n\n begin\n return !repo.branches[$remote_branch].nil?\n rescue\n return false\n end\nend",
"def checkout(branch_name)\n local_branches = @rugged_repository.branches.each_name.to_a\n if !local_branches.include?(branch_name) && self.remote_branch_from_local(branch_name)\n @rugged_repository.branches.create(branch_name, self.remote_branch_from_local(branch_name))\n end\n @rugged_repository.checkout(branch_name)\n end",
"def pull_on_operand_branch *args\n self.on_operand_branch :pull, *args\n end",
"def git_branches(git)\n array = Array.new\n body = raw_file(http_uri + git)\n body.scan(/\" title=\".*>(.*)<\\/a><\\/li>/) do |branch|\n array << branch\n end\n array.flatten\n end",
"def in_branch(name, &block)\n previous_branch = current_branch\n\n if name != previous_branch\n git \"branch\", name unless branches.include?(name)\n git \"checkout\", name\n end\n \n yield\n rescue StandardError\n STDERR.puts $!\n raise\n ensure\n unless current_branch == previous_branch\n git \"reset\", \"--hard\"\n git \"checkout\", previous_branch\n end\n end",
"def branch\n if request.args.first == \"list\"\n request.args[1]\n else\n request.args.first\n end\n end",
"def delete_branches(github_branches)\n logger.info \"Current Github Branches: #{github_branches}\"\n project.branches.find_each do |branch|\n next if github_branches.include?(branch.name)\n logger.info \"Deleting #{branch.name}\"\n branch.destroy\n end\n end",
"def reset_invalid_branches_to(default_branch = 'master')\n switched_packages = Array.new\n Autoproj.manifest.each_package_definition do |pkg_def|\n pkg = pkg_def.autobuild\n next if !pkg.importer.kind_of?(Autobuild::Git)\n next if pkg.importer.branch == default_branch\n\n flavors = find_all_flavors_by_branch(pkg.importer.branch)\n if !flavors.empty? && !flavors.any? { |flv| flv.include?(pkg.name) }\n vcs_raw = pkg_def.vcs.raw.reverse.\n map do |entry|\n if entry.kind_of?(Array)\n entry[1]\n else\n entry.vcs\n end\n end.\n find { |vcs_options| vcs_options['branch'] }\n if !vcs_raw || vcs_raw['branch'] !~ /ROCK_FLAVOR|ROCK_BRANCH/\n switched_packages << [pkg, pkg.importer.branch]\n end\n pkg.importer.branch = default_branch\n end\n end\n switched_packages\n end",
"def push_to_server(local_branch, remote_branch, opts = {})\n if opts[:local]\n logger.debug('Not pushing to the server because the user selected local-only.')\n elsif not has_a_remote?\n logger.debug('Not pushing to the server because there is no remote.')\n elsif local_branch == config.master_branch\n logger.warn('Not pushing to the server because the current branch is the mainline branch.')\n else\n opts[:prepush].call if opts[:prepush]\n\n push(remote.name, local_branch, remote_branch, :force => opts[:force])\n\n opts[:postpush].call if opts[:postpush]\n end\n end",
"def pullFromGitRemotes(branch)\n remotes = `git remote`.split(\"\\n\")\n remotes.each do |remote|\n remote.chomp!\n UI.important(\"Pulling #{branch} from remote: #{branch}\\\"\")\n sh(\"git pull --no-edit #{remote} #{branch}\")\n end\nend",
"def post_receive_payloads(refs, project=nil)\n\t\tproject ||= @project\n\t\tpayloads = []\n\t\trefs.each do |ref|\n\t\t\toldhead, newhead, refname = ref.split(',')\n\n\t\t\t# Only pay attention to branch updates\n\t\t\tnext if not refname.match(/refs\\/heads\\//)\n\t\t\tbranch = refname.gsub('refs/heads/', '')\n\n\t\t\tif newhead.match(/^0{40}$/)\n\t\t\t\t# Deleting a branch\n\t\t\t\tGitHosting.logger.debug \"Deleting branch \\\"#{branch}\\\"\"\n\t\t\t\tnext\n\t\t\telsif oldhead.match(/^0{40}$/)\n\t\t\t\t# Creating a branch\n\t\t\t\tGitHosting.logger.debug \"Creating branch \\\"#{branch}\\\"\"\n\t\t\t\trange = newhead\n\t\t\telse\n\t\t\t\trange = \"#{oldhead}..#{newhead}\"\n\t\t\tend\n\n\t\t\trevisions_in_range = %x[#{GitHosting.git_exec} --git-dir='#{GitHosting.repository_path(project)}' rev-list --reverse #{range}]\n\t\t\t#GitHosting.logger.debug \"Revisions in Range: #{revisions.split().join(' ')}\"\n\n\t\t\tcommits = []\n\t\t\trevisions_in_range.split().each do |rev|\n\t\t\t\trevision = project.repository.find_changeset_by_name(rev.strip)\n\t\t\t\tcommit = {\n\t\t\t\t\t:id => revision.revision,\n\t\t\t\t\t:url => url_for(:controller => \"repositories\", :action => \"revision\", \n\t\t\t\t\t\t:id => project, :rev => rev, :only_path => false, \n\t\t\t\t\t\t:host => Setting['host_name'], :protocol => Setting['protocol']\n\t\t\t\t\t),\n\t\t\t\t\t:author => {\n\t\t\t\t\t\t:name => revision.committer.gsub(/^([^<]+)\\s+.*$/, '\\1'),\n\t\t\t\t\t\t:email => revision.committer.gsub(/^.*<([^>]+)>.*$/, '\\1')\n\t\t\t\t\t},\n\t\t\t\t\t:message => revision.comments,\n\t\t\t\t\t:timestamp => revision.committed_on,\n\t\t\t\t\t:added => [],\n\t\t\t\t\t:modified => [],\n\t\t\t\t\t:removed => []\n\t\t\t\t}\n\t\t\t\trevision.changes.each do |change|\n\t\t\t\t\tif change.action == \"M\"\n\t\t\t\t\t\tcommit[:modified] << change.path\n\t\t\t\t\telsif change.action == \"A\"\n\t\t\t\t\t\tcommit[:added] << change.path\n\t\t\t\t\telsif change.action == \"D\"\n\t\t\t\t\t\tcommit[:removed] << change.path\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tcommits << commit\n\t\t\tend\n\n\t\t\tpayloads << {\n\t\t\t\t:before => oldhead,\n\t\t\t\t:after => newhead,\n\t\t\t\t:ref => refname,\n\t\t\t\t:commits => commits,\n\t\t\t\t:repository => {\n\t\t\t\t\t:description => project.description,\n\t\t\t\t\t:fork => false,\n\t\t\t\t\t:forks => 0,\n\t\t\t\t\t:homepage => project.homepage,\n\t\t\t\t\t:name => project.identifier,\n\t\t\t\t\t:open_issues => project.issues.open.length,\n\t\t\t\t\t:owner => {\n\t\t\t\t\t\t:name => Setting[\"app_title\"],\n\t\t\t\t\t\t:email => Setting[\"mail_from\"]\n\t\t\t\t\t},\n\t\t\t\t\t:private => !project.is_public,\n\t\t\t\t\t:url => url_for(:controller => \"repositories\", :action => \"show\", \n\t\t\t\t\t\t:id => project, :only_path => false, \n\t\t\t\t\t\t:host => Setting[\"host_name\"], :protocol => Setting[\"protocol\"]\n\t\t\t\t\t),\n\t\t\t\t\t:watchers => 0\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\t\tpayloads\n\tend",
"def push(args, create_upstream: nil)\n args = args.dup + ['--set-upstream', create_upstream, branch] if create_upstream\n execute_git_output('push', args)\n $?.exitstatus == 0 || (create_upstream && $?.exitstatus == 128)\n end",
"def create_branch\n check_current_repo\n exists = `git branch --list #{branch}`.squish == branch\n if exists\n `git checkout #{branch}`\n else\n `git checkout master` unless current_branch == 'master'\n `git checkout -b #{branch}`\n end\nend",
"def git_pull\n if `git branch -a` =~ /remotes\\/#{@remote}\\/#{@branch}/ ||\n `git ls-remote #{@remote}` =~ /refs\\/heads\\/#{@branch}/\n `git pull #{@remote} #{@branch}`\n end\n end",
"def push(arg='')\n `git push #{arg} 2>&1`\n end",
"def update!(**args)\n @remote_branch = args[:remote_branch] if args.key?(:remote_branch)\n end",
"def branch(branch)\n all.select { |r| r.branch == branch }\n end",
"def prune(options={})\n puts describe_prune(options)\n\n puts \"Fetching latest branches and tags from remotes\"\n @git.fetch_all(:prune => true)\n\n branches = @git.branches(:all => true)\n\n #Filter by name prefix\n branches = branches.select { |x| x =~ options[:only] } if options[:only]\n branches = branches.reject { |x| x =~ options[:except] } if options[:except]\n\n #Filter by location (local/remote)\n if options[:local] && !options[:remote]\n branches = branches.local\n elsif options[:remote] && !options[:local]\n branches = branches.remote\n elsif options[:remote] && options[:local]\n raise ArgumentError, \"Cannot specify both --local and --remote!\"\n end\n\n #Filter by merge status\n if options[:merged]\n puts \"Checking merge status of #{branches.size} branches; please be patient\"\n branches = branches.merged(options[:merged])\n end\n\n old = {}\n branches.each do |branch|\n latest = @git.log(branch, :tail => 1).first\n timestamp = latest.timestamp\n if timestamp < options[:age] &&\n old[branch] = timestamp\n end\n end\n\n if old.empty?\n STDERR.puts \"No branches found; try different options\"\n exit -2\n end\n\n puts\n\n all_by_prefix = branches.group_by { |b| b.name.split(NAME_SPLIT_CHARS).first }\n\n all_by_prefix.each_pair do |prefix, branches|\n old_in_group = branches.select { |b| old.key?(b) }\n next if old_in_group.empty?\n old_in_group = old_in_group.sort { |a, b| old[a] <=> old[b] }\n puts prefix\n puts '-' * prefix.length\n old_in_group.each do |b|\n puts \"\\t\" + b.display(40) + \"\\t\" + time_ago_in_words(old[b])\n end\n puts\n end\n\n unless options[:force]\n return unless prompt(\"Delete all #{old.size} branches above?\", true)\n end\n\n old.each do |branch, timestamp|\n branch.delete\n puts \" deleted #{branch}\"\n end\n end",
"def apply\n repo.push('origin', ['refs/heads/master'], credentials: credentials)\n end",
"def get_merged(br)\n __branches \"-l --merged #{br}\"\nend",
"def change_git!\n @jobs.each_value do |job|\n job[:value][:scm_branch] = \"origin/pr/#{@number}/head\"\n job[:value][:scm_params] = {} unless job[:value][:scm_params]\n job[:value][:scm_params][:refspec] = 'refs/pull/*:refs/remotes/origin/pr/*'\n end\n end",
"def push\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_push_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} push origin master\"\n log.info(x) { \"[git] push command => #{git_push_cmd}\" }\n system git_push_cmd\n log.info(x) { \"[git] has pushed outstanding commit bundles to the remote backend repository.\" }\n\n end"
] |
[
"0.6731136",
"0.6482574",
"0.6482574",
"0.64637566",
"0.6429163",
"0.6423178",
"0.64213234",
"0.64163744",
"0.6391438",
"0.634921",
"0.63319963",
"0.63281703",
"0.63084906",
"0.6307754",
"0.62680304",
"0.6261009",
"0.6246311",
"0.62373775",
"0.6233716",
"0.6227596",
"0.6211071",
"0.6181104",
"0.6178768",
"0.6145156",
"0.6119719",
"0.61173964",
"0.6115633",
"0.60988975",
"0.608665",
"0.6085001",
"0.6081424",
"0.6046592",
"0.6036415",
"0.6025361",
"0.6016012",
"0.60036635",
"0.59910965",
"0.5980868",
"0.59765404",
"0.59487796",
"0.5940632",
"0.5913396",
"0.5898034",
"0.58929044",
"0.5840249",
"0.58240354",
"0.5797128",
"0.57862246",
"0.5784614",
"0.5777627",
"0.57702047",
"0.5768466",
"0.57578045",
"0.57487166",
"0.5747855",
"0.5746078",
"0.5733287",
"0.5733287",
"0.57223165",
"0.57167363",
"0.5701808",
"0.5694089",
"0.56725603",
"0.5662634",
"0.5659572",
"0.5653912",
"0.5652615",
"0.565229",
"0.56377065",
"0.56165403",
"0.5605892",
"0.56045353",
"0.5594218",
"0.5592787",
"0.5591457",
"0.5590122",
"0.5583176",
"0.5569703",
"0.5569193",
"0.5568745",
"0.55582887",
"0.555335",
"0.55362827",
"0.5530222",
"0.55281806",
"0.55249643",
"0.55158734",
"0.5509895",
"0.5503574",
"0.5488933",
"0.5482436",
"0.5473689",
"0.5466898",
"0.54661787",
"0.5464898",
"0.5463692",
"0.5460374",
"0.545522",
"0.54515105",
"0.5440044",
"0.54370695"
] |
0.0
|
-1
|
Boolean check on verbosity
|
def is_verbose?
options.include?("-v")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def verbose?() @opts.verbose?; end",
"def verbose?\n options && options[:verbosity] && options[:verbosity] > 0\n end",
"def verbosity\n runopts(:verbosity) || 1\n end",
"def really_verbose\n case verbose\n when true, false, nil then\n false\n else\n true\n end\n end",
"def verbose?\n @verbose\n end",
"def verbosity\n options[:verbosity] || NONE\n end",
"def verbose?\n options[:verbose]\n end",
"def verbose?\n @options[:verbose]\n end",
"def verbose?\n @verbose\n end",
"def verbose?\n @verbose_output\n end",
"def verbose?\n options.verbose?\n end",
"def verbosity\n get_value :verbosity\n end",
"def verbose_mode?\n @output_level == :verbose\n end",
"def verbose\n false\n end",
"def verbose?\n @options.verbose\n end",
"def verbose?\n @options.verbose\n end",
"def verbose?\n @verbose ||= !!options[:verbose]\n end",
"def verbose?\n @options[:verbose]\n end",
"def verbose?\n @config.verbose?\n end",
"def verbose?\n @run_verbose ||= nil\n end",
"def verbose?\n if @@verbose == true\n return \"Verbose output to console has been enabled.\"\n elsif @@verbose == false\n return \"Verbose output to console has not been enabled\"\n end\n\n end",
"def verbose\n @verbose || false\n end",
"def verbose?\n ENV['VERBOSE']\n end",
"def verbose?\n !!ENV[\"DEBUG\"]\nend",
"def verbose?\n @default_options[ :verbose ]\n end",
"def quiet\n @verbosity.zero?\n end",
"def quiet\n @verbosity.zero?\n end",
"def informational?\n severity == 0\n end",
"def verbose(max_level = false)\n #logger.unknown \"Rack::Insight::Logging.verbosity: #{Rack::Insight::Logging.verbosity} <= max_level: #{VERBOSITY[max_level]}\" #for debugging the logger\n return false if (!verbosity) # false results in Exactly Zero output!\n return true if (verbosity == true) # Not checking truthy because need to check against max_level...\n # Example: if configured log spam level is high (1) logger should get all messages that are not :debug (0)\n # so, if a log statement has if verbose(:low) (:low is 3)\n # 1 <= 3 # true => Message sent to logger\n # then, if a log statement has if verbose(:debug) (:debug is 0)\n # 1 <= 0 # false => Nothing sent to logger\n return true if verbosity <= (Rack::Insight::Config::VERBOSITY[max_level]) # Integers!\n end",
"def should_print?\n !@suppress_output\n end",
"def verbose(true_or_false = true)\n @_verbose = true_or_false\n EtherShell::ShellDsl.nothing\n end",
"def verbose?\n verbose = ENV['VERBOSE']\n verbose && verbose =~ /^true$/i ? true : false\n end",
"def verbosity (value = nil)\n\t\tif value\n\t\t\traise_if_error C.glyr_opt_verbosity(to_native, value)\n\t\telse\n\t\t\tto_native[:verbosity]\n\t\tend\n\tend",
"def options_ok?\n end",
"def quiet= bool\n @verbosity = bool ? 0 : 1\n end",
"def verbose_mode?\n if Rake.respond_to?(:verbose)\n # Rake 0.9.x\n Rake.verbose == true\n else\n # Rake 0.8.x\n RakeFileUtils.verbose_flag != :default\n end\n end",
"def display_bar?\n !@options['debug'] && !@options['silent']\n end",
"def verbose; @config[:verbose]; end",
"def setVerbosity(v)\n @verbose = v\n end",
"def set_verbosity\n @@option_debug = options[:debug] ? true : false\n @@option_verbose = options[:verbose] || options[:debug] ? true : false\n end",
"def set_verbosity\n @@option_debug = (options[:debug]) ? true : false\n @@option_verbose = (options[:verbose] || options[:debug]) ? true : false\n end",
"def ok_enabled?\r\n return true\r\n end",
"def ok_enabled?\n true\n end",
"def verbose_option\n !!jekyll_sass_configuration.fetch(\"verbose\", false)\n end",
"def passed?\n config.threshold.nil? ||\n (config.threshold_must_match && percent == config.threshold) ||\n percent >= config.threshold\n end",
"def show_log?\n @runopts[:show_log] ||= false\n end",
"def verbose!\n @verbose = true\n end",
"def view_with_check_option_support\n true\n end",
"def descriptively_ok?\n acceptance & DESCRIPTIVE == DESCRIPTIVE\n end",
"def say(message, importance=nil)\n display = \\\n case self.verbosity\n when true\n true\n when nil\n importance != false\n else\n importance == true\n end\n\n if display\n puts message\n end\n end",
"def info?; @level <= INFO; end",
"def info?; @level <= INFO; end",
"def verbose(string_to_output)\n puts string_to_output if $verbose\nend",
"def has_argument_variations?\n @variations.size > 1\n end",
"def debug?\n @level <= 0\n end",
"def low?\n severity == 1\n end",
"def verbose(m)\n $stderr.puts(m) if $verbose\nend",
"def info?\n @level <= 1\n end",
"def medium?\n severity == 2\n end",
"def silence_mode?\n @output_level == :silence\n end",
"def verbose\n \"-q\"\n end",
"def verbose\n return unless ENV['VER'] && !@hide_inside\n str = type?(yield, String)\n msg = __make_msg(str)\n return unless ___chk_ver(msg) || (@enclosed ||= []).any?\n __prt_lines(msg)\n true\n end",
"def verbose?\n if @verbose.nil?\n if @io.kind_of?(ReidlineInputMethod)\n false\n elsif defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod)\n false\n elsif !STDIN.tty? or @io.kind_of?(FileInputMethod)\n true\n else\n false\n end\n else\n @verbose\n end\n end",
"def verbose(tf=true)\n @verbose = tf\n end",
"def prescriptively_ok?\n acceptance & PRESCRIPTIVE == PRESCRIPTIVE\n end",
"def super_effective?\n @effectiveness >= 2\n end",
"def assertive?\n true\n end",
"def not_affective?\n @effectiveness == 0\n end",
"def debug?; @level <= DEBUG; end",
"def debug?; @level <= DEBUG; end",
"def unstable?\n harm > 3\n end",
"def info?\n severity == :INFO\n end",
"def tracing?\n\n\t\tseverity_logged? :trace\n\tend",
"def notice?\n severity == :NOTICE\n end",
"def debug?\n\t\t!!@debuggable_status\n\tend",
"def not_very_effective?\n @effectiveness > 0 && @effectiveness < 1\n end",
"def verbose_logging; end",
"def increase_verbosity\n if severity > -1 then\n self.severity -= 1\n if trace? then\n $DEBUG = true\n end\n end\n end",
"def complain_about_bad_flags?\n @complain_about_bad_flags\n end",
"def warning?\n severity == :WARNING\n end",
"def debug?\n severity == :DEBUG\n end",
"def warning?\n false\n end",
"def verbose( text )\n $stderr.puts text if $params[ :verbose ]\nend",
"def verb?\n !verb.nil?\n end",
"def quiet?; run_options[:quiet]; end",
"def arguments_valid?\n # right now, there is no set of invalid arguments.\n # (can I really just say true here? I don't have to return something?)\n true unless (@options.set_status == true and @options.status == nil)\n end",
"def pretend?\n options[:pretend] == true\n end",
"def xtvt_not_dropped_quality?\n ( (is_dropped!= true && half==1 && staff_appraisal.is_skt_endorsed == true) || (_destroy!=true && half==2) ) && ( !indicator_desc_quality.blank? && !target_quality.blank?)\n end",
"def warn?\n @level <= 2\n end",
"def early_option?(args)\n if @options[:version]\n puts(\"boson #{Boson::VERSION}\")\n true\n elsif args.empty? || (@command.nil? && !@options[:execute])\n print_usage\n true\n else\n false\n end\n end",
"def dry_validation?\n @dry_validation ||= @gems.include?(:dry_validation)\n end",
"def default_level?\n experience_points_threshold == 0\n end",
"def warning?\n check_warnings\n end",
"def debug_through?\r\n return false\r\n end",
"def bogus?\n !! self.bogosity\n end",
"def puts_verbose(s = \"\")\n puts s if $VERBOSE\nend",
"def print_or_not(msg, b)\n\t# Use one of the three debug levels and comment the rest\n\n\t# debug_level = @_mi\n\t# debug_level = @_ptable\n\tdebug_level = @_success_factor\n\n\tif (b >= debug_level) then puts msg end\nend",
"def valid_opts\n true\n end",
"def verbose=(value) @verbose = true; end",
"def passing?\n verifiers.each {|v| raise \"Not working\" unless v.passing? }\n end"
] |
[
"0.75735337",
"0.73685026",
"0.73559695",
"0.7303877",
"0.7270917",
"0.7191519",
"0.71663505",
"0.7119162",
"0.71031684",
"0.7069796",
"0.7043617",
"0.7023738",
"0.7001978",
"0.6993639",
"0.69907564",
"0.69907564",
"0.6970506",
"0.696917",
"0.6913088",
"0.6856054",
"0.6810035",
"0.6800971",
"0.6786592",
"0.6783133",
"0.674597",
"0.66965497",
"0.66965497",
"0.6602032",
"0.65569127",
"0.6549153",
"0.6517897",
"0.64803594",
"0.6441176",
"0.63532513",
"0.6239222",
"0.62366277",
"0.6146206",
"0.61351156",
"0.61302984",
"0.6129754",
"0.6127988",
"0.610882",
"0.60775375",
"0.6075414",
"0.6069492",
"0.60402566",
"0.6033161",
"0.6030471",
"0.6015074",
"0.6003138",
"0.5978845",
"0.5978845",
"0.59714293",
"0.5965153",
"0.5961245",
"0.59469956",
"0.5935284",
"0.59324545",
"0.59250605",
"0.5919947",
"0.590558",
"0.589904",
"0.5883983",
"0.5878436",
"0.58683765",
"0.58550227",
"0.5854168",
"0.5844235",
"0.5829935",
"0.5829935",
"0.582939",
"0.58119553",
"0.5807828",
"0.5807625",
"0.58033",
"0.579041",
"0.5789671",
"0.5740843",
"0.57329404",
"0.5732394",
"0.5729969",
"0.57294035",
"0.572857",
"0.5702771",
"0.5699254",
"0.56974137",
"0.5695708",
"0.569099",
"0.5689311",
"0.5689042",
"0.5684388",
"0.5683841",
"0.5679821",
"0.56777745",
"0.56743264",
"0.5666643",
"0.56646794",
"0.56589603",
"0.5657639",
"0.56559247"
] |
0.72941124
|
4
|
Rummager does not like really old dates in queries
|
def date_is_not_ancient?(date)
date > Date.new(1900)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def booking_with_furthest_checkin_date\n ActiveRecord::Base.connection.exec_query(custom_sql).collect &:values\nend",
"def statement_to_date\n end",
"def statement_to_date\n end",
"def statement_to_date\n end",
"def reservation_search_received(limit, offset, first_year_date)\n extra_condition = \"WHERE b.creation_date >= ?\"\n repository.adapter.select(query_reservation_search(limit, offset, extra_condition), first_year_date) \n end",
"def date() updated; end",
"def date_clause(table, field, from, to, is_custom_filter)\n s = []\n if from\n if from.is_a?(Date)\n from = date_for_user_time_zone(from.year, from.month, from.day).yesterday.end_of_day\n else\n from = from - 1 # second\n end\n if self.class.default_timezone == :utc\n from = from.utc\n end\n\n ### Patch Start\n if is_custom_filter && self.class.connection.adapter_name.downcase.to_sym == :postgresql && !Rails.env.test?\n s << (\"to_timestamp(#{table}.#{field},'DD/MM/YYYY HH24:MI') > to_timestamp('%s','DD/MM/YYYY HH24:MI')\" % [quoted_time(from, is_custom_filter)])\n else\n if Rails.env.test? || table.classify.constantize.columns_hash[field].type == :date || table.classify.constantize.columns_hash[field].type == :datetime\n s << (\"#{table}.#{field} > '%s'\" % [quoted_time(from, is_custom_filter)])\n else\n s << (\"STR_TO_DATE(#{table}.#{field},'%d/%m/%Y') > STR_TO_DATE('\" + quoted_time(from, is_custom_filter) + \"','%d/%m/%Y')\")\n end\n end\n ### Patch End\n\n end\n if to\n if to.is_a?(Date)\n to = date_for_user_time_zone(to.year, to.month, to.day).end_of_day\n end\n if self.class.default_timezone == :utc\n to = to.utc\n end\n\n ### Patch Start\n if is_custom_filter && self.class.connection.adapter_name.downcase.to_sym == :postgresql && !Rails.env.test?\n s << (\"to_timestamp(#{table}.#{field},'DD/MM/YYYY HH24:MI') <= to_timestamp('%s','DD/MM/YYYY HH24:MI')\" % [quoted_time(to, is_custom_filter)])\n else\n if Rails.env.test? || table.classify.constantize.columns_hash[field].type == :date || table.classify.constantize.columns_hash[field].type == :datetime\n s << (\"#{table}.#{field} <= '%s'\" % [quoted_time(to, is_custom_filter)])\n else\n s << (\"STR_TO_DATE(#{table}.#{field},'%d/%m/%Y') <= STR_TO_DATE('\" + quoted_time(to, is_custom_filter) + \"','%d/%m/%Y')\")\n end\n end\n ### Patch End\n\n end\n s.join(' AND ')\n end",
"def to_date()\n #This is a stub, used for indexing\n end",
"def resource_reservations(date_from, date_to, stock_plate_or_reference)\n\n BookingDataSystem::Booking.by_sql { |b| \n [select_resource_reservations(b), stock_plate_or_reference, stock_plate_or_reference,\n date_from, date_from, \n date_to, date_to,\n date_from, date_to,\n date_from, date_to ] }.all(order: :date_from) \n\n end",
"def interesting_date\n marked_as_fast_growing_at\n end",
"def test_date_value\n row = SqlRow.new(SqlRowType.new('table', :id => :integer, :text => :date))\n row[:text] = Date.parse('2015-01-01')\n assert_equal \"'2015-01-01'\", row.sql_for(:text, :postgresql)\n end",
"def get_date_solr_query(p = {})\n times = get_times(p)\n registered_only?(p) ? '' : \"AND #{Last_Changed_Field}:[\\\"#{times[:first]}\\\" TO \\\"#{times[:last]}\\\"]\" # unless the user has asked for only registered items, apply the date range for published date\n end",
"def future(query_date = Date.current)\n klass.where(\n future_condition(query_date: query_date, table: arel_table),\n )\n end",
"def perform_date_param(date, relation = self)\n begin\n date = date.to_date\n rescue => e\n date = Date.today\n end\n relation = relation.where(created_at: date.beginning_of_day..date.end_of_day)\n relation\n end",
"def more_advanced_date\n \tnil\n end",
"def updated_date\n extractor = MarcExtractor.new(\"907b\", :first => true)\n lambda do |record, acc|\n datestr = extractor.extract(record).first\n begin\n date = Date.strptime(datestr, \"%m-%d-%y\")\n acc << solr_date(date)\n rescue ArgumentError\n yell.debug \"Unable to parse datestr #{datestr}\"\n end\n end\n end",
"def __evolve_date__\n __evolve_range_naive__.transform_values! {|v| v&.__evolve_date__ }\n end",
"def dates\n dates_query.all\n end",
"def test_28day_mo\n Charges.new(Date.new(2011,02,15),\n Date.new(2011,03,15),\n\t\t1, 1, 20)\n charges = Charge.find_all_by_reservation_id 20\n assert_equal 1, charges.size\n assert_equal 1, charges[0].season_id\n assert_equal Date.new(2011,02,15), charges[0].start_date\n assert_equal Date.new(2011,03,15), charges[0].end_date\n assert_equal 1.0, charges[0].period.to_f\n assert_equal 288.0, charges[0].rate.to_f\n assert_equal 288.0, charges[0].amount.to_f\n assert_equal 0.0, charges[0].discount.to_f\n assert_equal Charge::MONTH, charges[0].charge_units\n end",
"def snapshots_redact_sql_queries; end",
"def read_date; end",
"def date; raw_changeset.time; end",
"def migrate_learned_dates\n repetitions_for_learned_flashcards = Flashcard.unscoped do\n Flashcard.learned.joins(:repetitions).select(\"flashcards.id AS id, repetitions.actual_date AS actual_date\").order(\"actual_date DESC\")\n end\n ids = []\n repetitions_for_learned_flashcards.each do |r|\n id = r.id.to_i\n if !ids.include?(id)\n ids += [id]\n flashcard = Flashcard.find(id)\n flashcard.learned_on = r.actual_date\n flashcard.save!\n end\n end\n end",
"def metadataCompareDate(type_id, value, tempArray)\n comparison = \"=\"\n if value[-1..-1] == '>' # bigger\n value = value[0..-2]\n comparison = \">\"\n \n elsif value[-1..-1] == '<' # smaller\n value = value[0..-2]\n comparison = \"<\"\n \n elsif value[-1..-1] == '=' && value[-2..-1] == '>=' # min\n value = value[0..-3]\n comparison = \">=\"\n \n elsif value[-1..-1] == '=' && value[-2..-1] == '<=' # max\n value = value[0..-3]\n comparison = \"<=\"\n \n end\n\n # If value is full datetime, use it as it is\n if QueryController::check_datetime(value)\n datetimeOrDate = \"CONVERT(value, DATETIME)#{comparison}'#{value}'\"\n else\n\n # If searching with year and month\n if value =~ /^\\d{4}\\-\\d{1,2}$/\n # First day of month\n valueFirst = value+'-01'\n \n # Date in this exact month\n if comparison == '='\n datetimeOrDate = \"CONVERT(value, DATE)>='#{valueFirst}' AND CONVERT(value, DATE)<=LAST_DAY('#{valueFirst}')\"\n \n # Date bigger than this month\n elsif comparison == '>'\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}LAST_DAY('#{valueFirst}')\"\n\n # Date max this month\n elsif comparison == '<='\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}LAST_DAY('#{valueFirst}')\"\n \n # Date smaller than this month\n elsif comparison == '<'\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}'#{valueFirst}'\"\n \n # Date min this month\n elsif comparison == '>='\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}'#{valueFirst}'\"\n end\n \n\n \n # If searching with only year\n elsif value =~ /^\\d{4}$/\n datetimeOrDate = \"YEAR(value)#{comparison}'#{value}'\"\n else\n\n # Check if value_number is date and convert it if needed\n valueNew = QueryController::transform_date(value)\n if valueNew == false\n raise Exception.new(\"Invalid date value\")\n end\n datetimeOrDate = \"CONVERT(value, DATE)#{comparison}'#{valueNew}'\"\n end\n \n \n end\n\n sql = \"SELECT id, value, devfile_id, metadata_type_id\" +\n \" FROM metadatas\" +\n \" WHERE metadata_type_id = #{type_id} AND #{datetimeOrDate}\"\n puts sql\n tmps = Metadata.find_by_sql(sql) \n \n if tmps != nil\n tmps.each do |x|\n tempArray.push(x.devfile_id)\n end\n end\n end",
"def renew_date(user)\n # days = ((DateTime.now + 2.months) - DateTime.now).to_i\n output = {}\n output[:sp] = Smartphone.where(id: user[\"smartphone_id\"]).first[:renovation_at] unless !user[\"smartphone_id\"]\n if !output[:sp].present? then output.delete(:sp) else output[:sp].to_datetime end\n output[:sp] = output[:sp].to_datetime unless !output[:sp]\n output[:bam] = Bam.where(id: user[\"bam_id\"]).first[:renovation_at] unless !user[\"bam_id\"]\n if !output[:bam].present? then output.delete(:bam) else output[:bam].to_datetime end\n return output\n end",
"def lifts_by_date(db, date)\n db.execute(\"SELECT * FROM lifts WHERE date = '#{date}'\")\nend",
"def perform_date_param(date, relation = self)\n date = date.to_date\n if date <= Date.today\n start_from = DateTime.now + MIN_TIME_BEFORE_MATCH_START\n else\n start_from = date.beginning_of_day\n end\n relation = relation.where(start_at: start_from..date.end_of_day)\n relation\n end",
"def generate_date_query_argument(date = date_parsed)\n if created_at?\n \"created_at BETWEEN '#{date.midnight}' AND '#{date.end_of_day}'\"\n elsif updated_at?\n \"updated_at BETWEEN '#{date.midnight}' AND '#{date.end_of_day}'\"\n end\n end",
"def resolve_date(date)\n ModernTimesDatabase::Dates[date]\n end",
"def test_property_created_date\n assert_kind_of(DateTime, @all_basic.entries.first.created_date)\n\n arg_filtered = @all_basic.where(created_date: DateTime.parse('2017-10-27T17:58:00Z'))\n assert_equal(1, arg_filtered.entries.count)\n assert arg_filtered.access_key_ids.first.end_with?('BOB')\n\n block_filtered = @all_basic.where { created_date.friday? }\n assert_equal(1, block_filtered.entries.count)\n assert block_filtered.access_key_ids.first.end_with?('BOB')\n end",
"def new_query\n @min_date, @max_date = PlateTube.find_min_and_max_dates\n @oligo_usages = PlatePosition::OLIGO_USAGE.invert.to_a.sort.insert(0,'(All)') \n end",
"def groupby_date(query, period: \"month\", column: \"updated_at\")\n query.group(\"DATE_TRUNC('#{period}', #{column})\").count.sort_by { |key, _v| key || Time.utc(1900) }.to_h\nend",
"def for(date)\n where(actual_date: date)\n end",
"def query(date_string)\n { created_at: date_string.to_date.beginning_of_day..date_string.to_date.end_of_day }\n end",
"def requires_sql_standard_datetimes?\n true\n end",
"def test_property_last_used_date\n assert_kind_of(NilClass, @all_basic.entries[0].last_used_date)\n assert_kind_of(DateTime, @all_basic.entries[1].last_used_date)\n\n arg_filtered = @all_basic.where(last_used_date: DateTime.parse('2017-10-27T17:58:00Z'))\n assert_equal(1, arg_filtered.entries.count)\n assert arg_filtered.access_key_ids.first.end_with?('SALLY')\n\n block_filtered = @all_basic.where { last_used_date and last_used_date.friday? }\n assert_equal(1, block_filtered.entries.count)\n assert block_filtered.access_key_ids.first.end_with?('SALLY')\n end",
"def to_date\n find\n end",
"def view_all_date(db)\n db.execute(\"SELECT * FROM lifts ORDER BY date DESC\")\nend",
"def solr_date(date)\n return Time.utc(date.year, date.mon, date.mday).iso8601()\nend",
"def solr_date(date)\n return Time.utc(date.year, date.mon, date.mday).iso8601()\nend",
"def normalize_date_from\n\t\t\t\t\tstart = RicSeason.start\n\t\t\t\t\tif start\n\t\t\t\t\t\tif self.period.to_sym == :year\n\t\t\t\t\t\t\tfirst_day = Date.parse(\"#{self.from.cwyear}-#{start}\")\n\t\t\t\t\t\t\tif self.from < first_day\n\t\t\t\t\t\t\t\tself.from = first_day - 1.year\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tself.from = first_day\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telsif self.period.to_sym == :month\n\t\t\t\t\t\t\tfirst_day = Date.parse(\"#{self.from.cwyear}-#{self.from.month}-#{start}\")\n\t\t\t\t\t\t\tif self.from < first_day\n\t\t\t\t\t\t\t\tself.from = first_day - 1.month\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tself.from = first_day\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend",
"def test_30day_mo_plus\n Charges.new(Date.new(2011,11,26),\n Date.new(2011,12,31),\n\t\t1, 1, 20)\n charges = Charge.find_all_by_reservation_id 20\n assert_equal 2, charges.size\n assert_equal 1, charges[0].season_id\n assert_equal 1, charges[1].season_id\n assert_equal Date.new(2011,11,26), charges[0].start_date\n assert_equal Date.new(2011,12,26), charges[0].end_date\n assert_equal Date.new(2011,12,26), charges[1].start_date\n assert_equal Date.new(2011,12,31), charges[1].end_date\n assert_equal 1.0, charges[0].period.to_f\n assert_equal 288.0, charges[0].rate.to_f\n assert_equal 288.0, charges[0].amount.to_f\n assert_equal 0.0, charges[0].discount.to_f\n assert_equal 5.0, charges[1].period.to_f\n assert_equal 12.0, charges[1].rate.to_f\n assert_equal 60.0, charges[1].amount.to_f\n assert_equal 0.0, charges[1].discount.to_f\n assert_equal Charge::MONTH, charges[0].charge_units\n assert_equal Charge::DAY, charges[1].charge_units\n end",
"def date; end",
"def date; end",
"def date; end",
"def date; end",
"def GET_by_date raw_year, raw_month\n year = raw_year.to_i\n month = raw_month.to_i\n year += 2000 if year < 100\n month = 1 if month < 1\n case month\n when 1\n @prev_month = Time.utc(year - 1, 12)\n @next_month = Time.utc(year + 1, 2)\n when 12\n @prev_month = Time.utc(year, 11)\n @next_month = Time.utc(year, 1)\n else\n @prev_month = Time.utc(year, month-1)\n @next_month = Time.utc(year, month+1) \n end\n @date = Time.utc(year, month)\n @news = News.by_published_at(:descending=>true, :startkey=>@next_month, :endkey=>@prev_month)\n render_html_template\n end",
"def prueba\n #onemonthago = \"> \" + Time.now.to_date.to_s\n #self.historiales.count\n query\n end",
"def test_31day_mo\n Charges.new(Date.new(2011,01,15),\n Date.new(2011,02,15),\n\t\t1, 1, 20)\n charges = Charge.find_all_by_reservation_id 20\n assert_equal 1, charges.size\n assert_equal 1, charges[0].season_id\n assert_equal Date.new(2011,01,15), charges[0].start_date\n assert_equal Date.new(2011,02,15), charges[0].end_date\n assert_equal 1.0, charges[0].period.to_f\n assert_equal 288.0, charges[0].rate.to_f\n assert_equal 288.0, charges[0].amount.to_f\n assert_equal 0.0, charges[0].discount.to_f\n assert_equal Charge::MONTH, charges[0].charge_units\n end",
"def get_reminders(date)\r\n d = date_checker(date)\r\n new_date = normalize_date(d)\r\n get = <<-SQL\r\n SELECT * FROM reminders WHERE date = ?\r\n SQL\r\n $DB.execute(get, [new_date])\r\n #puts selected_reminders\r\nend",
"def old_weather_reports(today = Date.today)\n old_days = (4..18).collect {|i| today - i}.collect {|d| \"#{d.year}#{d.month.to_s.rjust(2,'0')}#{d.day.to_s.rjust(2,'0')}\"}\n weather_reports.where(:date => old_days)\n end",
"def now\n without_temporal_condition\n .where(arel_table[:valid_from].eq(nil).or(arel_table[:valid_from].lteq(Time.zone.now)))\n .where(arel_table[:valid_to].eq(nil).or(arel_table[:valid_to].gteq(Time.zone.now)))\n end",
"def bales_query\n material_query.merge(date_query).compact\n end",
"def test_11\n ActiveRecord::Base.logger.debug \"test_11\"\n Charges.new(Date.new(2011,01,01),\n Date.new(2011,02,01),\n\t\t3, 3, 20)\n charges = Charge.find_all_by_reservation_id 20\n assert_equal 2, charges.size\n assert_equal 1, charges[0].season_id\n assert_equal 4.0, charges[0].period.to_f\n assert_equal 132.0, charges[0].rate.to_f\n assert_equal 528.0, charges[0].amount.to_f\n assert_equal 52.8, charges[0].discount.to_f\n assert_equal Charge::WEEK, charges[0].charge_units\n assert_equal 3.0, charges[1].period.to_f\n assert_equal 22.0, charges[1].rate.to_f\n assert_equal 66.0, charges[1].amount.to_f\n assert_equal 6.6, charges[1].discount.to_f\n assert_equal Charge::DAY, charges[1].charge_units\n end",
"def isDataUpToDate?\n DailyNews.first.updated_at.to_s.slice(5..6).eql? Time.now.to_s.slice(8..9)\n end",
"def read_date=(_); end",
"def patrick_stewart_dates\n sql = <<-SQL\n SELECT show_date FROM guests WHERE guest_name = \"Patrick Stewart\";\n SQL\n DB[:conn].execute(sql)\nend",
"def __evolve_date__\n { \"$gte\" => min.__evolve_date__, \"$lte\" => max.__evolve_date__ }\n end",
"def legacy?\n date < Date.new(2014, 06, 06)\n end",
"def index\n query = params[:q]\n date = query.try(:[], :updated_at)\n @search = Dream.search(query.try(:except, :updated_at))\n\n if date.blank?\n @dreams = @search.result\n else\n @dreams = @search.result.updated_after(date)\n end\n end",
"def to_sql\n self.to_datetime.to_sql\n \tend",
"def verify_patchset_9141024_created_date\n patchset = PatchSet.where(code_review_id: 9141024, patchset: 3004).first\n #convert dates to strings for comparison\n if patchset.created.to_s.eql?(\"2012-01-20 23:53:25 UTC\") then \n pass()\n else\n fail(\"Wrong created date on patchset 9141024.\")\n end\n end",
"def warn_invalid_date; end",
"def test_dates_can_be_bound_and_retrieved\r\n call = @interface.prepare_proc(\"begin\r\n :l_date := :i_date;\r\n end;\")\r\n call.execute([Date, nil, :out], Date.new(2012,1,1))\r\n assert_equal(Date.new(2012,1,1), call[1])\r\n assert(call[1].is_a? Date)\r\n end",
"def chain_with_datetime_query(collection, query)\n case query.method.to_s\n when 'between'\n method = if query.field == 'user_created_at'\n :user_signed_up_betw\n elsif query.field == 'interacted_at'\n :interacted_at_betw\n elsif query.field =~ /\\Adashboard:[0-9a-f]+\\Z/\n :dashboard_betw\n end\n\n collection.send(method,\n query,\n query.min_value.in_time_zone(query_set.time_zone),\n query.max_value.in_time_zone(query_set.time_zone)\n )\n when 'lesser_than', 'greater_than'\n beginning_of_that_days_ago = (\n Time.current.in_time_zone(query_set.time_zone) - (query.value.to_i).days\n ).beginning_of_day\n\n method = if query.field == 'user_created_at'\n query.method == 'greater_than' ? :user_signed_up_gt : :user_signed_up_lt\n elsif query.field == 'interacted_at'\n query.method == 'greater_than' ? :interacted_at_gt : :interacted_at_lt\n elsif query.field =~ /\\Adashboard:[0-9a-f]+\\Z/\n query.method == 'greater_than' ? :dashboard_gt : :dashboard_lt\n end\n\n collection.send(method, query, beginning_of_that_days_ago)\n end\n end",
"def date_clause(table, field, from, to)\n s = []\n if from\n from_yesterday = from - 1\n from_yesterday_time = Time.local(from_yesterday.year, from_yesterday.month, from_yesterday.day)\n if self.class.default_timezone == :utc\n from_yesterday_time = from_yesterday_time.utc\n end\n s << (\"#{table}.#{field} > '%s'\" % [connection.quoted_date(from_yesterday_time.end_of_day)])\n end\n if to\n to_time = Time.local(to.year, to.month, to.day)\n if self.class.default_timezone == :utc\n to_time = to_time.utc\n end\n s << (\"#{table}.#{field} <= '%s'\" % [connection.quoted_date(to_time.end_of_day)])\n end\n s.join(' AND ')\n end",
"def reservation_status_then_showdate ; reserved? ? -(showdate.thedate.to_i) : -1.0e15 ; end",
"def use_dates\n @use_dates || true\n end",
"def dates\n end",
"def fix_dates( data )\n\n ## check for missing / no dates \n ## examples\n ## - rubytogether feed @ https://rubytogether.org/news.xml\n data.items.each do |item|\n if item.updated.nil? &&\n item.published.nil?\n ## try to get date from slug in url\n ## e.g. /news/2019-10-17-growing-ruby-together\n if (m=FIX_DATE_SLUG_RE.match( item.url ))\n ## todo/fix: make sure DateTime gets utc (no timezone/offset +000)\n published = DateTime.new( m[:year].to_i(10),\n m[:month].to_i(10),\n m[:day].to_i(10) )\n item.published_local = published\n item.published = published\n end\n end\n end\n\n \n ## check if all updated dates are the same (uniq count is 1)\n ## AND if all published dates are present\n ## than assume \"fake\" updated dates and nullify updated dates\n ## example real-world \"messed-up\" feeds include:\n ## - https://bundler.io/blog/feed.xml\n ## - https://dry-rb.org/feed.xml\n ##\n ## todo/check - limit to atom feed format only - why? why not?\n\n count = data.items.size\n count_published = data.items.reduce( 0 ) {|count,item| count += 1 if item.published; count }\n\n if count == count_published\n uniq_count_updated = 0\n last_updated = nil\n\n data.items.each do |item|\n uniq_count_updated += 1 if item.updated != last_updated\n last_updated = item.updated\n end\n\n if uniq_count_updated == 1\n puts \"bingo!! nullify all updated dates\"\n ## todo/fix: log report updated date fix!!!!\n data.items.each do |item|\n item.updated = nil\n item.updated_local = nil\n end\n end\n end\n end",
"def repealed_on\n repeal_el = repeal\n repeal_el ? Time.parse(repeal_el['date']) : nil\n end",
"def new_query\n @versions = Version.curr_version.order(:id)\n @enzymes = Enzyme::ENZYMES_WO_GAPFILL\n end",
"def reservation_search_in_process(limit, offset, today)\n extra_condition = \"WHERE b.status in (2,3) and b.date_from <= ? and date_to >= ?\" \n repository.adapter.select(query_strategy.query_reservation_search(limit, offset, extra_condition), today, today)\n end",
"def rewrite_query # :nodoc:\n if timestamp = compute_mtime\n append_query(timestamp.to_i.to_s)\n end\n end",
"def test_13\n Charges.new(Date.new(2011,04,15),\n Date.new(2011,10,15),\n\t\t4, 1, 20)\n charges = Charge.find_all_by_reservation_id 20\n assert_equal 4, charges.size\n assert_equal 2, charges[0].season_id\n assert_in_delta 1.53, charges[0].period.to_f, 0.005\n assert_equal 370.0, charges[0].rate.to_f\n assert_in_delta 567.32, charges[0].amount.to_f, 0.01\n assert_equal Charge::MONTH, charges[0].charge_units\n assert_equal 3, charges[1].season_id\n assert_in_delta 1.0, charges[1].period.to_f, 0.005\n assert_equal 500.0, charges[1].rate.to_f\n assert_in_delta 500, charges[1].amount.to_f, 0.005\n assert_equal Charge::MONTH, charges[1].charge_units\n assert_equal 4, charges[2].season_id\n assert_in_delta 2.0, charges[2].period.to_f, 0.005\n assert_equal 785.0, charges[2].rate.to_f\n assert_in_delta 1570.0, charges[2].amount.to_f, 0.005\n assert_equal Charge::MONTH, charges[2].charge_units\n assert_equal 5, charges[3].season_id\n assert_in_delta 1.47, charges[3].period.to_f, 0.005\n assert_equal 410.0, charges[3].rate.to_f\n assert_in_delta 601.33, charges[3].amount.to_f, 0.005\n assert_equal Charge::MONTH, charges[3].charge_units\n end",
"def date_clause(table, field, from, to)\n s = []\n if from\n from_yesterday = from - 1\n from_yesterday_utc = Time.gm(from_yesterday.year, from_yesterday.month, from_yesterday.day)\n s << (\"#{table}.#{field} > '%s'\" % [connection.quoted_date(from_yesterday_utc.end_of_day)])\n end\n if to\n to_utc = Time.gm(to.year, to.month, to.day)\n s << (\"#{table}.#{field} <= '%s'\" % [connection.quoted_date(to_utc.end_of_day)])\n end\n s.join(' AND ')\n end",
"def test_09\n ActiveRecord::Base.logger.debug \"test_09\"\n Charges.new(Date.new(2011,01,01),\n Date.new(2011,02,01),\n\t\t1, 2, 20)\n charges = Charge.find_all_by_reservation_id 20\n assert_equal 1, charges.size\n assert_equal 1, charges[0].season_id\n assert_equal 1.0, charges[0].period.to_f\n assert_equal 288.0, charges[0].rate.to_f\n assert_equal 288.0, charges[0].amount.to_f\n assert_equal 28.8, charges[0].discount.to_f\n assert_equal Charge::MONTH, charges[0].charge_units\n end",
"def relative_date_clause(table, field, days_from, days_to)\n date_clause(table, field, (days_from ? Date.today + days_from : nil), (days_to ? Date.today + days_to : nil))\n end",
"def relative_date_clause(table, field, days_from, days_to)\n date_clause(table, field, (days_from ? Date.today + days_from : nil), (days_to ? Date.today + days_to : nil))\n end",
"def query_finances_started_reservations\n\n query = <<-QUERY\n select b.id, booking_item_stock_model, booking_item_stock_plate, b.driver_name, b.driver_surname,\n b.date_from, b.time_from, b.date_to, b.time_to, b.notes, b.total_cost\n from bookds_bookings b\n join bookds_bookings_lines bl on bl.booking_id = b.id\n join bookds_bookings_lines_resources blr on blr.booking_line_id = bl.id\n where b.date_from >= ? and b.date_from <= ? and b.status NOT IN (1,5)\n order by b.id;\n QUERY\n\n end",
"def outdated; end",
"def current(query_date = Date.current)\n klass.where(\n current_condition(query_date: query_date, table: arel_table),\n )\n end",
"def query_from; @mrna.from; end",
"def add_latest_data\n @db = Macroval.find_year_month(2010..2020)\n end",
"def date() self[:date]; end",
"def test_dates_in_query_params_treated_as_strings\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/hello\", log_http_options.deep_merge({\n :params => {\n :date_field => \"2010-05-01\",\n },\n }))\n assert_response_code(200, response)\n record = wait_for_log(response)[:hit_source]\n assert_equal(\"2010-05-01\", record[\"request_query\"][\"date_field\"])\n\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/hello\", log_http_options.deep_merge({\n :params => {\n :date_field => \"2010-05-0\",\n },\n }))\n assert_response_code(200, response)\n record = wait_for_log(response)[:hit_source]\n assert_equal(\"2010-05-0\", record[\"request_query\"][\"date_field\"])\n\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/hello\", log_http_options.deep_merge({\n :params => {\n :date_field => \"foo\",\n },\n }))\n assert_response_code(200, response)\n record = wait_for_log(response)[:hit_source]\n assert_equal(\"foo\", record[\"request_query\"][\"date_field\"])\n end",
"def rely_on_built_at?\n return false if created_at.to_date != RUBYGEMS_IMPORT_DATE\n\n built_at && built_at <= RUBYGEMS_IMPORT_DATE\n end",
"def get_supplier_payments0(fecha1,fecha2)\n @vouchers = SupplierPayment.where([\" company_id = ? AND fecha1 >= ? and fecha1<= ? \", self.id, \"#{fecha1} 00:00:00\",\"#{fecha2} 23:59:59\" ]).order(:id)\n return @vouchers \nend",
"def get_supplier_payments0(fecha1,fecha2)\n @vouchers = SupplierPayment.where([\" company_id = ? AND fecha1 >= ? and fecha1<= ? \", self.id, \"#{fecha1} 00:00:00\",\"#{fecha2} 23:59:59\" ]).order(:id)\n return @vouchers \nend",
"def get_supplier_payments0(fecha1,fecha2)\n @vouchers = SupplierPayment.where([\" company_id = ? AND fecha1 >= ? and fecha1<= ? \", self.id, \"#{fecha1} 00:00:00\",\"#{fecha2} 23:59:59\" ]).order(:id)\n return @vouchers \nend",
"def reiwa?\n Date.new(2019, 5, 1) <= self\n end",
"def test_fast_foward_too_far\n parse(\n 'FREQ=WEEKLY;BYDAY=MO;UNTIL=20090704T205959Z;INTERVAL=1',\n '2009-04-20 18:00:00',\n [\n '2009-04-20 18:00:00',\n '2009-04-27 18:00:00',\n '2009-05-04 18:00:00',\n '2009-05-11 18:00:00',\n '2009-05-18 18:00:00',\n '2009-05-25 18:00:00',\n '2009-06-01 18:00:00',\n '2009-06-08 18:00:00',\n '2009-06-15 18:00:00',\n '2009-06-22 18:00:00',\n '2009-06-29 18:00:00'\n ]\n )\n end",
"def test_10\n ActiveRecord::Base.logger.debug \"test_10\"\n Charges.new(Date.new(2011,01,01),\n Date.new(2011,02,01),\n\t\t2, 1, 20)\n charges = Charge.find_all_by_reservation_id 20\n assert_equal 1, charges.size\n assert_equal 1, charges[0].season_id\n assert_equal 31.0, charges[0].period.to_f\n assert_equal 20.0, charges[0].rate.to_f\n assert_equal 620.0, charges[0].amount.to_f\n assert_equal 0.0, charges[0].discount.to_f\n assert_equal Charge::DAY, charges[0].charge_units\n end",
"def test_date_of_today\n skip\n engine = Engine.new\n\n assert engine.date\n end",
"def evolve(object)\n case object\n when QDM::Date then object.mongoize\n else object\n end\n end",
"def forecast_charged(date_from, date_to)\n query = <<-QUERY\n select sum(o.total_pending) as total, DATE_FORMAT(oi.date, '%Y-%m') as period \n from orderds_orders o\n join orderds_order_items oi on oi.order_id = o.id\n WHERE oi.date >= '#{date_from}' and \n oi.date < '#{date_to}' and\n o.status NOT IN (1,3)\n group by period\n QUERY\n @repository.adapter.select(query)\n end",
"def reservation_search_confirmed(limit, offset, first_year_date)\n extra_condition = \"WHERE b.status in (2,3,4) and b.creation_date >= ?\"\n repository.adapter.select(query_strategy.query_reservation_search(limit, offset, extra_condition), first_year_date)\n end",
"def test_08aa\n disc = Discount.create!(:name => 'staff',\n :discount_percent => 100.0,\n\t\t\t :disc_appl_month => true )\n Charges.new(Date.new(2012,6,15),\n Date.new(2012,8,15),\n\t\t2, disc.id, 20)\n charges = Charge.find_all_by_reservation_id 20\n assert_equal 2, charges.size\n\n ActiveRecord::Base.logger.debug \"season is #{charges[0].season_id}\"\n assert_equal 8, charges[0].season_id\n assert_equal Charge::MONTH, charges[0].charge_units\n assert_in_delta 0.533, charges[0].period.to_f, 0.005\n assert_equal 500.0, charges[0].rate.to_f\n assert_in_delta 266.666, charges[0].amount.to_f, 0.005\n assert_in_delta 266.666, charges[0].discount.to_f, 0.005\n\n ActiveRecord::Base.logger.debug \"season is #{charges[0].season_id}\"\n assert_equal 9, charges[1].season_id\n assert_equal Charge::MONTH, charges[1].charge_units\n assert_in_delta 1.467, charges[1].period.to_f, 0.005\n assert_equal 940.0, charges[1].rate.to_f\n assert_in_delta 1378.67, charges[1].amount.to_f, 0.005\n assert_in_delta 1378.67, charges[1].discount.to_f, 0.005\n end",
"def fix_dates\n Dir[File.join( @base_dir, \"**/*.sql\" )].each do |sql_dump|\n puts \"Fixing dates in #{sql_dump.split('.sql')[0]}...\"\n `ruby -p -i -e '$_.gsub!(/date,\\n/,\"varchar(30),\\n\")' #{sql_dump}`\n end\n end",
"def relative_date_clause(table, field, days_from, days_to)\n date_clause(table, field, (days_from ? Date.today + days_from : nil), (days_to ? Date.today + days_to : nil))\n end",
"def test_date_shift_right()\n date = @ad_manager.date(2017, 10, 7)\n date = date >> 1\n assert_equal(2017, date.year)\n assert_equal(11, date.month)\n assert_equal(7, date.day)\n assert_true(date.is_a? AdManagerApi::AdManagerDate)\n end"
] |
[
"0.58639085",
"0.5593786",
"0.5593786",
"0.5593786",
"0.55794805",
"0.5538604",
"0.5500952",
"0.54879713",
"0.5473649",
"0.5465293",
"0.53997266",
"0.53786105",
"0.5376902",
"0.5359739",
"0.5351738",
"0.53102887",
"0.5259913",
"0.5237988",
"0.5213106",
"0.5201505",
"0.5199737",
"0.5194971",
"0.5191351",
"0.5187599",
"0.51644266",
"0.51564246",
"0.5144531",
"0.51372796",
"0.51281476",
"0.5117069",
"0.5109869",
"0.5097951",
"0.5096733",
"0.50957686",
"0.508581",
"0.5082471",
"0.50800425",
"0.5073985",
"0.5060012",
"0.5060012",
"0.5057743",
"0.5052239",
"0.5044273",
"0.5044273",
"0.5044273",
"0.5044273",
"0.5039374",
"0.50286263",
"0.50215936",
"0.5018812",
"0.5016421",
"0.5016053",
"0.5007105",
"0.50019854",
"0.499461",
"0.4993504",
"0.49929354",
"0.4986894",
"0.4983937",
"0.49796265",
"0.49712002",
"0.49707493",
"0.49661297",
"0.4964223",
"0.49587622",
"0.49523425",
"0.49522275",
"0.49474186",
"0.49469522",
"0.49419308",
"0.4940758",
"0.4932575",
"0.4925511",
"0.492477",
"0.49232343",
"0.49210346",
"0.491692",
"0.49121878",
"0.49121878",
"0.4911309",
"0.49107483",
"0.49090362",
"0.48996606",
"0.48959538",
"0.488936",
"0.48751456",
"0.48629186",
"0.48623452",
"0.48623452",
"0.48623452",
"0.48608163",
"0.48592833",
"0.48578888",
"0.4856995",
"0.4855843",
"0.4855571",
"0.48456034",
"0.48417434",
"0.48172268",
"0.48167008",
"0.48152727"
] |
0.0
|
-1
|
Write your code here.
|
def dictionary
dictionary = {
hello: "hi", to: "2", two: "2", too: "2", for: "4", four: "4", be: "b", you: "u", at: "@", and: "&"
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def run\n \n end",
"def run\n \n end",
"def method\n\t\t# code code\n\tend",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run\n end",
"def custom; end",
"def custom; end",
"def do()\r\n\tend",
"def run\n end",
"def suivre; end",
"def run\n end",
"def code_point; end",
"def run\n end",
"def run\n end",
"def how_it_works\r\n end",
"def private; end",
"def probers; end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run()\n end",
"def ...\nend",
"def autorun; end",
"def main\n\n end",
"def script; end",
"def script; end",
"def who_we_are\r\n end",
"def refutal()\n end",
"def schubert; end",
"def run() end",
"def jack_handey; end",
"def end\n end",
"def end\n end",
"def code_of_conduct; end",
"def guct\n end",
"def inline_code; end",
"def processor; end",
"def rossini; end",
"def operations; end",
"def operations; end",
"def zuruecksetzen()\n end",
"def usage; end",
"def usage; end",
"def myletter\n \n end",
"def perform\n \n end",
"def main\n end",
"def execute()\n\n end",
"def execute()\n\n end",
"def implementation; end",
"def implementation; end",
"def strain; end",
"def weber; end",
"def cobasysprog\n end",
"def faint; end",
"def faint; end",
"def code_like_crazy\r\n puts \"I'm crushing some code!\"\r\n end",
"def villian; end",
"def event; end",
"def event; end",
"def event; end",
"def terpene; end",
"def whiny; end",
"def functions\n\n end",
"def code\n call_once\n @code\n end",
"def home\n # Insert ruby code...\n end",
"def main_end ; end",
"def execute; end",
"def execute; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def running; end",
"def running; end",
"def src; end",
"def src; end",
"def src; end",
"def before_run; end",
"def view_flow; end",
"def process; end",
"def process; end"
] |
[
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.6527089",
"0.6527089",
"0.6524399",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.6418008",
"0.6343933",
"0.6343933",
"0.6338845",
"0.6282123",
"0.62538993",
"0.62501293",
"0.62434614",
"0.6236977",
"0.6236977",
"0.6207382",
"0.6204343",
"0.6200807",
"0.61699337",
"0.61699337",
"0.61699337",
"0.61699337",
"0.61699337",
"0.61699337",
"0.61699337",
"0.60960203",
"0.604832",
"0.6043193",
"0.6026803",
"0.6026237",
"0.6026237",
"0.60025203",
"0.59755385",
"0.5963523",
"0.5961639",
"0.5927036",
"0.5920554",
"0.5920554",
"0.59154105",
"0.5888617",
"0.5868856",
"0.58647305",
"0.5860969",
"0.58510077",
"0.58510077",
"0.5835242",
"0.58314204",
"0.58314204",
"0.58019507",
"0.5790267",
"0.57891494",
"0.5777462",
"0.5777462",
"0.57764494",
"0.57764494",
"0.5772342",
"0.57706326",
"0.5763556",
"0.57617295",
"0.57617295",
"0.575999",
"0.57593614",
"0.5746819",
"0.5746819",
"0.5746819",
"0.57457167",
"0.5744335",
"0.5744013",
"0.5742843",
"0.57107383",
"0.5698335",
"0.56904966",
"0.56904966",
"0.5683242",
"0.5683242",
"0.5683242",
"0.5683242",
"0.5683242",
"0.56829256",
"0.56829256",
"0.5681511",
"0.5681511",
"0.5681511",
"0.5680355",
"0.5674257",
"0.5665342",
"0.5665342"
] |
0.0
|
-1
|
def login=(value) write_attribute :login, (value ? value.downcase : nil) end
|
def email=(value)
write_attribute :email, (value ? value.downcase : nil)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def login=(value)\n write_attribute :login, (value ? value.downcase : nil)\n end",
"def login=(value)\n write_attribute :login, (value ? value.downcase : nil)\n end",
"def login=(value)\n write_attribute :login, (value ? value.downcase : nil)\n end",
"def username=(value)\n write_attribute :username, value.downcase\n end",
"def lower_login\n self.login = self.login.nil? ? nil : self.login.downcase \n end",
"def username=(val)\n write_attribute(:username, val.downcase.split(\" \").join)\n end",
"def username=(value)\n\t write_attribute(:username, value.downcase)\n\tend",
"def set_Login(value)\n set_input(\"Login\", value)\n end",
"def login_name=(value)\n @login_name = value\n end",
"def login=(login)\n @login = login\n end",
"def login=(login)\n @login = login\n end",
"def login=(value)\n reset_agent\n @login = value\n end",
"def login=(value)\n reset_agent\n @login = value\n end",
"def username=(username)\n write_attribute(:username, username.downcase)\n end",
"def username=(username)\n write_attribute(:username, username.downcase)\n end",
"def set_Login(value)\n set_input(\"Login\", value)\n end",
"def set_Login(value)\n set_input(\"Login\", value)\n end",
"def set_Login(value)\n set_input(\"Login\", value)\n end",
"def set_Login(value)\n set_input(\"Login\", value)\n end",
"def set_Login(value)\n set_input(\"Login\", value)\n end",
"def set_Login(value)\n set_input(\"Login\", value)\n end",
"def set_Login(value)\n set_input(\"Login\", value)\n end",
"def login_attribute\n super\n end",
"def crowd_login=(value)\n write_attribute(:crowd_login, value.blank? ? nil : value)\n reset_persistence_token if crowd_login_changed?\n end",
"def login_field(value = nil)\n if value.nil?\n read_inheritable_attribute(:login_field) || login_field(klass.login_field)\n else\n write_inheritable_attribute(:login_field, value)\n end\n end",
"def username=(value)\n @username = (value.nil? ? value : value.upcase)\n end",
"def username=(value)\n @username = (value.nil? ? value : value.upcase)\n end",
"def login=(login)\n @login = login\n end",
"def new_username=(value)\n @new_username = (value.nil? ? value : value.upcase)\n end",
"def username=(s)\n write_attribute(:username, s.to_s.strip.sub(/^@/, '').downcase)\n end",
"def set_LoginID(value)\n set_input(\"LoginID\", value)\n end",
"def set_LoginID(value)\n set_input(\"LoginID\", value)\n end",
"def set_LoginID(value)\n set_input(\"LoginID\", value)\n end",
"def set_LoginID(value)\n set_input(\"LoginID\", value)\n end",
"def set_LoginID(value)\n set_input(\"LoginID\", value)\n end",
"def set_LoginID(value)\n set_input(\"LoginID\", value)\n end",
"def set_LoginID(value)\n set_input(\"LoginID\", value)\n end",
"def set_LoginID(value)\n set_input(\"LoginID\", value)\n end",
"def set_LoginID(value)\n set_input(\"LoginID\", value)\n end",
"def set_LoginID(value)\n set_input(\"LoginID\", value)\n end",
"def username=(value)\n if value\n value.downcase!\n value.squish!\n end\n super(value)\n end",
"def username=(un)\n self[:username] = (un.nil? ? nil : un.downcase)\n end",
"def email=(value)\n \tvalue = value.strip.downcase\n \twrite_attribute :email, value\n end",
"def validate_login_field(value = nil)\n rw_config(:validate_login_field, value, true)\n end",
"def password=(value)\n value.blank? ? nil : write_attribute(:password, crypt.encrypt(value))\n end",
"def set_login_attribute(opts)\n opts = check_params(opts,[:login_attributes])\n super(opts)\n end",
"def user_name_set(name)\n self.username.set name if nil_or_empty?(username[:value])\n end",
"def login\n @login || self.username || self.email\nend",
"def login\n @login || self.username || self.email\n end",
"def login_name=(login_name)\n if !login_name.nil? && login_name.to_s.length > 100\n fail ArgumentError, 'invalid value for \"login_name\", the character length must be smaller than or equal to 100.'\n end\n\n @login_name = login_name\n end",
"def login\n @login || self.nickname || self.email\n end",
"def test_default_login_value\n @user.login_name = nil\n verify_defaults(@user)\n end",
"def username=(new_name)\n @username = new_name.upcase\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def password=(val)\n return if val.blank?\n attribute_set(:salt, Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{name}--\")) if new?\n attribute_set(:crypted_password, val.encrypt(self.salt))\n end",
"def email=(email)\n write_attribute(:email, email.downcase)\n end",
"def username=(value)\n write_attribute(:username, value)\n reset_persistence_token if username_changed?\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def set_Username(value)\n set_input(\"Username\", value)\n end",
"def blank_username\n self.username = ''\n end",
"def login\n if not @login.nil? and not @login.blank?\n @login\n elsif not self.username.nil? and not self.username.empty?\n self.username\n else\n self.email\n end\n end",
"def user=(username)\n @user ? find_and_update('//apps:login', userName: [@user, username]) : create('login', username)\n\n @user = username\n end",
"def name=(value)\n super(value&.downcase)\n end",
"def login=(new_login)\n @json['user']['content']['login'] = new_login\n end",
"def password(value = nil)\n value ? @password = value : @password\n end",
"def full_name=(value)\n value.strip! if value.present?\n write_attribute(:full_name, value)\n end"
] |
[
"0.9877592",
"0.9877592",
"0.9877592",
"0.7914654",
"0.77511036",
"0.7611718",
"0.7595162",
"0.75663465",
"0.7548009",
"0.75293976",
"0.75293976",
"0.7503506",
"0.7503506",
"0.74950147",
"0.74950147",
"0.74935037",
"0.74935037",
"0.74935037",
"0.74935037",
"0.74935037",
"0.74935037",
"0.74935037",
"0.7493254",
"0.74468565",
"0.7367028",
"0.72926396",
"0.72926396",
"0.72876304",
"0.7188689",
"0.71632904",
"0.7001463",
"0.7001463",
"0.7001463",
"0.7001463",
"0.7001463",
"0.7001463",
"0.7001463",
"0.7001463",
"0.7001463",
"0.7001463",
"0.70010245",
"0.6939807",
"0.6834165",
"0.6833359",
"0.6816184",
"0.68083745",
"0.6790969",
"0.67824686",
"0.67516136",
"0.6748284",
"0.67424005",
"0.6686606",
"0.6580063",
"0.6553642",
"0.6553642",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65520954",
"0.65258443",
"0.65111583",
"0.64627045",
"0.6409785",
"0.6409785",
"0.6409785",
"0.6409785",
"0.6409785",
"0.6409785",
"0.6409785",
"0.6409785",
"0.6409785",
"0.6409785",
"0.6408559",
"0.6403227",
"0.6350386",
"0.6295353",
"0.6292611",
"0.6270439",
"0.623283"
] |
0.67277485
|
53
|
Waits for the variable called +name+ to be modified.
|
def variable(name)
Tk.execute_only(:tkwait, :variable, name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def name\n# Input string\n# Return datatype: string\n# String interpolation and Ruby method sleep\n puts \"name your monster\"\n @name = gets.chomp.upcase\n puts \"The Gods are considering your request please wait 3 seconds\"\n sleep 3\n puts \"Congratulations: The Gods have granted your wish, they have christened your new monster: #{@name}\"\n end",
"def name=(name)\n unless name_taken?(name)\n @name = name \n @@taken_names << name\n end\n end",
"def wait(name)\n raise \"cannot wait for signals while exclusive\" if Celluloid.exclusive?\n\n @conditions[name] ||= Condition.new\n @conditions[name].wait\n end",
"def change_name=(name)\n @name = name\n end",
"def name= (new_name)\n @name = new_name\n end",
"def name=(name)\n set_if_changed(:name, name.to_s) do\n invalidate_cache!\n end\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name) \n @name = new_name\n end",
"def name=(new_name)\n @name=new_name\n end",
"def name=(name_to_be_set)\n @name = name_to_be_set\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def set_name=(name)\n @name = name\n end",
"def name=(new_name)\n\t\t@name = new_name\n\tend",
"def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end",
"def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end",
"def name= new_name\n @name = new_name\n end",
"def say_name\n @name = name\n end",
"def on_name_changed(new_name:, **)\n @name = new_name\n end",
"def name=(n) #rubyist\n @name = n #@name = name\n end",
"def set_name(name)\n @name = name\n end",
"def name=(name)\n\t\tif name == \"\"\n\t\t\traise \"Name can't be blank!\" # Report an error if the name is blank\n\t\tend\n\t\t@name = name # Store the name in an instance variable\n\tend",
"def name=(name)\n if name == \"\"\n raise \"name cannot be blank\"\n end\n @name = name\n end",
"def name=(name)\n\t@name = name\nend",
"def name=(name)\n @name = name\n end",
"def name=(name)\n @name = name\n end",
"def name=(name)\n @name = name\n end",
"def name=(name)\n @name = name\n end",
"def set_variable(name, value) \r\n\t\tmsg=\"SET VARIABLE \" + name + \" \" + value\r\n\t\tsend(msg)\r\n\t\treturn get_int_result()\r\n\tend",
"def name_setter(new_name)\n @name = new_name\n end",
"def name=(name)\n\t\t@new_name = name\n\tend",
"def name=(name)\r\n @name = name\r\n end",
"def set_name(a_name)\n @name = a_name\n end",
"def set_name(name)\n unless name.nil?\n @name = name\n end\n @name\n end",
"def set_variable(name, value)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_set_variable(@handle.ptr, name, value)\n end",
"def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n if name.to_s.length > 200\n fail ArgumentError, 'invalid value for \"name\", the character length must be smaller than or equal to 200.'\n end\n @name = name\n end",
"def name=(name)\n update_channel_data(name: name)\n end",
"def set_name=(name)\n # '@' represents the member variable\n @name = name\n end",
"def set_name=(name)\n @name=name\n end",
"def name=(name)\n @name = name\n end",
"def name=(name)\n @name = name\n end",
"def name=(name)\n if name == \"\"\n raise \"Name cannot be blank!\"\n else\n @name = name\n end\n end",
"def update_boat_name=(name)\n @name = name\n puts @name\n end",
"def name=(name)\n set_if_changed(:name, name.to_s) do\n invalidate_cache!(:only_section => true)\n end\n end",
"def name=(name)\n @name = name\n end",
"def set_name(name_in)\n @name = name_in.clone();\n end",
"def name=(name)\n if name.nil?\n fail ArgumentError, \"name cannot be nil\"\n end\n\n if name.to_s.length > 100\n fail ArgumentError, \"invalid value for 'name', the character length must be smaller than or equal to 100.\"\n end\n\n @name = name\n end",
"def name=(name)\n if name.nil?\n fail ArgumentError, \"name cannot be nil\"\n end\n\n if name.to_s.length > 100\n fail ArgumentError, \"invalid value for 'name', the character length must be smaller than or equal to 100.\"\n end\n\n @name = name\n end",
"def wait\n if defined? @result\n return @result\n else\n @waiters << Eventlet.current\n Eventlet.sleep\n end\n end",
"def name= val # Setter - set a value\n @name = val \n end",
"def name=(nm)\n @name = nm\n end",
"def name=(name)\n end",
"def name=(val)\n @name = val\n end",
"def update!(**args)\n @finish_msec = args[:finish_msec] if args.key?(:finish_msec)\n @name = args[:name] if args.key?(:name)\n @start_msec = args[:start_msec] if args.key?(:start_msec)\n end",
"def name=(value)\n client.put(path, { :name => value })\n self.data['name'] = value\n end",
"def name=(name)\n @name = name\n return @name\n end",
"def name=(n)\n @name = n\nend",
"def update_name=(new_name)\n name_element.click\n self.text_field(:id=>\"entity_name_text\").set new_name + \"\\n\"\n end",
"def name=(aname)\n\t\t@name=aname\n\tend",
"def name= new_name\n @gapi.update! name: String(new_name)\n end",
"def name=(value)\n @name = value ? value.to_s.freeze : nil\n end",
"def name=(name)\n if !name.nil? && name.to_s.length > 100\n fail ArgumentError, 'invalid value for \"name\", the character length must be smaller than or equal to 100.'\n end\n\n @name = name\n end",
"def name=(new_name)\n changeset.append(:name_changed, old_name: @name, new_name: new_name)\n end",
"def set(name)\n @name = name\n self\n end",
"def name=(val)\n @name = val\n end",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend",
"def named name\r\n check_string_or_proc name, 'name'\r\n @name = name\r\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update_for_wait\n update_basic\n end",
"def wait\n @future.value\n end",
"def update!(**args)\n @name = args[:name] unless args[:name].nil?\n end",
"def wait(time)\n if time.kind_of?(ExperimentProperty)\n duration = time.value\n else\n duration = time\n end\n info \"Request from Experiment Script: Wait for #{duration}s....\"\n Kernel.sleep duration\n end",
"def wait\n while source\n saved_source = source\n saved_source.wait\n break if saved_source.equal?(source)\n end\n end"
] |
[
"0.6025988",
"0.5931591",
"0.59147143",
"0.5891724",
"0.57934916",
"0.57591355",
"0.575749",
"0.5754974",
"0.5754974",
"0.57400393",
"0.5721122",
"0.56909597",
"0.5629232",
"0.5629232",
"0.5595312",
"0.55924565",
"0.55825025",
"0.55825025",
"0.5580426",
"0.55797863",
"0.55713457",
"0.5553341",
"0.5547977",
"0.5528601",
"0.55264276",
"0.55244046",
"0.55145365",
"0.55145365",
"0.55145365",
"0.55145365",
"0.5504438",
"0.5497139",
"0.5480355",
"0.547719",
"0.54760677",
"0.54722035",
"0.54340416",
"0.5425173",
"0.5425025",
"0.5416914",
"0.5416508",
"0.540621",
"0.5401799",
"0.5399195",
"0.5397769",
"0.53970677",
"0.53932065",
"0.5386267",
"0.5381274",
"0.5381274",
"0.5380756",
"0.53691065",
"0.5349877",
"0.5343683",
"0.5343178",
"0.533212",
"0.5317146",
"0.5316478",
"0.53148174",
"0.5313853",
"0.5304983",
"0.52959347",
"0.52881294",
"0.5276582",
"0.52702886",
"0.5267117",
"0.5265189",
"0.52572566",
"0.52572566",
"0.52572566",
"0.52572566",
"0.52572566",
"0.5254956",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246572",
"0.5246526",
"0.5246182",
"0.52390337",
"0.523715",
"0.523194"
] |
0.6696047
|
0
|
Takes the +name+ of a window and waits for a change in its visibility state (as indicated by the arrival of a VisibilityNotify event). Typically used to wait for a newlycreated window to appear on the screen before taking some action.
|
def visibility(name)
Tk.execute_only(:tkwait, :visibility, name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def window(name)\n Tk.execute_only(:tkwait, :window, name)\n end",
"def create_name_window\n @edit_window = Window_NameEdit.new(@actor, 10)\n @input_window = Window_NameInput.new(@edit_window)\n @input_window.set_handler(:ok, method(:on_input_ok))\n @edit_window.hide\n @input_window.hide\n @input_window.deactivate\n end",
"def window(title, timeout = 0)\n timeout = 30 if timeout == 0\n $webdriver.switch_to.default_content \n if not $marathon.windowMatchingTitle(title)\n bmark = MyBenchMark.new\n bmark.report(\"Waiting for window '\" + title + \"'\") {\n wait = Wait.new(:timeout => timeout, :message => \"Waiting for window '\" + title + \"'\")\n begin\n wait.until {\n waitSucceeded = false\n $webdriver.window_handles.each { |h|\n $webdriver.switch_to.window(h) unless waitSucceeded\n waitSucceeded = true if $marathon.windowMatchingTitle(title)\n }\n waitSucceeded\n }\n ensure\n bmark.close\n end\n }\n end\n $marathon.current_search_context = $webdriver\n $marathon.namingStrategy.setTopLevelComponent($marathon.getDriverAsAccessor())\n $marathon.context_handles.clear\n $marathon.context_handles.push( Proc.new { \n $marathon.current_search_context = $webdriver\n $marathon.namingStrategy.setTopLevelComponent($marathon.getDriverAsAccessor())\n } )\nend",
"def create_name_window\n @name_window = Window_StorageName.new\n @name_window.viewport = @viewport\n @name_window.x = @command_window.width\n @name_window.y = @help_window.height\n if @storage_name_window == true\n @name_window.show\n end\n end",
"def wait_for_element_to_be_visible(id, name, time)\n begin\n wait = [60, time].max\n element = get_element(id, name)\n !wait.times {\n break if element.displayed?\n sleep 1\n }\n rescue\n end\nend",
"def wait_for_visible(locator)\n wait_for { find_element(locator).displayed? }\n end",
"def show_tab(name)\n @log.debug \" show_tab: Waiting up to #{DEFAULT_TIMEOUT} seconds to find_element(:xpath, \\\"//input[@title='open #{name}']\\\")...\"\n wait = Selenium::WebDriver::Wait.new(:timeout => DEFAULT_TIMEOUT)\n wait.until { driver.find_element(:xpath, \"//input[@title='open #{name}']\") }\n @driver.find_element(:xpath, \"//input[@title='open #{name}']\").click\n pause\n end",
"def wait_visible!(timeout=@wait)\n self.el\n wait_for(timeout: timeout, message: \"Element at #{location} is not visible\") { visible? }\n end",
"def init_window\n self.z = 10_000\n lock\n @name_window.visible = false\n @name_window.lock\n @name_text.text = ''\n update_windowskin\n init_pause_coordinates\n self.pauseskin = RPG::Cache.windowskin(PauseSkin)\n self.back_opacity = ($game_system.message_frame == 0 ? 255 : 0)\n unlock\n @name_window.unlock\n end",
"def wait_until_present(context=nil)\n adapter.window.wait_until_present context\n end",
"def window(name_or_handle)\n logger.info 'EyesTargetLocator.window()'\n logger.info 'Making preparaions...'\n on_will_switch.will_switch_to_window name_or_handle\n logger.info 'Done! Switching to window..'\n __getobj__.window name_or_handle\n logger.info 'Done!'\n driver\n end",
"def wait_for_message\n @message_window.update\n while $game_message.visible \n update_basic\n end\n end",
"def check_for_window(name, error=true)\n name = name.to_s.dup\n name.slice!(0) if name.start_with?('#')\n window_setup\n if(name.blank?)\n self << \"if(window.window_rails_windows.length > 0){\"\n else\n self << \"if(window.window_rails_windows['#{name}']){\"\n end\n yield if block_given?\n self << \"}\"\n self << \"else { alert('Unexpected error. Failed to locate window for output.'); }\" if error\n nil\n end",
"def wait_visible!(timeout=@wait)\n wait_for(timeout: timeout, message: \"Element at #{locator} is not visible\") { visible? }\n end",
"def wait_until_element_disappears(type, name, timeout: 5)\n \t\twait = Selenium::WebDriver::Wait.new(timeout: timeout)\n \t\twait.until { !@selenium_driver.find_element(type, name).visible? }\n\tend",
"def variable(name)\n Tk.execute_only(:tkwait, :variable, name)\n end",
"def wait_for_render(how, what)\n @wait.until {element_visible?(how, what)}\n end",
"def visible=(v)\n if @visible ^ v\n @visible=v\n MY_LOGGER.warn(\"FIXING JTTWindow.visible= by not exploding #{@name}'s message queue when pane \" << (v ? \"shown\" : \"hidden\"))\n addmessage @parent, :paint\n end\n end",
"def pbShowWindow(windowType)\r\n # NOTE: If you are not using fancy graphics for the command/fight menus, you\r\n # will need to make \"messageBox\" also visible if the windowtype if\r\n # COMMAND_BOX/FIGHT_BOX respectively.\r\n @sprites[\"messageBox\"].visible = (windowType==MESSAGE_BOX)\r\n @sprites[\"messageWindow\"].visible = (windowType==MESSAGE_BOX)\r\n @sprites[\"commandWindow\"].visible = (windowType==COMMAND_BOX)\r\n @sprites[\"fightWindow\"].visible = (windowType==FIGHT_BOX)\r\n @sprites[\"targetWindow\"].visible = (windowType==TARGET_BOX)\r\n end",
"def show_window\r\n if visible?\r\n bring_to_front()\r\n else\r\n show_modal()\r\n end\r\n end",
"def wait_for_popup window_id, timeout\r\n command 'waitForPopUp', window_id||'null', timeout\r\n end",
"def wait_for_popup window_id, timeout\r\n command 'waitForPopUp', window_id||'null', timeout\r\n end",
"def window(windowTitle, timeout = 0)\n $marathon.window(windowTitle, timeout)\n return true\nend",
"def window_update(name)\n if name != nil\n @cShopName.text = name\n end\n refresh()\n end",
"def pbWaitMessage\r\n return if !@briefMessage\r\n pbShowWindow(MESSAGE_BOX)\r\n cw = @sprites[\"messageWindow\"]\r\n MESSAGE_PAUSE_TIME.times do\r\n pbUpdate(cw)\r\n end\r\n cw.text = \"\"\r\n cw.visible = false\r\n @briefMessage = false\r\n end",
"def wait(timeout = 0)\n Window.wait(@title, @text, timeout)\n end",
"def hide_tab(name)\n @log.debug \" hide_tab: Waiting up to #{DEFAULT_TIMEOUT} seconds to find_element(:xpath, \\\"//input[@title='close #{name}']\\\")...\"\n wait = Selenium::WebDriver::Wait.new(:timeout => DEFAULT_TIMEOUT)\n wait.until { driver.find_element(:xpath, \"//input[@title='close #{name}']\") }\n @driver.find_element(:xpath, \"//input[@title='close #{name}']\").click\n pause\n end",
"def wait_not_visible!(timeout=@wait)\n self.el\n wait_for(timeout: timeout, message: \"Element at #{location} is still visible\") { !visible? }\n end",
"def window_changed(state)\n $marathon.sleepForSlowPlay\n $marathon.windowChanged(state)\nend",
"def set_name\n @rename_window.text = @info_window.name\n @rename_window.open\n @rename_window.activate\n end",
"def update_name_windowskin\n windowskin_name = current_name_windowskin\n return if @name_windowskin_name == windowskin_name\n\n wb = @name_window.window_builder = current_name_window_builder\n @name_window.windowskin = RPG::Cache.windowskin(@name_windowskin_name = windowskin_name)\n @name_window.x = x\n if current_position != :top\n @name_window.y = y - wb[5] - wb[-1] - default_line_height - default_vertical_margin\n else\n @name_window.y = y + height + default_vertical_margin\n end\n @name_window.height = wb[5] + wb[-1] + default_line_height\n end",
"def present()\n LVGUI::Native.lv_disp_load_scr(@screen.lv_obj_pointer)\n reset_focus_group\n\n # Allow the window to do some work every time it is switched to.\n on_present\n end",
"def wait_for_freelancer_page_visible\n sleep 15\n end",
"def on_visibility_change(&block)\n event = if `typeof #{@native}.hidden !== \"undefined\"`\n 'visibilitychange'\n elsif `typeof #{@native}.mozHidden !== \"undefined\"`\n 'mozvisibilitychange'\n elsif `typeof #{@native}.msHidden !== \"undefined\"`\n 'msvisibilitychange'\n elsif `typeof #{@native}.webkitHidden !== \"undefined\"`\n 'webkitvisibilitychange'\n end\n # trace __FILE__, __LINE__, self, __method__, \" : event=#{event}\"\n if event\n `window.addEventListener(event, block, false)`\n end\n end",
"def open_status_window(battler)\n Sound.play_decision\n @windows[Win_Detail].refresh(battler)\n @windows[Win_Detail].activate\n @windows[Win_Detail].show\n @windows[Menu_Actor].hide\n @windows[Win_Help].hide\n @windows[Win_Status].hide\n end",
"def status_window aconfig={}, &block\n sw = StatusWindow.new aconfig\n sw.win.name = \"WINDOW::status_window\"\n return sw unless block_given?\n begin\n yield sw\n ensure\n sw.destroy if sw\n end\nend",
"def wait_for_element(element)\n @wait.until {\n bool = false\n\n if(element.displayed?)\n bool = true\n @element = element\n break\n end \n\n bool == true\n }\n end",
"def wait_for_visible(locator, options={})\n builder = JavascriptExpressionBuilder.new\n wait_for_condition builder.visible(locator).script, options[:timeout_in_seconds]\n end",
"def element_is_visible(name, tag, container, yes = true)\n elem = wait_visibility(name, tag, container, yes)\n elem ? true : false\n end",
"def window_closed(windowTitle)\n $marathon.sleepForSlowPlay\n $marathon.windowClosed(windowTitle)\nend",
"def initialize name = 'CamStudio - Custom Build'\n sleep 0.2 while (@h_cam = @@find_window.call nil, name ) <= 0\n set_window_pos\n\n # TODO: raise exception if can not find\n end",
"def create(name, position=[0,0], active=true)\n return @windows[name.to_sym] if @windows[name.to_sym]\n window = GUI::Window.new(name)\n window.move(position[0],position[1])\n @windows[name.to_sym] = window\n end",
"def update(k)\n\t\t\t@windows.each { |w| w.update(k) if w.visible? }\n\t\tend",
"def wait_to_appear(sym,id)\n @wait.until {\n element_arr = driver.find_elements(sym,id)\n element_arr.size > 0 and element_arr[0].displayed? #wait until the element both exists and is displayed\n }\n end",
"def enter_display_name(name, index)\n logger.debug \"Entering display name '#{name}'\"\n wait_for_element_and_type(display_name_input(index), name)\n end",
"def wait\n @notifier.wait if @notifier\n end",
"def wait\n @notifier.wait if @notifier\n end",
"def wait_for_input\n wait_for_input_core = lambda do\n text = %x{#{TM_DIALOG} -w #{@dialog_token} }\n raise WindowNotFound if $CHILD_STATUS == 54528 # -43\n raise \"Error (#{text})\" if $CHILD_STATUS != 0\n\n OSX::PropertyList::load(text)\n end\n\n if block_given? then\n loop do\n should_continue = yield(wait_for_input_core.call)\n break unless should_continue\n end\n else\n wait_for_input_core.call\n end\n end",
"def enter_org_display_name(name, index)\n wait_for_element_and_type(org_display_name_input(index), name)\n end",
"def wait_until_displayed(element, timeout=10)\n wait_until(timeout) { element.displayed? }\nend",
"def wait_not_visible!(timeout=@wait)\n wait_for(timeout: timeout, message: \"Element at #{locator} is still visible\") { !visible? }\n end",
"def on_window_window_state_event(win, win_state)\n if win_state.new_window_state == 130\n @ui[\"window\"].hide\n @ui[\"window\"].deiconify\n end\n end",
"def window name, cwd, cmd\n raise NotImplementedError.new(\n \"window should be implemented to open new window\")\n end",
"def init_window\n super\n # Make sure it's only done when called inside initialize\n return unless @waiter.nil?\n @wait_input = false\n @blocking = false\n @waiter = 0\n end",
"def window_focus window_name\r\n command 'windowFocus', window_name\r\n end",
"def wait_for_ui_to_update\n sleep(UI_UPDATE_DELAY)\nend",
"def wait_for\n subject = nil\n wait.until { (subject = yield).displayed? }\n sleep(1.2) # FIXME: wait animations to complete\n subject\n end",
"def visible=(value)\n @message_window.viewport.visible = value if @message_window\n end",
"def window_search(window_name)\n # window title with regexp\n @window = RAutomation::Window.new(:title => /#{window_name}/i)\n end",
"def new_window(name)\n execute_script(%(\n var w = Math.max(\n document.documentElement.clientWidth, window.innerWidth || 0\n );\n var h = Math.max(\n document.documentElement.clientHeight, window.innerHeight || 0\n );\n window.open(\"about:blank\", arguments[0], `width=${w},height=${h}`);\n ), name)\n end",
"def collect_visible_windows\n scene = SceneManager.scene\n scene.instance_variables.collect do |varname|\n scene.instance_variable_get(varname)\n end.select do |ivar|\n ivar.is_a?(Window) && !ivar.disposed? && ivar.visible\n end\n end",
"def wait\n sleep 0.0001\n end",
"def check_popup_state(id, visible, timeout=nil)\r\n if visible\r\n find_by_id_and_class(id, \"ss-DialogBox\", timeout);\r\n else\r\n find_by_id_and_class_fail(id, \"ss-DialogBox\", timeout);\r\n end\r\n end",
"def window_variable(number, name)\n echo func('getwinvar', number, name)\n end",
"def create_stat_window\n @stat_window = Window_EquipStat.new(STAT_WINDOW_X, STAT_WINDOW_Y)\n @stat_window.actor = @actor\n @stat_window.hide\n end",
"def visible?\n Waiter.wait_for do\n inst = presence\n !! inst && inst.visible?\n end\n end",
"def wait(title, text = \"\", timeout = 0)\n @functions[__method__] ||= AU3_Function.new(\"WinWait\", 'SSL', 'L')\n @functions[__method__].call(title.wide, text.wide, timeout) != 0\n end",
"def wait(name)\n raise \"cannot wait for signals while exclusive\" if Celluloid.exclusive?\n\n @conditions[name] ||= Condition.new\n @conditions[name].wait\n end",
"def show_window\n end",
"def dialog( title, seconds=3 )\n\t\td = begin\n\t\t\t\tw = Window.top_level(title, seconds)\n\t\t\t\tyield(w) ? w : nil\n\t\trescue TimeoutError\n\t\tend\n\n\t\td.wait_for_close if d\n\t\treturn d\n\tend",
"def wait_for_element(id, name, time)\n wait = Selenium::WebDriver::Wait.new(:timeout => time)\n wait.until {@driver.find_element(id => name) }\nend",
"def show_window\n\t\tif self.visible?\n\t\t\tself.bring_to_front\n\t\telse\n\t\t\t# We use set_file here to prevent Macs loading the whole dialog when the\n\t\t\t# plugin loads. No need to populate the dialog and use extra resources\n\t\t\t# if it will never be used.\n\t\t\tfilepath = File.join(PATH, 'webdialog/ui_manager.html')\n\t\t\tself.set_file(filepath)\n\t\t\tif PLUGIN.is_mac?\n\t\t\t\tself.show_modal\n\t\t\telse\n\t\t\t\tself.show\n\t\t\tend\n\t\tend\n\tend",
"def main_window\r\n super\r\n # Make windows\r\n @edit_window = Window_NameEdit.new(@actor, $game_temp.name_max_char)\r\n @input_window = Window_NameInput.new\r\n end",
"def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while !@shell.isDisposed\n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n display.dispose\n end",
"def visible?(title)\n @driver.wait { @driver.text(title).displayed? }\n @driver.wait do\n @driver.find_element(\n @rows[:type], @rows[:value]\n ).displayed?\n end\n end",
"def wait_for_welcome_screen\n wait_for_elements_exist([trait])\n end",
"def wait_to_disappear(sym,id)\n @wait.until {\n element_arr = driver.find_elements(sym,id)\n element_arr.size > 0 and !element_arr[0].displayed? #wait until the element both exists and is displayed\n }\n end",
"def switch_to_window_by_title window_title\n $previous_window = $driver.window_handle\n window_found = false\n $driver.window_handles.each{ |handle|\n $driver.switch_to.window handle\n if $driver.title == window_title\n window_found = true\n break\n end\n }\n raise \"Window having title \\\"#{window_title}\\\" not found\" if not window_found\nend",
"def wait\n true\n end",
"def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while !@shell.isDisposed\n \n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end",
"def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while !@shell.isDisposed\n \n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end",
"def wait_and_find_element(element_name)\n $LOG.info \"Waiting for element #{element_name}\"\n begin\n # timeout = INITIALIZATION_COMPONENTS['wait'].to_i\n timeout = Vanilla::ConfigReader.configuration_reader\n timeout = timeout['wait']\n if timeout == 0\n timeout = 10\n end\n wait_ele = el(element_name)\n wait = Selenium::WebDriver::Wait.new(timeout: timeout ) # seconds\n wait.until { wait_ele }\n rescue Exception => e\n $LOG.error \"Element is not displayed in specific time \"+e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n raise \"Element is not displayed in specific time \"+e.message\n end\n end",
"def visible=(state)\n return false if (state ? true : false) == self.visible?\n if state\n iws = [300, 300]\n @dialog = ::UI::WebDialog.new(@title, false, @title, iws.x, iws.y, 800, 600, false)\n # Callbacks\n @dialog.add_action_callback('init') { |dlg, params|\n unless @init_called\n @init_called = true\n ds = eval(params)\n #@border_size = [iws.x - ds.x, iws.y - ds.y]\n if RUBY_PLATFORM =~ /mswin|mingw/i && @handle\n ws = AMS::Window.get_size(@handle)\n cr = AMS::Window.get_client_rect(@handle)\n cs = [cr[2] - cr[0], cr[3] - cr[1]]\n @border_size = [ws.x - cs.x, ws.y - cs.y]\n else\n @border_size = [2, 24]\n end\n end\n @sliders.each { |name, data|\n generate_slider_html(name, false)\n }\n dlg.execute_script(\"update_size();\")\n }\n @dialog.add_action_callback('size_changed') { |dlg, params|\n @size = eval(params)\n update_placement\n }\n @dialog.add_action_callback('mouse_enter') { |dlg, params|\n @mouse_over = true\n }\n @dialog.add_action_callback('mouse_leave') { |dlg, params|\n @mouse_over = false\n AMS::Sketchup.activate if RUBY_PLATFORM =~ /mswin|mingw/i\n }\n @dialog.add_action_callback('update_note') { |dlg, params|\n next if RUBY_PLATFORM !~ /mswin|mingw/i\n cmd = \"\"\n if AMS::Sketchup.is_main_window_active?\n cmd << \"$('#note1').css('display', 'none');\"\n cmd << \"$('#note2').css('display', 'none');\"\n cmd << \"$('#note3').fadeIn(750);\"\n elsif AMS::Window.is_active?(@handle)\n cmd << \"$('#note1').css('display', 'none');\"\n cmd << \"$('#note3').css('display', 'none');\"\n cmd << \"$('#note2').fadeIn(750);\"\n else\n cmd << \"$('#note2').css('display', 'none');\"\n cmd << \"$('#note3').css('display', 'none');\"\n cmd << \"$('#note1').fadeIn(750);\"\n end\n dlg.execute_script(cmd)\n }\n # Set content\n dir = File.dirname(__FILE__)\n dir.force_encoding(\"UTF-8\") if RUBY_VERSION !~ /1.8/\n url = File.join(dir, 'html/control_panel.html')\n @dialog.set_file(url)\n # Show dialog\n RUBY_PLATFORM =~ /mswin|mingw/i ? @dialog.show : @dialog.show_modal\n # Assign the on_close callback. Important: This must be called after\n # showing dialog in order to work on Mac OS X.\n @dialog.set_on_close {\n if RUBY_PLATFORM =~ /mswin|mingw/i\n AMS::Sketchup.include_dialog(@handle)\n AMS::Sketchup.remove_observer(self)\n end\n @dialog.execute_script('uninit();')\n @dialog = nil\n @handle = nil\n @mouse_over = false\n @init_called = false\n }\n # Find dialog window handle\n @handle = RUBY_PLATFORM =~ /mswin|mingw/i ? AMS::Sketchup.find_window_by_caption(@title) : nil\n if @handle\n # Add observer\n AMS::Sketchup.add_observer(self)\n # Remove dialog caption and borders\n layered = AMS::System.get_windows_version < 6.0 ? 0 : 0x00080000\n style_ex = 0x00010000 | layered # WS_EX_CONTROLPARENT | WS_EX_LAYERED\n #style = 0x54000000 # WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS\n style = 0x94000000 # WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS\n AMS::Window.lock_update(@handle)\n AMS::Window.set_long(@handle, -20, style_ex)\n AMS::Window.set_long(@handle, -16, style)\n AMS::Window.lock_update(nil)\n AMS::Window.set_pos(@handle, 0, 0, 0, 0, 0, 0x0267)\n AMS::Window.set_layered_attributes(@handle, 0, 200, 2)\n AMS::Sketchup.ignore_dialog(@handle)\n AMS::Sketchup.activate\n end\n else\n @dialog.close\n end\n true\n end",
"def confirm_visible\n return false if @windows.nil?\n return false if @windows[Win_Confirm].nil?\n return (@windows[Win_Confirm].active && @windows[Win_Confirm].visible)\n end",
"def switch_window\n current_window = window\n wins = windows\n wait_until { (wins = windows) && wins.size > 1 } if wins.size == 1\n raise StandardError, 'Unable to determine which window to switch to' if wins.size > 2\n\n wins.find { |w| w != current_window }.use\n window\n end",
"def wait_for_guestcontrol\n until boot_complete? do\n print \"Waiting for #{@vbox_name} to be available for guestcontrol...\\n\" if @verbose\n sleep 3\n end\n end",
"def wait\n @running.reset\n @waiting.set\n @running.wait\n end",
"def view_person(name)\n name_link(name).click\n sleep 3\n self.wait_for_ajax\n ViewPerson.new @browser\n end",
"def XOselectWindow(tag, tvalue)\n\t\tres= OK\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# default is OK\n\t\t$pfd.tstart( @wwBrws.url.to_s)\n\t\tbegin\n\t\t\tself.setPageTimer()\t\t\t\t\t\t\t\t\t \t\t\t\t# set or clear the page timer\n\t\t\t$pfd.tstart( @wwBrws.url.to_s)\n\t\t\ttimedOut= false\n\n @winHandles.checkHandle (self) \t\t\t\t\t\t# add/ delete any new window\n\t\t\t$alog.lwrite(('There are '+@wwBrws.windows.size.to_s+' active windows.'), 'DEBG')\n\t\t\tcase tag\n\t\t\t\twhen :index\n\t\t\t\t\tuntil ((timedOut=self.getPageTimer()) || @wwBrws.window(:index => tvalue).exists?)\n\t\t\t\t\t\tsleep TIMETICK\n\t\t\t\t\tend\n\t\t\t\t\t$alog.lwrite(('2nd. Found. There are '+@wwBrws.windows.size.to_s+' active windows.'), 'DEBG')\n\t\t\t\t\tif timedOut\n\t\t\t\t\t\tres= CRITICAL\n\t\t\t\t\telse\n\t\t\t\t\t\t$alog.lwrite(('3nd. Activating. There are '+@wwBrws.windows.size.to_s+' active windows.'), 'DEBG')\n \t\t\tres= @winHandles.activateHandle(self, tvalue)\n\t\t\t\t\tend\n\t\t\t\twhen :url\n\t\t\t\t\tuntil ((timedOut=self.getPageTimer()) || @wwBrws.window(:url => /#{tvalue}/).exists?)\n\t\t\t\t\t\tsleep TIMETICK\n\t\t\t\t\tend\n\t\t\t\t\tif timedOut\n\t\t\t\t\t\tres= CRITICAL\n\t\t\t\t\telse\n\t\t\t\t\t\t@wwBrws.window(:url => /#{tvalue}/).use\n\t\t\t\t\tend\n\t\t\t\twhen :title\n\t\t\t\t\tuntil ((timedOut=self.getPageTimer()) || @wwBrws.window(:title => /#{tvalue}/).exists?)\n\t\t\t\t\t\tsleep TIMETICK\n\t\t\t\t\tend\n\t\t\t\t\tif timedOut\n\t\t\t\t\t\tres= CRITICAL\n\t\t\t\t\telse\n\t\t\t\t\t\t@wwBrws.window(:title => /#{tvalue}/).use\n\t\t\t\t\tend\n\t\t\tend\n\t\t\tif(res==CRITICAL)\n\t\t\t\tres= setResCritical('CANnot switch to window: /'+tvalue.to_s+'/ :'+$!.to_s)\n\t\t\telse\n\t\t\t\t$alog.lwrite(('Now using Windows w/title '+@wwBrws.window.title.to_s+' '), 'DEBG')\n\t\t\tend\n\t\trescue\n\t\t\tres= setResCritical('CANnot switch to window: /'+tvalue.to_s+'/ :'+$!.to_s) \t\t\t\t#\n\t\tend\n\t\treturnRes (res )\n\tend",
"def load_window(waittime, window)\n begin\n Timeout::timeout(waittime) do\n time = Time.new\n yield\n end\n rescue Exception => e\n time = Time.new\n if window.exists?\n puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - Exception occurred:\\n window.title = #{window.title}\\n #{e}\\n\"\n else\n puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - Exception occurred:\\n #{e}\\n\"\n end\n retries ||= 0\n puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - Exception: retries = #{retries}\\n\"\n if retries < @max_retries\n retries += 1\n time_to_wait = (Float(waittime) / @max_retries).round\n puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - Exception: time_to_wait = #{time_to_wait}\\n\"\n sleep time_to_wait\n retry\n else\n puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - Exception: raise Exception\\n\"\n raise e\n end\n end\n end",
"def wait\n if args.length != 1\n error \"Kafka name required\"\n end\n name, urls = attachment(args)\n wait_for(urls, name, 3)\n end",
"def wait\r\n Ragweed::Wrap32::wait_for_single_object @h\r\n end",
"def message_window_showing\n if Input.timed_permanent? and $scene.is_a?(Scene_Battle)\n return false\n else\n return @message_window_showing\n end\n end",
"def create_status_window\n @status_window = Window_Status.new(STATUS_WINDOW_X, STATUS_WINDOW_Y, @actor)\n @status_window.set_handler(:name, method(:input_name))\n @status_window.set_handler(:title, method(:change_title))\n @status_window.set_handler(:cancel, method(:return_scene))\n @status_window.set_handler(:pagedown, method(:next_actor))\n @status_window.set_handler(:pageup, method(:prev_actor))\n end",
"def wait_for_element_to_disappear(element)\n @wait.until {\n begin\n !element.displayed?\n rescue\n break\n end\n }\n end",
"def test_039\n test_000\n login(\"root\",\"root\")\n create_2nd_user\n sleep WAIT_TIME\n abc = @selenium.get_attribute(\"//body/div[2]@style\")\n # if there is a piece of text \"display: none\", this subwindow will be fade out\n result = (abc.to_s =~ /display: none/ )\n # 'result' is nill demonstrates that the subwindow still available\n assert_equal result, nil\n logout\n end",
"def wait_for_shutdown\n until powered_off? do\n print \"Waiting for #{@vbox_name} to be finished shutdown...\\n\" if @verbose\n sleep 3\n end\n end",
"def wait_label_change (label)\n wait_for_elements_exist([\"view marked:'#{label}'\"])\n sleep 1\n end",
"def wait_condition(name, &block)\n resource = WaitCondition.new\n resource.evaluate &block\n\n if resource.handle.nil?\n handle_name = \"#{name}Handle\"\n\n if not resources.include? handle_name\n wait_condition_handle handle_name\n end\n\n resource.handle = handle_name\n end\n\n add_resource(name, resource)\n end",
"def wait_for_browser\r\n # NOTE: no need any more\r\n end"
] |
[
"0.7509172",
"0.59860957",
"0.5871165",
"0.5866606",
"0.5835126",
"0.57493335",
"0.5722333",
"0.56358814",
"0.5586113",
"0.5583724",
"0.5578906",
"0.5553645",
"0.545271",
"0.5403329",
"0.5400555",
"0.5363628",
"0.5352441",
"0.5351471",
"0.53335834",
"0.5332441",
"0.5328992",
"0.5328992",
"0.53135896",
"0.5310562",
"0.52925515",
"0.5288639",
"0.52808267",
"0.5276259",
"0.5267079",
"0.5266934",
"0.52447045",
"0.5243005",
"0.52226543",
"0.52159023",
"0.51992637",
"0.51765954",
"0.51281947",
"0.5123585",
"0.51199377",
"0.5115506",
"0.5109452",
"0.51080334",
"0.5104743",
"0.5091698",
"0.50891346",
"0.508901",
"0.508901",
"0.5084594",
"0.5078592",
"0.505942",
"0.5058853",
"0.5053334",
"0.5036579",
"0.5034086",
"0.50269717",
"0.50222194",
"0.4995359",
"0.49752235",
"0.4973679",
"0.49720123",
"0.4971401",
"0.49220154",
"0.49096167",
"0.49079022",
"0.48895597",
"0.48843735",
"0.4873915",
"0.48691082",
"0.4860836",
"0.48573354",
"0.48324555",
"0.48275435",
"0.48270738",
"0.4825975",
"0.4802761",
"0.47984037",
"0.4797756",
"0.47942793",
"0.47900486",
"0.4787839",
"0.47871894",
"0.47797978",
"0.4772824",
"0.47724026",
"0.47719216",
"0.4766121",
"0.47559726",
"0.47500256",
"0.47497526",
"0.47487944",
"0.4746946",
"0.4743741",
"0.47364265",
"0.47325486",
"0.47288808",
"0.47271425",
"0.47264937",
"0.47201458",
"0.47129592",
"0.47060254"
] |
0.73564255
|
1
|
This method takes the name of a window as argument and waits until the window is destroyed. It is typically used to wait for a user to finish interacting with a dialog box before using the result of that interaction.
|
def window(name)
Tk.execute_only(:tkwait, :window, name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def close_dialog(dialog_name)\n wait_start\n opera_desktop_action(\"Cancel\")\n wait_for_window_close(dialog_name)\n end",
"def close_dialog(dialog_name)\n wait_start\n opera_desktop_action(\"Cancel\")\n wait_for_window_close(dialog_name)\n end",
"def wait_for_popup window_id, timeout\r\n command 'waitForPopUp', window_id||'null', timeout\r\n end",
"def wait_for_popup window_id, timeout\r\n command 'waitForPopUp', window_id||'null', timeout\r\n end",
"def destructionFen \n @v1.getWindow.destroy\n Gtk.main_quit\n end",
"def CloseWindow\n @window.hide\n Gtk.main_quit\n end",
"def hide_tab(name)\n @log.debug \" hide_tab: Waiting up to #{DEFAULT_TIMEOUT} seconds to find_element(:xpath, \\\"//input[@title='close #{name}']\\\")...\"\n wait = Selenium::WebDriver::Wait.new(:timeout => DEFAULT_TIMEOUT)\n wait.until { driver.find_element(:xpath, \"//input[@title='close #{name}']\") }\n @driver.find_element(:xpath, \"//input[@title='close #{name}']\").click\n pause\n end",
"def create_name_window\n @edit_window = Window_NameEdit.new(@actor, 10)\n @input_window = Window_NameInput.new(@edit_window)\n @input_window.set_handler(:ok, method(:on_input_ok))\n @edit_window.hide\n @input_window.hide\n @input_window.deactivate\n end",
"def close\n @window.destroy if @window\n @window = nil\n end",
"def dialog( title, seconds=3 )\n\t\td = begin\n\t\t\t\tw = Window.top_level(title, seconds)\n\t\t\t\tyield(w) ? w : nil\n\t\trescue TimeoutError\n\t\tend\n\n\t\td.wait_for_close if d\n\t\treturn d\n\tend",
"def window_closed(windowTitle)\n $marathon.sleepForSlowPlay\n $marathon.windowClosed(windowTitle)\nend",
"def close_window\n end",
"def close()\r\n #puts \"current window number is : #{@@current_window}\"\r\n # Derek Berner 5/16/08\r\n # Try to join thread only if there is exactly one open window\r\n if js_eval(\"getWindows().length\").to_i == 1\r\n $jssh_socket.send(\" getWindows()[0].close(); \\n\", 0)\r\n @t.join if @t != nil\r\n #sleep 5\r\n else\r\n # Check if window exists, because there may be the case that it has been closed by click event on some element.\r\n # For e.g: Close Button, Close this Window link etc.\r\n window_number = find_window(\"url\", @window_url)\r\n\r\n # If matching window found. Close the window.\r\n if(window_number > 0)\r\n $jssh_socket.send(\" getWindows()[#{window_number}].close();\\n\", 0)\r\n read_socket();\r\n end \r\n \r\n #Get the parent window url from the stack and return that window.\r\n #@@current_window = @@window_stack.pop()\r\n @window_url = @@window_stack.pop()\r\n @window_title = @@window_stack.pop()\r\n # Find window with this url.\r\n window_number = find_window(\"url\", @window_url)\r\n @@current_window = window_number\r\n set_browser_document()\r\n end\r\n end",
"def exit\n stop\n $window.deleteAllWidgets\n $window.createWidgets\n $window.deleteAllImages\n $window.cursor.unforceVisible\n terminate\n end",
"def destroy; @win.destroy if @win; @win = nil; end",
"def waitQuit()\n @device.waitQuit() ;\n end",
"def linger caller_window=nil\n begin\n if caller_window\n ch = @win.getchar\n caller_window.ungetch(ch) # will this be available to underlying window XXX i think not !!\n else\n sleep 1\n end\n ensure\n destroy\n end\n end",
"def close\n wait_for_exists\n @alert.dismiss\n @browser.after_hooks.run\n end",
"def wait_until_present(context=nil)\n adapter.window.wait_until_present context\n end",
"def close\n @window.destroy if @window\n VER::stop_ncurses\n end",
"def window(title, timeout = 0)\n timeout = 30 if timeout == 0\n $webdriver.switch_to.default_content \n if not $marathon.windowMatchingTitle(title)\n bmark = MyBenchMark.new\n bmark.report(\"Waiting for window '\" + title + \"'\") {\n wait = Wait.new(:timeout => timeout, :message => \"Waiting for window '\" + title + \"'\")\n begin\n wait.until {\n waitSucceeded = false\n $webdriver.window_handles.each { |h|\n $webdriver.switch_to.window(h) unless waitSucceeded\n waitSucceeded = true if $marathon.windowMatchingTitle(title)\n }\n waitSucceeded\n }\n ensure\n bmark.close\n end\n }\n end\n $marathon.current_search_context = $webdriver\n $marathon.namingStrategy.setTopLevelComponent($marathon.getDriverAsAccessor())\n $marathon.context_handles.clear\n $marathon.context_handles.push( Proc.new { \n $marathon.current_search_context = $webdriver\n $marathon.namingStrategy.setTopLevelComponent($marathon.getDriverAsAccessor())\n } )\nend",
"def close(wait_timeout=nil)\n @main_window.close\n if wait_timeout\n timeout(wait_timeout) do\n sleep SLEEP_DELAY while @main_window.window?\n end\n end\n# @main_window.wait_for_close(timeout) if timeout - does not work as Window#wait_for_close relies on window_visible?\n end",
"def dispose_active_window\n @active_window.dispose\n @active_window = nil\n end",
"def dispose_active_window\n @active_window.dispose\n @active_window = nil\n end",
"def destroy\n # typically the ensure block should have this\n # @panel = @window.panel if @window\n #Ncurses::Panel.del_panel(@panel) if !@panel.nil? \n #@window.delwin if !@window.nil?\n $log.debug \"win destroy start\"\n\n #@panel = @window.panel if @window\n Ncurses::Panel.del_panel(@panel) if !@panel.nil? \n @window.delwin if !@window.nil?\n $log.debug \"win destroy end\"\n end",
"def close\n @window.close\n end",
"def close_window(options = {})\n win_name = if(options.is_a?(Hash))\n [(options[:window] || options[:name]).to_s]\n elsif(options.is_a?(Array))\n options.map(&:to_s)\n else\n [options.to_s]\n end\n win_name.each do |win|\n self << check_for_window(win, false){ self << \"#{window(win, :raw)}.dialog('close');\"}\n end\n end",
"def wait_close(timeout = 0)\n Window.functions[__method__] ||= AU3_Function.new(\"WinWaitClose\", 'SSL', 'L')\n Window.functions[__method__].call(@title.wide, @text.wide, timeout) != 0\n end",
"def using(window)\n begin\n yield if block_given?\n ensure\n window.dispose\n end\nend",
"def wait_for_input\n wait_for_input_core = lambda do\n text = %x{#{TM_DIALOG} -w #{@dialog_token} }\n raise WindowNotFound if $CHILD_STATUS == 54528 # -43\n raise \"Error (#{text})\" if $CHILD_STATUS != 0\n\n OSX::PropertyList::load(text)\n end\n\n if block_given? then\n loop do\n should_continue = yield(wait_for_input_core.call)\n break unless should_continue\n end\n else\n wait_for_input_core.call\n end\n end",
"def exit\n @window.pause = true\n @window.close\n end",
"def end\r\n onEnd\r\n $window.deleteAllWidgets\r\n $window.createWidgets\r\n $window.deleteAllImages\r\n $window.cursor.unforceVisible\r\n onTerminate\r\n end",
"def exit_dlg()\n @parent.show\n self.destroy\n end",
"def dispose_command_window\n @command_window.dispose\n end",
"def close_window_with_action(win_name, action_name, *params)\n wait_start\n opera_desktop_action(action_name, *params) \n wait_for_window_close(win_name)\n end",
"def dismiss_dialog\n @ole.browser.alert.ok if @ole.browser.alert.present?\n end",
"def close_new_window\n $driver.close\nend",
"def on_MainWindow_destroy\n @wfsock.close\n Gtk.main_quit\n end",
"def on_window1_destroy\n\t\tdestroy_window\n\tend",
"def close_status_window\n instance_variables.each do |varname|\n ivar = instance_variable_get(varname)\n ivar.openness = 0 if ivar.is_a?(Window)\n end\n end",
"def close_all_dialogs\n win_id = driver.getActiveWindowID()\n until quick_window(:id, win_id).type != :dialog do\n win = quick_window(:id, driver.getActiveWindowID())\n if win.type == :dialog\n close_dialog(win.name)\n if (driver.getActiveWindowID() != win_id)\n win_id = driver.getActiveWindowID()\n else\n break\n end\n end\n end\n end",
"def close_window_with_action(win_name, action_name, *params)\n wait_start\n opera_desktop_action(action_name, *params)\n wait_for_window_close(win_name)\n end",
"def wait(timeout = 0)\n Window.wait(@title, @text, timeout)\n end",
"def with_window(windowTitle, timeout = 0)\n endTime = System.currentTimeMillis + (timeout * 1000)\n begin\n window(windowTitle, timeout)\n rescue Exception => e\n if System.currentTimeMillis < endTime\n retry\n else\n raise e\n end\n end\n yield\n $marathon.close\n return true\nend",
"def close_current_window()\n $driver.close.should be_nil\n # Just in case\n $driver.switch_to.window($driver.window_handles.last).should be_nil\n end",
"def destroy\n # typically the ensure block should have this\n\n #$log.debug \"win destroy start\"\n\n $global_windows.delete self\n Ncurses::Panel.del_panel(@panel.pointer) if @panel\n delwin() if @window \n Ncurses::Panel.update_panels # added so below window does not need to do this 2011-10-1 \n\n # destroy any pads that were created by widgets using get_pad\n @pads.each { |pad| \n FFI::NCurses.delwin(pad) if pad \n pad = nil\n } if @pads\n # added here to hopefully take care of this issue once and for all. \n # Whenever any window is destroyed, the root window is repainted.\n #\n # 2014-08-18 - 20:35 trying out without refresh all since lower dialog gets erased\n Window.refresh_all\n #$log.debug \"win destroy end\"\n end",
"def close_all_dialogs\n win_id = driver.getActiveQuickWindowID()\n until quick_window(:id, win_id).type != :dialog do\n win = quick_window(:id, driver.getActiveQuickWindowID())\n if win.type == :dialog\n close_dialog(win.name)\n if (driver.getActiveQuickWindowID() != win_id)\n win_id = driver.getActiveQuickWindowID()\n else\n break\n end\n end\n end\n end",
"def do_nothing\n @command_window.activate\n @rename_window.close\n end",
"def window(windowTitle, timeout = 0)\n $marathon.window(windowTitle, timeout)\n return true\nend",
"def close_game\r\n $window.close\r\n end",
"def create_name_window\n @name_window = Window_StorageName.new\n @name_window.viewport = @viewport\n @name_window.x = @command_window.width\n @name_window.y = @help_window.height\n if @storage_name_window == true\n @name_window.show\n end\n end",
"def destroy\n @window.destroy\n @forms.each { |f| w = f.window; w.destroy unless w.nil? }\n end",
"def destroy\n @window.destroy\n redirect_to windows_url, notice: 'Window was successfully destroyed.'\n end",
"def check_for_window(name, error=true)\n name = name.to_s.dup\n name.slice!(0) if name.start_with?('#')\n window_setup\n if(name.blank?)\n self << \"if(window.window_rails_windows.length > 0){\"\n else\n self << \"if(window.window_rails_windows['#{name}']){\"\n end\n yield if block_given?\n self << \"}\"\n self << \"else { alert('Unexpected error. Failed to locate window for output.'); }\" if error\n nil\n end",
"def wait_cbox_close(&block)\n wait_for_js_ready\n save = JsSupport.is_within_cbox\n JsSupport.is_within_cbox = true\n wait_event_to_fire(\"cbox_closed\", &block)\n ensure\n JsSupport.is_within_cbox = save\n end",
"def clean_up\n @browser.close if @browser && @browser.exists?\n quit \"Later, noobs\"\n end",
"def close_nx\n return @dialog.setCompleted unless @dialog.abortWasRequested\n\n @dialog.setMainStatusAndLogIt('Aborted')\n end",
"def close\n SLogger.debug(\"[client] interrupting window (#{@window_pid})...\")\n\n Process.kill(:INT, @window_pid)\n end",
"def close\n start_time = Time.now\n is_open = true\n while is_open\n abort(\"*** #{File.basename(__FILE__)}: Window #{@id} did not close - your settings may need adjusting. Exiting...\") if Time.now - start_time > 2\n is_open = win_is_open?(@id)\n end\n end",
"def visibility(name)\n Tk.execute_only(:tkwait, :visibility, name)\n end",
"def leave(name)\n\t\tputs \"Thanks for playing #{name}, Come back soon!\"\n\t\tsleep(3)\n\t\tprint CLEAR\n\t\texit\n\tend",
"def quit_command()\n @subSceneScan.hide_windows()\n @target_enemy_window.active = true\n end",
"def close_all_windows\n setup_windows\n self << '\n jQuery.each(\n window_rails_windows_array,\n function(name, win){\n window.window_rails_windows[win].dialog(\"close\");\n }\n );\n '\n end",
"def close_window\n $LOG.info \"Inside close window method\"\n begin\n $driver.close\n rescue Exception => e\n $LOG.error \"Error Close the current window, \\n Error Message :: \"+e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n raise \"Error Close the current window \\n Error Message :: \"+e.message\n end\n end",
"def hide_window\n end",
"def variable(name)\n Tk.execute_only(:tkwait, :variable, name)\n end",
"def XOcloseWindow(tag, tvalue)\n\t\tres= OK\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# default is OK\n\t\tbegin\n\t\t\tself.setPageTimer() \t\t\t\t\t\t\t\t\t\t# set or clear the page timer\n\t\t\t$pfd.tstart( @wwBrws.url.to_s)\n\t\t\ttimedOut= false\n\n\t\t\t$alog.lwrite(('There are '+@wwBrws.windows.size.to_s+' active windows.'), 'DEBG')\n\n\t\t\tcase tag\n\t\t\t\twhen :allpopup\n\t\t\t\t\tres= @winHandles.closeAllHandle( self)\n\n\t\t\t\twhen :index\n\t\t\t\t\tuntil ((timedOut=self.getPageTimer()) || @wwBrws.window(:index => tvalue).exists?)\n\t\t\t\t\t\tsleep TIMETICK\n\t\t\t\t\tend\n\t\t\t\t\tif timedOut\n\t\t\t\t\t\tres= CRITICAL\n\t\t\t\t\telse\n\t\t\t\t\t\tres= @winHandles.closeHandle( self, tvalue)\n\t\t\t\t\tend\n\n\t\t\t\twhen :url\n\t\t\t\t\tuntil ((timedOut=self.getPageTimer()) || @wwBrws.window(:url => /#{tvalue}/).exists?)\n\t\t\t\t\t\tsleep TIMETICK\n\t\t\t\t\tend\n\t\t\t\t\tif timedOut\n\t\t\t\t\t\tres= CRITICAL\n\t\t\t\t\telse\n\t\t\t\t\t\t@wwBrws.window(:url => /#{tvalue}/).close\n\t\t\t\t\tend\n\t\t\t\twhen :title\n\t\t\t\t\tuntil ((timedOut=self.getPageTimer()) || @wwBrws.window(:title => /#{tvalue}/).exists?)\n\t\t\t\t\t\tsleep TIMETICK\n\t\t\t\t\tend\n\t\t\t\t\tif timedOut\n\t\t\t\t\t\tres= CRITICAL\n\t\t\t\t\telse\n\t\t\t\t\t\t@wwBrws.window(:title => /#{tvalue}/).close\n\t\t\t\t\tend\n\t\t\tend\n\n\t\t\tif(res==CRITICAL)\n\t\t\t\tres= setResCritical('CANnot close window: '+$!.to_s )\n\t\t\telse\n\t\t\t\t$alog.lwrite(('Now using Windows w/title '+@wwBrws.window.title.to_s+' '), 'DEBG')\n\t\t\tend\n\t\trescue\n\t\t\tres= setResCritical('CANnot close window: '+$!.to_s )\n\t\tend\n\t\treturnRes (res )\n\tend",
"def window(name_or_handle)\n logger.info 'EyesTargetLocator.window()'\n logger.info 'Making preparaions...'\n on_will_switch.will_switch_to_window name_or_handle\n logger.info 'Done! Switching to window..'\n __getobj__.window name_or_handle\n logger.info 'Done!'\n driver\n end",
"def exit_session\n @window.dispose\n @viewport.dispose\n ShellOptions.save\n end",
"def clean_pot\n refresh\n ConfirmationWindow.yes if click_on 'Clean'\n sleep 4\n end",
"def close_message_window\n return unless @message_window\n while $game_temp.message_window_showing\n Graphics.update\n yield if block_given?\n @message_window.update\n end\n end",
"def wait_until_element_disappears(type, name, timeout: 5)\n \t\twait = Selenium::WebDriver::Wait.new(timeout: timeout)\n \t\twait.until { !@selenium_driver.find_element(type, name).visible? }\n\tend",
"def close_window(close_loc = :current, active_loc = nil)\n if @browser.windows.count == 1\n # doesn't matter what they enter, bc closing the only window of a browser\n # instance causes the browser to crash\n @browser.close\n end\n\n\n if close_loc == :current\n # if the current window is being closed, we have to move to another before closing it\n if active_loc.nil?\n # if new active window is unspecified, make the previous window the new active one\n self.switch_to_previous_window\n else\n self.switch_to_window(active_loc)\n end\n else\n # a specific window to be closed has been specified (though it may still be the active one)\n if close_loc[0..3] == 'url=' or close_loc[0..5] == 'title='\n if @browser.window(parse_location(close_loc)).current?\n # if the current window is being closed, we have to move to another before closing it\n if active_loc.nil?\n # if new active window is unspecified, make the previous window the new active one\n self.switch_to_previous_window\n else\n self.switch_to_window(active_loc)\n end\n end\n @browser.window(parse_location(close_loc)).close\n else\n # assume close_loc is an integer\n # since Robot Framework sends all args as text, the above check for\n # \"url=\" and \"title=\" is the best we can do to ensure argument correctness\n close_loc = close_loc.to_i\n # the number of the window\n # user-facing numbers are 1-based, internal we use 0-based because @browser.windows\n # is a Ruby array, so minus 1\n window_id = close_loc - 1\n if window_id == -1\n # either the user has been too smart for his/her own good and thinks the windows are 0-based,\n # or they've entered text that doesn't match 'url=' or 'title=', in which case\n # the above loc.to_i will make loc equal 0\n raise(ArgumentError, \"You must provide the url or title of the window in the format 'url=' or 'title=', or you must provide the number of the window, starting with 1 for the first window opened.\")\n end\n \n if @browser.windows[window_id].current?\n # if the current window is being closed, we have to move to another before closing it\n if active_loc.nil?\n # if new active window is unspecified, make the previous window the new active one\n self.switch_to_previous_window\n else\n self.switch_to_window(active_loc)\n end\n end\n # this will throw its own error if the index is out of range\n @browser.windows[window_id].close\n end\n end\n end",
"def close \n #Self trigger window lost focus, since we are going to home\n focus_changed false, @screen_width, @screen_height\n @showing = false\n @activity.moveTaskToBack(true)\n end",
"def dialog_closed(title)\n append_to_script \"dialog_closed \\\"#{title}\\\"\"\n end",
"def pbWaitMessage\r\n return if !@briefMessage\r\n pbShowWindow(MESSAGE_BOX)\r\n cw = @sprites[\"messageWindow\"]\r\n MESSAGE_PAUSE_TIME.times do\r\n pbUpdate(cw)\r\n end\r\n cw.text = \"\"\r\n cw.visible = false\r\n @briefMessage = false\r\n end",
"def destroy\n @window.destroy\n respond_to do |format|\n format.html { redirect_to windows_url }\n format.json { head :no_content }\n end\n end",
"def remove_window(id)\n window_exist?(id)\n @windows.delete(id)\n end",
"def forget(window, *windows)\n execute_only(:forget, window, *windows)\n end",
"def onDestroy\n puts \"Fin de l'application\"\n #Quit 'propre'\n Gtk.main_quit\n end",
"def onDestroy\n puts \"Fin de l'application\"\n #Quit 'propre'\n Gtk.main_quit\n end",
"def on_buy_cancel\n @command_window.activate\n #@dummy_window.show\n @buy_window.hide\n @status_window.hide\n @status_window.item = nil\n @help_window.clear\n end",
"def close_window_with_key_press(win_name, key, *opts)\n wait_start\n key_press_direct(key, *opts)\n wait_for_window_close(win_name)\n end",
"def close_window_with_key_press(win_name, key, *opts)\n wait_start\n key_press_direct(key, *opts)\n wait_for_window_close(win_name)\n end",
"def status_window aconfig={}, &block\n sw = StatusWindow.new aconfig\n sw.win.name = \"WINDOW::status_window\"\n return sw unless block_given?\n begin\n yield sw\n ensure\n sw.destroy if sw\n end\nend",
"def windowWillClose(notification)\n OSX::NSApp.terminate(self)\n end",
"def windowWillClose(notification)\n OSX::NSApp.terminate(self)\n end",
"def buttonCancel__clicked(*a)\n @builder[:window1].destroy\n end",
"def destroy\n @window = Window.find(params[:id])\n @window.destroy\n\n respond_to do |format|\n format.html { redirect_to(windows_url) }\n format.xml { head :ok }\n end\n end",
"def test_delete_other_windows\n w = selected_window\n elvar.window_min_height = 1\n split_window\n split_window \n delete_other_windows\n assert(one_window_p)\n assert(eq(w, selected_window))\n end",
"def test_canceled_post\n new_window = click_privly_button\n # Close the posting privly app window\n # This should cancel the posting process\n within_window new_window do\n new_window.close\n end\n # Give some time to close the app window\n sleep 1\n # Start a new posting process\n new_window = click_privly_button\n enter_message(new_window)\n assert_successful_post(new_window)\n end",
"def wait_alert_accept_if_exist\n sleep 1.5 #should wait animation\n wait_true(timeout: 30, message: 'waiting alert dialog via wait_alert_accept_until_display_alert') {\n execute_script('$.mainApp().alert().buttons().length > 0')\n }\n alert_accept_if_exist\n end",
"def status_return\n @slot_window.unselect\n @status_window.activate\n @help_window.clear\n set_controls_help\n end",
"def cancel_command()\n # Switch Window\n @list_window.active = true\n @list_window.visible = true\n @content_window.active = false\n end",
"def manage window\n unless managed?(window)\n managed[window] = {:source_funcs => []}\n \n window.add_event_listener(\"unload\", true) do |evt|\n unmanage(window)\n end\n end\n end",
"def get_window_object()\n driver.manage.window\nend",
"def unmanage window\n if h=managed[window]\n h[:source_funcs].each do |sf|\n sf.remove()\n end\n \n managed.delete window\n end\n end",
"def get_window_object()\n driver.manage.window\nend",
"def new_window(name)\n execute_script(%(\n var w = Math.max(\n document.documentElement.clientWidth, window.innerWidth || 0\n );\n var h = Math.max(\n document.documentElement.clientHeight, window.innerHeight || 0\n );\n window.open(\"about:blank\", arguments[0], `width=${w},height=${h}`);\n ), name)\n end",
"def wait_for_pdf_window(string)\n Timeout.timeout(Nenv.browser_timeout) do\n loading = true\n while loading\n check = url_match(string, RouteHelper.browser.windows.last.use.url)\n loading = false if check\n sleep(1)\n end\n return true\n end\n rescue Timeout::Error => e\n raise \"Timeout waiting for window to load - #{e}\"\n exit\n end"
] |
[
"0.6529077",
"0.6529077",
"0.63900715",
"0.63900715",
"0.6167899",
"0.61269265",
"0.6011314",
"0.59972215",
"0.59348774",
"0.5908893",
"0.5896044",
"0.5846541",
"0.5822378",
"0.5799336",
"0.578633",
"0.57769644",
"0.5776008",
"0.57602465",
"0.5691111",
"0.5643618",
"0.5623003",
"0.5610654",
"0.5591274",
"0.5591274",
"0.5562378",
"0.5551707",
"0.5534186",
"0.5518576",
"0.5515523",
"0.5502856",
"0.5488261",
"0.54815763",
"0.5448599",
"0.5443693",
"0.54108614",
"0.5408169",
"0.540449",
"0.53849286",
"0.5366597",
"0.53649116",
"0.5358565",
"0.5357492",
"0.5353707",
"0.5331919",
"0.53305227",
"0.5330036",
"0.5299814",
"0.52969974",
"0.52826524",
"0.52750623",
"0.5273434",
"0.52356935",
"0.5234684",
"0.5232299",
"0.52261233",
"0.518957",
"0.5182273",
"0.5174522",
"0.51654476",
"0.5141876",
"0.51247585",
"0.51182026",
"0.5108951",
"0.50964046",
"0.5085922",
"0.5071292",
"0.5051824",
"0.50516003",
"0.50383",
"0.5033107",
"0.5032846",
"0.5020466",
"0.5018677",
"0.5016498",
"0.5015105",
"0.50097525",
"0.4992749",
"0.49764183",
"0.4969749",
"0.49666622",
"0.49666622",
"0.49666464",
"0.4950952",
"0.4950952",
"0.49368334",
"0.49263254",
"0.49263254",
"0.49220246",
"0.4886853",
"0.48793778",
"0.48774725",
"0.48609495",
"0.4852232",
"0.48463082",
"0.48447573",
"0.4844165",
"0.48340437",
"0.48330882",
"0.48157743",
"0.48141372"
] |
0.7175282
|
0
|
Complete the repeatedString function below.
|
def repeatedString(s, n)
s.count('a') * (n / s.size) + s[0, n % s.size].count('a')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def repeat string, number=2\n\trepeated = \"\"\n\tcur_index = 0\n\n\tnumber.times do\n\t\trepeated += string\n\n\t\tif cur_index != number - 1\n\t\t\trepeated += \" \"\n\t\tend\n\n\t\tcur_index += 1\n\tend\n\n\trepeated\nend",
"def repeatedString(s, n)\n length = s.length\n\n repeat_count = n / length\n\n remainder = n % length\n\n count_a(s) * repeat_count + count_a(s[0...remainder])\nend",
"def repeater(str)\n repeated_str = ''\n\n str.each_char do |char|\n repeated_str << char * 2\n end\n\n repeated_str\nend",
"def encode_repeating(my_string)\n return my_string if !my_string || my_string.length < 2\n current, check_next = 0, 1\n until current == my_string.length\n check_next += 1 while my_string[current] == my_string[check_next]\n repeats = check_next - current\n if repeats > 2\n my_string[current + 1] = repeats.to_s\n check_next -= my_string.slice!((current + repeats.to_s.length + 1)...check_next).length\n end\n current = check_next\n end\n return my_string\nend",
"def encode_repeating(my_string)\n\n return nil if my_string.nil?\n\n start = 0\n\n until my_string[start].nil?\n\n count = 1\n\n while my_string[start + count] == my_string[start]\n count += 1\n end\n\n if count < 3\n start += count\n else\n my_string[start + 1] = count.to_s\n my_string.slice!(start + 2, count - 2)\n start += 2\n end\n\n end\n\n return my_string\n\nend",
"def repeater(string)\n doubled = ''\n characters = string.chars\n size = characters.size\n counter = 0\n\n while counter < size\n doubled = doubled + string[counter] + string[counter]\n\n counter += 1\n end\n\n doubled\nend",
"def repeat_str n, s\n s * n\nend",
"def repeatedString(s, n)\n s.count('a') * n.div(s.size) + s.slice(0,n.remainder(s.size)).count('a')\nend",
"def repeat_string (string1, limit)\r\n\t\t1.upto(limit).each do |i|\r\n\t\t\tputs string1\r\n\t\tend\r\n\tend",
"def repeat_str (n, s)\n string = ''\n n.times do\n string << s\n end\n return string\nend",
"def encode_repeating(my_string)\n return nil if my_string.nil?\n return my_string if my_string.length <= 1\n\n i = 0\n j = 0\n k = 0\n while j <= i && i < my_string.length\n k = i\n if my_string[i] != my_string[i + 1]\n my_string[j] = my_string[i]\n\n else\n counter = 1\n while my_string[i] == my_string[i + 1]\n i += 1\n counter += 1\n end\n\n if counter == 2\n my_string[j] = my_string[k]\n my_string[j + 1] = my_string[k]\n else\n my_string[j] = my_string[k]\n my_string[j + 1] = counter.to_s\n end\n j += 1\n end\n j += 1\n i += 1\n end\n\n my_string[j...my_string.length] = \"\"\n return my_string\nend",
"def repeat_str (n, s)\r\n return s * n\r\nend",
"def repeat_str (n, s)\n s * n\nend",
"def repeat_str (n, s)\n s * n\nend",
"def repeater(repetition = 1, string = \"No string was given :(\")\n repetition.times { p string }\nend",
"def repeat_string(str, i)\n return \"\" if (i <= 0)\n return str if (i == 1)\n d = repeat_string(str, i >> 1)\n d += d\n d += str if (i & 1)\n return d\n end",
"def encode_repeating(my_string)\r\n i = 0\r\n j = 0\r\n letter = my_string[i]\r\n while i < my_string.length\r\n j += 1 while my_string[j + 1] == letter\r\n if j - i >= 2\r\n my_string[(i + 1)..j] = (j - i + 1).to_s\r\n end\r\n additional = 0\r\n additional = 1 if j > i\r\n i += 1 + additional\r\n j = i\r\n letter = my_string[i]\r\n end\r\n return my_string\r\nend",
"def repeat_str (n, s)\n s*n\nend",
"def repeatedString(s, n)\n count = s.count(\"a\")\n rep = (n / s.length)\n if n % s.length != 0\n short_s = s.slice(0, n % s.length)\n return (count * rep) + short_s.count(\"a\")\n else\n return (count * rep)\n end\n \nend",
"def rampant_repeats(string, hash)\n new_str = \"\"\n string.each_char do |char| \n if hash[char]\n hash[char].times { new_str += char }\n else\n new_str += char\n end\n end\n new_str\nend",
"def repeat_str(n, s)\n return s * n\nend",
"def repeat(string, nrepeats = 2)\n output = ((string + \" \")*nrepeats).sub(/ $/, '')\n end",
"def repeater(string)\n new_string = ''\n string.chars.each do |char|\n 2.times { new_string << char }\n end\n new_string\nend",
"def encode_repeating(my_string)\r\n return my_string if my_string.length < 3\r\n\r\n engaged = false\r\n counter = 3\r\n n = 0\r\n\r\n while n + 2 < my_string.length\r\n if (engaged && my_string[n] == my_string[n+2]) || (my_string[n] == my_string[n+1] && my_string[n] == my_string[n+2])\r\n engaged = true\r\n my_string[n+1..n+2] = \"#{counter}\" #THIS LINE!\r\n counter += 1\r\n else\r\n engaged = false\r\n counter = 3\r\n n += 1\r\n end\r\n end\r\n\r\n return my_string\r\nend",
"def repeatedString(s, n)\n # First approach times out\n # s = s * ((n/s.length)+1)\n # p s[0..n-1].count('a')\n a_count = s.count('a')\n times_to_repeat = ((n/s.length))\n num_a_in_string = a_count * times_to_repeat\n leftover = (n%(s.length))\n num_a_in_string += s[0..leftover-1].count('a') if leftover >= 1\n p num_a_in_string\nend",
"def repeat(string, num)\n new_string = \"\"\n num.times do\n new_string += string\n end\n new_string\nend",
"def repeater(string)\n doubled_str = ''\n string.size.times do |i|\n doubled_str << string[i] * 2\n end\n doubled_str\nend",
"def rampant_repeats(string, hash)\n new_str = \"\"\n string.each_char do |char|\n if hash.key?(char)\n hash[char].times { new_str += char }\n else\n new_str += char \n end\n end\n new_str\nend",
"def repeat(str, nb=0)\n\tstrBase = str\n\tif nb < 1\n\t\treturn str+ \" \" +strBase\n\telse\n\t\t(nb-1).times do |i|\n\t\t\tstr += \" \" +strBase\n\t\tend\n\tend\n\n\treturn str\nend",
"def repeat something, *rest\n if rest.length == 0\n return something + \" \" + something\n\n elsif not rest[0].to_i == 0\n number = rest[0].to_i\n repetitions = \"\"\n number.times do \n repetitions += something + \" \"\n end\n end\n repetitions.chop # remove last space \n # something + \" \" + something \nend",
"def repeater(string)\n string.chars.map! { |char| char * 2 }.join('')\nend",
"def rampant_repeats(str, hash)\n new_str = ''\n str.each_char do |char|\n if hash.has_key?(char)\n hash[char].times do\n new_str << char\n end\n else\n new_str << char\n end\n end\n new_str\nend",
"def rampant_repeats(str, hash)\n new_str = \"\"\n str.each_char do |char|\n if hash.has_key?(char)\n hash[char].times { new_str += char }\n else\n new_str += char\n end\n end\n new_str\nend",
"def repeater(string)\n doubled_str = \"\"\n string.each_char do |char|\n doubled_str << char << char\n # doubled_str.concat(char*2)\n # doubled_str.concat(char, char)\n end\n \n doubled_str\nend",
"def repeat(text , num=2)\n #text = text.chars\n val = \"\"\n i = 0\n for i in (1..num)\n val = text + \" \"+ val\n end\n return val.rstrip\n \nend",
"def encode_repeating(my_string)\n puts my_string\n\n if my_string == \"\" || my_string == nil || my_string.length == 0\n return my_string\n end\n\n\n new_arr = []\n hash = {}\n i = 0\n while i < my_string.length\n\n char = my_string[i]\n print char\n\n if hash[char]\n hash[char] += 1\n else\n hash[char] = 1\n end\n\n i += 1\n\n end\n\n puts hash\n\n\n hash.each do |k, v|\n if v <= 2\n v.times do\n new_arr << k\n end\n elsif v > 2\n new_arr << k\n new_arr << v\n end\n end\n\n puts new_arr\n puts new_arr.join\n\n my_string = new_arr.join\n return my_string\n # raise NotImplementedError\nend",
"def rampant_repeats(str, hash)\n\n new_str = \"\"\n\n str.each_char { |char| new_str += char * ( hash[char] || 1) }\n\n new_str\n\nend",
"def repeater(string)\n doubled = ''\n count = 0\n\n until count == string.length\n doubled << string[count] * 2\n count += 1\n end\n doubled\nend",
"def repeatedString(s, n)\n char_array = s.split('')\n count_of_a_in_string = 0\n char_array.each do |letter|\n if letter == \"a\"\n count_of_a_in_string += 1\n end\n end\n\n factor = n/s.length()\n reminder = n % s.length()\n count_of_a_in_final_string = factor * count_of_a_in_string\n\n reminder.times do |index|\n count_of_a_in_final_string += 1 unless s[index] != \"a\"\n end\n count_of_a_in_final_string\nend",
"def repeat(string, num = 2)\n\treturn ((string + \" \") * num).strip\nend",
"def repeatedString(s, n)\n len = s.length\n times = n / len\n nb = times * s.count('a')\n\n last = s[0..(n % len)]\n nb += last.count('a') if len != 1\n nb\nend",
"def encode_repeating(my_string)\r\n puts \"NOT IMPLEMENTED\"\r\nend",
"def encode_repeating(my_string)\n raise NotImplementedError\nend",
"def repeater(string)\n string.chars.map { |el| el * 2 }.join\nend",
"def repeater(repetitions, text)\n display_text = \"\"\n repetitions.times { display_text += text }\n display_text\nend",
"def encode_repeating(my_string)\n # return if nil or empty\n return if (my_string == nil || my_string.length == 0)\n\n entering_index = 0 # this is where characters will get replaced\n examining_index = 0 # this is where the current character is getting examined and counted\n length = my_string.length\n while examining_index < length # all n characters will be examined\n temp = my_string[examining_index] # current character\n count = 1 # current character count\n while my_string[examining_index+1] == temp && examining_index < length\n examining_index += 1 # increment index\n count += 1 # increment current character count\n end\n # update at entering_index on seeing the subsequent character changing\n if count > 2 # enter the current character followed by it's count\n my_string[entering_index] = my_string[examining_index]\n entering_index += 1\n my_string[entering_index] = count.to_s\n entering_index += 1\n elsif count == 2 # enter the current character twice\n count.times do\n my_string[entering_index] = my_string[examining_index]\n entering_index += 1\n end\n else # count == 1, enter the current character once\n my_string[entering_index] = my_string[examining_index]\n entering_index += 1\n end\n examining_index += 1 # move to next character\n end\n\n # delete trailing characters in the string.\n count = length - entering_index\n count.times do # worst case: delete n-2 number of characters\n my_string.slice! entering_index # trim the string\n end\n return\nend",
"def repeater(string)\n doubled_string = []\n\n string.chars.each do |char|\n doubled_string << char * 2\n end\n\n doubled_string.join\nend",
"def repeater(string)\n new_string = ''\n string.chars.each do |char|\n new_string << char << char\n end\n new_string\nend",
"def rampant_repeats(str, hash)\n repeated = \"\"\n # iterate through str chars, if chars is in hash.keys, add to output chars * key.value\n str.each_char do |letter|\n if hash.keys.include?(letter)\n repeated += letter * hash[letter]\n else\n repeated += letter\n end\n end\n\n repeated\nend",
"def repeat (string, number = 2)\n # .cycle calls the array (number) of times\n # .to_a on an array, converts to an array object (words on their own line)\n # .join(' ') puts string together \"word word word\"\n [string].cycle(number).to_a.join(' ')\nend",
"def unrepeat\n searched = ''\n unsearched = dup\n dupe = match(/(.+)\\1+/)\n # Dupe[0] = pattern found, [1] group found\n\n until unsearched.empty?\n return searched + unsearched unless dupe\n\n location = unsearched.index(dupe[0])\n searched += unsearched[0..location - 1] if location > 0\n searched += if dupe[0].squeeze.length > 1 && dupe[0].has_letters? # &&\n # ([' ', ',', '.'].include?(dupe[0][0]) || dupe[1].length > 8)\n dupe[1]\n else\n dupe[0]\n end\n unsearched = unsearched[location + dupe[0].length..]\n dupe = unsearched.match(/(.+)\\1+/)\n end\n searched\n end",
"def repeater(string)\n new_str = ''\n\n string.chars.each { |x| new_str << x * 2 }\n new_str\nend",
"def repeater(string)\r\n new_string = \"\"\r\n string.each_char { |char| new_string << char*2 }\r\n new_string\r\nend",
"def rampant_repeats(str, hash)\n str.chars.map { |c| hash.key?(c) ? c * hash[c] : c }.join\nend",
"def repeat_copy(str, n = 1)\n return str * n\nend",
"def repeater(string, n)\n string * n\nend",
"def repeater(string)\n string.chars.map do |char|\n char + char\n end.join\nend",
"def repeater(string)\n string.chars.map { |char| char + char }.join\nend",
"def repeat (n, s)\n\t\tres = \"\"\n\t\tfor i in 0...n\n\t\t\tres << s\n\t\tend\n\t\treturn res\n\tend",
"def repeater(string)\n string.chars.map{ |char| char * 2 }.join\nend",
"def rampant_repeats(str, hash)\n new_str = \"\"\n\n str.each_char do |char|\n if hash.has_key?(char)\n new_str += char * hash[char]\n else\n new_str += char\n end\n end\n new_str\nend",
"def repeat(string, n)\n return if n <= 0\n\n i = 0\n result = ''\n until i == n\n if i == n - 1\n result << string\n else\n result << string << \"\\n\"\n end\n i += 1\n end\n result\nend",
"def repeat (string, n=2)\n\tresult = \"\"\n\tn.times{result += string + \" \"}\n\treturn result.chomp(\" \")\nend",
"def repeater(text)\n double_string = ''\n text.each_char { |char| double_string << char * 2 }\n double_string\nend",
"def repeatedString(s, n)\n num_a = s.count(\"a\")\n if num_a == 0\n return 0\n end\n slen = s.length\n total = num_a*(n/slen)\n total += s[0...n%slen].count(\"a\")\nend",
"def num_repeats(string)\r\n idx_str = 0\r\n idx2 = idx_str+1\r\n counter = 0\r\n repeated_letter = \"\"\r\n while idx_str < string.length\r\n if !repeated_letter.include? string[idx_str]\r\n while idx2 < string.length\r\n if string[idx_str] == string[idx2]\r\n repeated_letter += string[idx_str]\r\n counter +=1\r\n break\r\n end\r\n idx2 +=1\r\n end\r\n end\r\n idx_str += 1\r\n idx2 = idx_str+1\r\n end\r\n return counter\r\nend",
"def repeater(string)\n string.chars.zip(string.chars).join\nend",
"def repeat(message, num_repeats=2)\n\tret = \"\"\n\tnum_repeats.times do |i|\t\t\n\t\tret << message + \" \"\n\tend\n\n\t#removes trailing space\n\tret[0..-2]\nend",
"def repeated_substring(str)\n 0.upto(str.size / 2) do |end_idx|\n slice = str[0..end_idx]\n repeat_nums = str.size / slice.size\n return true if slice * repeat_nums == str\n end\n false\nend",
"def repeater(string)\n doubled = \"\"\n single_chars = string.chars\n single_chars.each do |char|\n doubled_char = char * 2\n doubled << doubled_char\n end\n doubled\nend",
"def num_repeats(string)\nend",
"def repeatedString(s, n)\r\n # Write your code here\r\n numOfA = 0\r\n index = 0\r\n \r\n if s.length == 1 && s[0] == 'a'\r\n return n\r\n elsif s.length == 1 && s[0] != 'a'\r\n return 0\r\n \r\n else\r\n firstRoundUpperLimit = n < s.length ? n : s.length\r\n \r\n for i in 0 ... firstRoundUpperLimit\r\n if s[i] === 'a'\r\n numOfA = numOfA + 1\r\n end\r\n end\r\n\r\n if (numOfA > 0 && n > s.length) \r\n repeatingOccurrences = (n / s.length) - 1\r\n remainingOccurrences = n % s.length\r\n\r\n\r\n\r\n numOfA = numOfA + (numOfA * repeatingOccurrences)\r\n\r\n for j in 0 ... remainingOccurrences\r\n if s[j] === 'a'\r\n numOfA = numOfA + 1\r\n end\r\n end\r\n end\r\n\r\n \r\n end\r\n return numOfA\r\nend",
"def repeater(str)\n [str.chars, str.chars].transpose.join\nend",
"def repeater(str)\n str.gsub(/(.)/, '\\1\\1')\nend",
"def repeater(str)\n str.gsub(/(.)/, '\\1\\1')\nend",
"def repeater(str)\n new_str = ''\n return new_str if str.eql?('')\n str.chars.each do|char|\n new_str << char * 2\n end\n new_str\nend",
"def rampant_repeats(string, hash)\n new_str = ''\n\n string.each_char do |char|\n if hash.has_key?(char)\n new_str += (char*hash[char])\n else\n new_str += char\n end\n end\n new_str\nend",
"def repeat(str, n = 2)\n arr = []\n n.times {arr << str}\n arr.join(\" \")\nend",
"def rampant_repeats(str, hash)\n n_str = ''\n str.each_char do |char|\n if hash.has_key?(char) \n n_str += char * hash[char]\n else\n n_str += char\n end\n end\n n_str\nend",
"def repeatedString(s, n)\n remainder_matches = 0\n\n length = s.length\n puts 'length: %d' % [length]\n\n matches = s.scan('a').count\n puts 'matches: %d' % [matches]\n\n quotient = n / length\n puts 'quotient: %d' % [quotient]\n\n remainder = n % length\n puts 'remainder: %d' % [remainder]\n\n remainder.times.each\\\n {|idx|\n remainder_matches += 1 if s[idx] == 'a'\n }\n puts 'remainder_matches: %d' % [remainder_matches]\n\n return matches*quotient + remainder_matches\nend",
"def repeater(string)\n result = \"\"\n string.each_char { |char| result << char * 2}\n result\nend",
"def repeater(string)\r\n result = \"\"\r\n string.chars.each do |letter|\r\n result << letter * 2\r\n end\r\n result\r\nend",
"def repeater(string)\n result = ''\n string.each_char { |char| result << char * 2 }\n result\nend",
"def num_repeats(string)\n \nidx1 = 0 #Made a counter for first loop\nidx2 = 0 #Made another counter for the second loop\nrepeat_count = 0 #Assigned a variable to tally the number of letters that had repeated in the string\ncurrent_repeat_count= []\nidx3 = 0\n while idx1 < string.length #The characters in the string will be scanned over and over again until it reaches the string.length\n idx2 = idx1 + 1 #the the second loop will always be 1 element ahead of the idx1 to scan them properly\n \n while idx2 < string.length #Same logic with the first loop\n unless current_repeat_count[idx3] == string[idx2]\n if string[idx1] == string[idx2] #if the current element of idx1 is the same with the current element of idx2, \n current_repeat_count << string[idx2]\n repeat_count = repeat_count + 1# repeat_count will increase by 1 each time\n end\n end\n \n idx2 = idx2 + 1 #idx2 will increase by 1 to go to the next element\n end\n idx1 = idx1 + 1 #after the first round of the first element pairs up with the rest of the elements, 1 will be added \n end #to go the next element to be compared with the rest\n \n return repeat_count #once it's done, the code returns the tally of repeated letters. \n\nend",
"def repeater(str)\n str.chars.map { |char| char * 2 }.join\nend",
"def repeater(str)\n str.chars.map { |char| char * 2 }.join\nend",
"def repeater(str)\n str.chars.map { |char| char * 2 }.join\nend",
"def repeater(str)\n str.chars.map { |char| char * 2 }.join\nend",
"def repeater(str)\n str.chars.map { |char| char * 2 }.join\nend",
"def repeat(string, number)\n number.times do\n p string\n end\nend",
"def repeater(str)\n\n str.chars.map {|char| char*2}.join\n\nend",
"def repeat(word, times=2)\n\t((word+\" \")*times).rstrip\nend",
"def crunch(string)\n array = string.chars\n no_repeats = []\n no_repeats.push(array[0])\n for i in 0..(array.size - 1)\n no_repeats.push(array[i+1]) if array[i] != array[i+1]\n end\n\n no_repeats.join\nend",
"def repeater(string)\n result = ''\n string.each_char do |char|\n result << char << char\n end\n result\nend",
"def repeater(string)\n result = ''\n string.each_char do |char|\n result << char << char\n end\n result\nend",
"def repeater(str)\n str.chars.map { |chr| chr * 2}.join\nend",
"def isRepeated? subString, str\n\n if str.length % subString.length != 0 then return false end\n\n n = subString.length\n max_repetitions = str.length / n\n (0...max_repetitions).each do |i|\n if str[n*i, n] != subString then return false end\n end\n return true\nend",
"def num_repeats(string)\n\tcount = 0\n\tdix = 0\n\tnew = \"\"\n\twhile dix < string.length\n\t\tletter = string[dix]\n\t\tunless new.include?(letter)\n\t\t\tnew = new + letter\n\t\telse\n\t\t #...\n\t\tend\n\t\tdix2 = dix + 1\n\t\twhile dix2 < string.length\n\t\t\tif letter == string[dix2]\n\t\t\t\tcount +=1\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tdix2 +=1\n\t\tend\n\t\tdix += 1\n\tend\n\tputs(count.to_s)\n\treturn count\n\n\nend",
"def repeat_it(string,n)\n string.is_a?(String) ? string*n : \"Not a string\"\nend",
"def repeater2(string)\n result = '' \n string.each_char do |char|\n result << char << char\n end\n result\nend"
] |
[
"0.7409544",
"0.73620594",
"0.7344852",
"0.7297813",
"0.72317034",
"0.7213885",
"0.7204186",
"0.71674633",
"0.7156461",
"0.71371734",
"0.7105521",
"0.7101094",
"0.7099628",
"0.7099628",
"0.7096589",
"0.7067445",
"0.70617074",
"0.7046145",
"0.7039972",
"0.7015746",
"0.6985153",
"0.69644386",
"0.69465095",
"0.6943096",
"0.6941293",
"0.6899886",
"0.68744105",
"0.68741304",
"0.6834865",
"0.6827855",
"0.67956233",
"0.67935646",
"0.6792739",
"0.6782787",
"0.67760766",
"0.6775225",
"0.67648506",
"0.6747199",
"0.67398685",
"0.6732007",
"0.6717891",
"0.67169297",
"0.6703434",
"0.66944367",
"0.6685915",
"0.6670286",
"0.66696674",
"0.66665655",
"0.6644555",
"0.6641847",
"0.66387725",
"0.6635208",
"0.66324675",
"0.66178226",
"0.6608058",
"0.6607396",
"0.66073465",
"0.6602579",
"0.65993357",
"0.6599291",
"0.65989536",
"0.6598752",
"0.65986085",
"0.6596632",
"0.6593142",
"0.6581098",
"0.65724427",
"0.65640295",
"0.65587544",
"0.6557355",
"0.6554291",
"0.6549275",
"0.6528087",
"0.6525132",
"0.6525132",
"0.65136784",
"0.6513008",
"0.65110403",
"0.65109676",
"0.64987713",
"0.6498366",
"0.6481709",
"0.6477388",
"0.64652026",
"0.6452875",
"0.6452875",
"0.6452875",
"0.6452875",
"0.6452875",
"0.6452015",
"0.64506304",
"0.64387697",
"0.64344305",
"0.64292294",
"0.64292294",
"0.6422782",
"0.6416447",
"0.6409522",
"0.6400796",
"0.6399965"
] |
0.7067652
|
15
|
2. Nothing will be printed to the screen because the block is never activated with a call method. 3. Exception handling handles any errors within our code and it solves the problem of not ending our program when an error is encounterd. 4. Modify the code from example 2 so that it will execute properly:
|
def execute(&block)
block.call
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def error_handler(*args)\r\n puts \"1. Doing this, then yielding to the block\"\r\n yield\r\n # The following will run only if there wasn't an error.\r\n # Otherwise, we move straight to +rescue+\r\n puts \"3b. The block has finished running without an error\"\r\nrescue StandardError => ex\r\n puts ex.message\r\n puts \"4. If an error was raised, we retry this entire method, so ..\\n\"\r\n retry\r\nend",
"def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [yp searcher] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end",
"def protect_runtime_errors # &block\n\t\tbegin\n\t\t\tyield\n\t\trescue StandardError => e\n\t\t\t# switch states first, in case extra messages need to be printed to contexualize the actual exception\n\t\t\tself.runtime_error()\n\t\t\t\n\t\t\t\n\t\t\t# keep execption from halting program,\n\t\t\t# but still output the exception's information.\n\t\t\tprint_wrapped_error(e)\n\t\t\t\n\t\t\t\n\t\tend\n\tend",
"def safe_loop &block\n begin\n loop &block\n rescue => ex\n $log.debug( \"APP.rb rescue reached \")\n $log.debug( ex) if ex\n $log.debug(ex.backtrace.join(\"\\n\")) if ex\n ensure\n close\n # putting it here allows it to be printed on screen, otherwise it was not showing at all.\n if ex\n puts \"========== EXCEPTION ==========\"\n p ex \n puts \"===============================\"\n puts(ex.backtrace.join(\"\\n\")) \n end\n end\n end",
"def raise_and_rescue\n begin\n\tputs 'This is Before Exception Arise!'\n\n\t # using raise to create an exception\n\t raise 'Exception Created!'\n puts 'After Exception'\n\n # using Rescue method\n rescue\n\t puts 'Finally Saved!'\n\tend\n\nputs 'Outside from Begin Block!'\t\nend",
"def continued_exception; end",
"def raise_exception\n\tbegin\n\t\tputs \"I am before the raise 1\"\n\t\traise 'An error has occured during the process'\n\t\tputs 'After the raise'\n\trescue\n\t\tputs 'Rescued for the first time'\n\tend\nend",
"def raise_and_rescue \n begin \n puts 'Before the raise.' \n raise 'An error occured.' \n puts 'After the raise.' \n rescue \n puts 'Code rescued.' \n end \n puts 'After the begin block.' \n end",
"def exit_exception; end",
"def header(&block)\n puts \"This is our hedaer\"\n block.call\nrescue\n puts \"This is where we would rescue an error.\"\nensure\n puts \"This is our footer.\"\nend",
"def sample()\n begin\n puts \"do something\"\n rescue # can define type of error here if wanted\n puts \"we hit an error!\"\n retry # this will restart from the beginning of the begin body\n else\n puts \"else hit\"\n ensure\n puts \"ensure this please\"\n end\nend",
"def with_error_handling\n yield\n rescue => error\n report_error(error)\n Process.exit(false)\n end",
"def protect_runtime_errors # &block\n\t\tbegin\n\t\t\tyield\n\t\trescue StandardError => e\n\t\t\t# keep execption from halting program,\n\t\t\t# but still output the exception's information.\n\t\t\tprocess_snippet_error(e)\n\t\t\t\n\t\t\tunload(kill:true)\n\t\t\t# ^ stop further execution of the bound @wrapped_object\n\t\tend\n\tend",
"def standard_exception_handling\n begin\n yield\n rescue SystemExit => ex\n # Exit silently with current status\n raise\n rescue OptionParser::InvalidOption, ArgumentError => ex\n $stderr.puts ex.message\n exit(false)\n rescue Exception => ex\n # Exit with error message\n display_error_message(ex)\n exit(false)\n end\n end",
"def standard_exception_handling\n begin\n yield\n rescue SystemExit => ex\n # Exit silently with current status\n raise\n rescue OptionParser::InvalidOption => ex\n $stderr.puts ex.message\n exit(false)\n rescue Exception => ex\n # Exit with error message\n display_error_message(ex)\n exit(false)\n end\n end",
"def standard_exception_handling\n begin\n yield\n rescue SystemExit => ex\n # Exit silently with current status\n @task_queue.stop\n raise\n rescue OptionParser::InvalidOption => ex\n # Exit silently\n @task_queue.stop\n exit(false)\n rescue Exception => ex\n # Exit with error message\n name = \"pwrake\"\n $stderr.puts \"#{name} aborted!\"\n $stderr.puts ex.message\n if Rake.application.options.trace\n $stderr.puts ex.backtrace.join(\"\\n\")\n else\n $stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || \"\"\n $stderr.puts \"(See full trace by running task with --trace)\"\n end\n @task_queue.stop\n exit(false)\n end\n end",
"def block_try2(num)\n yield\n puts \"do fourth. num is [#{num}]\"\nend",
"def raise_exception \n puts 'I am before the raise.' \n raise 'An error has occuredzzzz' \n puts 'I am after the raise' \nend",
"def program_logger(block_description, &block)\n\n puts \"Started block #{block_description}.\"\n result = block.call\n puts \"#{block_description} finished, returning: #{result}\"\n\nend",
"def execute_and_rescue\n begin\n yield if block_given?\n rescue SystemExit\n end\nend",
"def recoverable_error e, msg = \"Error\", bt = []\n puts \"#{msg} at time #{clock}\"\n puts \"From \" + bt[0..2].join(\"\\n \") unless bt.empty\n puts \" ...\" if bt.length > 3\n shell.run\n end",
"def one\n too { yield }\nendbegin;1;rescue => e1;e1;end",
"def method_one\n begin\n raise \"some error\"\n rescue\n puts \"got an error\"\n end\nend",
"def continued_exception=(_arg0); end",
"def execute(&block)\n block.call\n puts \"End of block\"\nend",
"def try_operation(&block)\n log = \"\"\n begin\n yield(log)\n rescue Exception => e\n log << e.message + '\\n'\n success = false\n return success, log\n end\nend",
"def throw_catch_example\n catch (:end_prematurely) do\n (0..100).each do |x|\n (0..100).each do |y|\n (0..100).each do |z|\n # When the following conditions hold, this will end the loop\n # as it will go the catch line above\n throw :end_prematurely if x == 9 && y == 9 && z > 10\n puts \"x: #{x} y: #{y} z: #{z}\"\n end\n end\n end\n end\nend",
"def run_with_rescue\n begin\n yield if block_given?\n rescue SystemExit\n end\nend",
"def rescue_safely(options)\n yield\n\nrescue Object => e\n $stderr.puts('[%s] %s' % [ e.class, e ])\n\n if (options[:trace])\n $stderr.puts(e.backtrace)\n end\n\n exit(-1)\nend",
"def set_exit_exception; end",
"def call\n [false, yield]\n rescue halt => e\n [true, e.payload[0]]\n end",
"def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend",
"def handle_perform_error(_e); end",
"def demonstrate_early_return\n return\n puts \"You will never see this, because we never get here.\"\nend",
"def report_errors\n yield\n rescue Exception => e\n puts \"Exception occured while running sketch #{File.basename SKETCH_PATH}:\"\n puts e.to_s\n puts e.backtrace.join(\"\\n\")\n end",
"def use_blocker\n blocker do\n # next\n # break\n # return\n \"HA!\"\n # next\n # break\n # return\n end\n puts \"DONE!\"\nend",
"def block_try1(num, &block)\n block.call\n puts \"do second. num is [#{num}]\"\nend",
"def x\n # ...\nrescue\n # ...\nend",
"def standard_exception_handling\n begin\n yield\n rescue SystemExit => ex\n # Exit silently with current status\n exit(ex.status)\n rescue SystemExit, OptionParser::InvalidOption => ex\n # Exit silently\n exit(1)\n rescue Exception => ex\n return if ex.message =~ /Rakefile/\n # Exit with error message\n $stderr.puts \"#{name} aborted!\"\n $stderr.puts \"!> #{ex.message}\"\n if options.trace\n $stderr.puts ex.backtrace.join(\"\\n\")\n else\n $stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || \"\"\n $stderr.puts \"(See full trace by running task with --trace)\"\n end\n exit(1)\n end\n end",
"def this_has_error\n puts ''\n end",
"def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend",
"def run!\n run\n die\n end",
"def inner_method\n # code\n\n raise 'hello'\n\n # more code\nend",
"def errorhandling\n end",
"def try\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend",
"def handle_errors options = {}, &block\n begin\n yield\n rescue Exception => e\n name = caller[1][/`.*'/][1..-2]\n defaults = {puts: \"#{name} failed. See backtrace:\", and_return: nil, call: nil}\n opts = defaults.merge options\n if @logger\n @logger.message :error, \"#{opts[:puts]}\"\n else\n puts \"#{opts[:puts]}\".on_red\n end\n unless opts[:quite]\n p e\n puts e.backtrace\n end\n opts[:call].call if opts[:call].kind_of? Proc\n opts[:and_return]\n end\nend",
"def do_with_interrupt_handling\n yield if block_given?\n rescue StandardError => e\n warn HighLine.color(\"\\nAborting, fatal #{e.class}, #{e} at #{error_call_site(e)}\", :red)\n Kernel.exit(3)\n rescue Interrupt\n warn HighLine.color(\"\\nAborting, interrupt received\", :red)\n Kernel.exit(2)\n rescue RuntimeError => e\n warn HighLine.color(\"\\nAborting, fatal unhandled error, #{e} at #{error_call_site(e)}\", :red)\n Kernel.exit(1)\n end",
"def handle_error(e)\n\tputs \"#{e[\"message\"]} (#{e[\"code\"]})\"\n\texit 1\nend",
"def try_soft_loud\n begin\n yield\n rescue => e\n puts \"PROBLEM!! #{e}\"\n puts e.backtrace\n end\nend",
"def raise_exception_info\n begin\n puts 'I am before the raise.'\n raise 'An error has occured.'\n puts 'I am after the raise.'\n rescue RuntimeError => e\n puts e.message\n puts e.backtrace.inspect # 打印具体的错误位置\n end\n puts 'I am after the rescue.'\nend",
"def raise_an_exception\n puts \"Going to cause an exception.\"\n # If you include a string, this is a generic RuntimeError\n # It is not rescued.\n # An un-rescued exception will cause the current Ruby process\n # to exit with error code 1 (error code 0 indicates normal\n # execution, anything else something anomalous)\n # You can view the error code of a process in most Unix-like\n # systems by typing echo $? at the prompt after execution.\n raise \"I am the exception\"\n puts \"This line will never be executed\"\nend",
"def log(block_description, &block)\n puts \"Beginning #{block_description}...\"\n value_returned = block.call\n puts \"...#{block_description} finished, returning\"\n puts value_returned\nend",
"def safe_run()\n begin\n self.run()\n rescue Exception=>e\n\te_string = \"hmm, cron method excepted: #{e}\"\n\tprint e_string\n\tself.getSession().say( e_string )\n end\n end",
"def try\n if block_given?\n yield\n else\n puts 'no block'\n end\nend",
"def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend",
"def some_damn_method\n\tputs \"Enterng method\"\n\t1.times { puts \"Entering block!\"; return }\n\tputs \"Exiting method\" # Never gets executed!\nend",
"def run_action(&_block)\n yield\n rescue ::Zanzibar::Error => e\n @ui.error e\n abort \"Fatal error: #{e.message}\"\n end",
"def m2(x,y)\n puts x\n puts y \n begin\n puts x + y\n puts x*y\n rescue StandardError => e\n puts \"Call with integer arguments\"\n end \nend",
"def catch_exceptions; end",
"def halt; end",
"def halt; end",
"def for_broke(ci)\n begin\n ci.run\n\n rescue HaltState\n # nop\n rescue err\n puts err.message\n puts 'should not have got this'\n end\nend",
"def test\n\tputs \"Entering method\"\n\tp = Proc.new { puts \"Entering Proc\"; break }\n\tbegin \n\t\tp.call # => LocalJumpError\n\trescue \n\t\tputs \"We got an error breaking!\" \n\tend\n\tputs \"Exiting method\"\nend",
"def error(message) puts(message) || exit end",
"def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend",
"def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend",
"def log(blockDescription, &block)\n\tp \"Beginning \" + blockDescription + \"...\"\n\tp blockDescription + \" finished, returning: \" + (block.call).to_s\nend",
"def f n\n puts \"Before critical section\"\n case n\n when 0\n raise \"Error test\"\n when 1\n raise StacError, \"My error\", caller\n else\n puts \"Normal run\"\n end\n puts \"After critical section\"\nend",
"def trythese(*procs)\r\n if procs.length == 0\r\n raise \"Ahhg!\"\r\n else\r\n begin\r\n procs[0].call\r\n rescue Exception => error\r\n #puts \"ERROR: \" + error\r\n trythese(*procs[1..-1])\r\n end\r\n end\r\nend",
"def execute_with_rescue\n yield if block_given?\n rescue Interrupt\n rescue_interrupt\n rescue => error\n log_error(error)\n end",
"def raise_rescue\n begin\n puts 'I am before the raise.'\n raise 'An error has occured.'\n puts 'I am after the raise.'\n rescue RuntimeError # 指定捕获异常的类型\n puts 'I am rescue!'\n end\n puts 'I am after the rescue.'\nend",
"def soma(n1, n2)\r\n n1 + n2\r\nrescue Exception => e\r\n puts 'Erro ao excecutar o programa'\r\nend",
"def try(&block)\n begin\n yield\n rescue Errno::ETIMEDOUT, Timeout::Error, Net::HTTPNotFound\n log \"Connection Error\"\n rescue Exception => exc\n log exc.message\n log exc.backtrace\n end\n end",
"def exception_handler; end",
"def simple\n puts 'Here comes the code block!'\n yield\n puts 'There was the code block!'\nend",
"def try &bk\n yield\n rescue Exception => ex\n ex\n end",
"def abort_on_exception=(*) end",
"def __execute__\n @result = @block[*@args]\n rescue Exception => e\n @result = e\n ensure\n # Prevent multiple executions\n def self.__execute__; nil; end\n end",
"def quit_with_error( error_msg )\n puts error_msg\n exit \nend",
"def error_handler(exception)\n puts exception\n end",
"def do_yield(&block)\n begin\n block.call\n rescue Exception => e\n puts \"Exception! #{e.to_s}\"\n Rails.logger.error \"Caught exception: #{e.to_s}\"\n raise e\n end\n end",
"def catch_simple\n begin\n yield\n rescue => e\n Rails.logger.info e.message\n end\n end",
"def keep_it_in\n raise \"rawr\"\nrescue\n # ahem\nend",
"def handle_exception\n if not @error\n return\n end\n\n error_handlers = @registers['error_handlers']\n\n if error_handlers and not error_handlers.empty?\n @exec_pos = error_handlers.pop_handler\n @jumped = true\n elsif @registers['return_addr']\n # go up and try handle_exception again\n block_id, pos = @registers['return_addr']\n if not block_id\n raise @error\n end\n\n # Delete the registers of current block\n @registers_mgr.destroy @registers.id\n\n # Switch to the caller's registers\n @registers = @registers_mgr[id]\n\n # Change block and set the position\n @block = CODE_MGR.get_block(block_id)\n\n @instructions = @block.instructions\n @exec_pos = pos\n @jumped = true\n\n handle_exception\n else\n raise @error\n end\n end",
"def deffered(&block)\n progressbar.show\n thread = Thread.new do\n Thread.current[:result] = suppress { block.call }\n end\n\n loop do\n progressbar.increment\n break if thread.status === false\n\n if thread.status.nil?\n progressbar.erase_line\n say red { Manager.locale.error(self, 'execution_failed') }\n\n exit 102\n end\n\n sleep 0.3\n end\n\n case thread[:result]\n when Octokit::OneTimePasswordRequired\n progressbar.erase_line\n otp_interview\n\n return deffered(&block)\n when NilClass\n progressbar.erase_line\n say red { Manager.locale.error(self, 'empty_response') }\n\n exit 103\n when Exception\n progressbar.erase_line\n say red { thread[:result].message }\n\n exit 104\n else\n # no-op\n end\n\n thread[:result]\n end",
"def divide(a,b)\n begin\n answer = a / b\n rescue ZeroDivisionError => e\n puts e.message\n end\nend",
"def safe_run\n run\n rescue Ohai::Exceptions::Error => e\n @failed = true\n raise e\n rescue => e\n @failed = true\n logger.trace(\"Plugin #{name} threw #{e.inspect}\")\n e.backtrace.each { |line| logger.trace( line ) }\n end",
"def run(&block); end",
"def handleError(errorMessage)\n obj = ErrorMessage.new()\n obj.msgDetail = errorMessage.to_s\n obj.msgBrief = \"Error while merging sample \" + @sampleName.to_s\n obj.workingDir = Dir.pwd\n\n # hostName = EnvironmentInfo.getHostName()\n\n=begin\n if hostName != nil && !hostName.eql?(\"\")\n obj.hostName = hostName.to_s\n end\n=end\n\n puts \"CAME HERE\"\n #ErrorHandler.handleError(obj)\n exit\n end",
"def finally\n end",
"def error(*progname, &block)\n \tif block_given?\n \tRails.logger.error(*progname) { \"#{ERROR_PREFIX}#{yield}\".gsub(/\\n/,\"\\n#{ERROR_PREFIX}\") }\n else \n \tRails.logger.error \"#{ERROR_PREFIX}#{progname}\".gsub(/\\n/,\"\\n#{ERROR_PREFIX}\") \n end\n end",
"def run_failed; end",
"def __run_block\n # This may not catch concurrent calls (unless surrounded by a mutex), but\n # it's not worth trying to protect against that. It's enough to just check for\n # multiple non-concurrent calls.\n ::Kernel.raise Error, \"Cannot run async block multiple times\" unless block = @block\n\n @block = nil\n\n begin\n block.call\n rescue ::Exception => e\n WrappedException.new(e)\n end\n end",
"def log block_description, &block\n puts $space*$nesting_depth + 'Beginning \"'+block_description+'\" ...'\n $nesting_depth = $nesting_depth + 2\n value_returned = block.call\n $nesting_depth = $nesting_depth - 2 \n puts $space*$nesting_depth + '... \"'+block_description+'\" finished, returning: ' + value_returned.to_s\nend",
"def print_exception(e)\n\tputs \"error: #{e.message}\"\nend",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def main\r\n call_block {|str, num| puts str + ' ' + num.to_s}\r\n end"
] |
[
"0.6910402",
"0.6618271",
"0.65081877",
"0.6495977",
"0.64518493",
"0.63797575",
"0.636988",
"0.63443613",
"0.62977684",
"0.62615407",
"0.62134993",
"0.61981916",
"0.6192385",
"0.6188206",
"0.6161353",
"0.6140907",
"0.61098814",
"0.6099411",
"0.6065924",
"0.6051868",
"0.60333407",
"0.60182565",
"0.60157394",
"0.5998524",
"0.59783983",
"0.59499246",
"0.59488547",
"0.59467095",
"0.594189",
"0.593305",
"0.5932454",
"0.58990675",
"0.586052",
"0.58561623",
"0.58423656",
"0.5834227",
"0.583359",
"0.5831128",
"0.58144796",
"0.58135414",
"0.5813144",
"0.58116907",
"0.5806424",
"0.58001524",
"0.57914215",
"0.5790769",
"0.5774529",
"0.5772822",
"0.57644886",
"0.57593924",
"0.57501775",
"0.57485527",
"0.5746279",
"0.5735111",
"0.57311314",
"0.5728399",
"0.57213837",
"0.5716225",
"0.57047564",
"0.56920403",
"0.56920403",
"0.56756836",
"0.5674753",
"0.5673689",
"0.5672107",
"0.5672107",
"0.5669616",
"0.56583273",
"0.5655738",
"0.5647226",
"0.56466156",
"0.5642581",
"0.56303364",
"0.5624737",
"0.5621214",
"0.56209034",
"0.56182134",
"0.5617094",
"0.56164074",
"0.56158704",
"0.56149465",
"0.5609617",
"0.5597684",
"0.5595977",
"0.5586949",
"0.557893",
"0.55784875",
"0.5577592",
"0.556867",
"0.55683935",
"0.55620366",
"0.5558884",
"0.5558635",
"0.554716",
"0.554716",
"0.5545554",
"0.5545554",
"0.5545554",
"0.5545554",
"0.5545554",
"0.5541705"
] |
0.0
|
-1
|
set the grue's current_room as far as possible from the player
|
def spawn(player_room)
# get all possible paths and create a hash indexed by size
paths_to_player = self.rooms.inject({}) do |hsh, room|
path = self.class.grue_path(room, player_room, self.edges)
hsh[path.size] = path
hsh
end
# get the longest of the shortest paths
# (this is as far away as we can get)
longest_path = paths_to_player[paths_to_player.keys.max]
# get the first element of the first edge
self.current_room = longest_path.first.first
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_current_room\n if cr.defeated\n $map.level_rooms.each do |r|\n if self.bounding_box_collision?(r)\n @cr = r\n end\n end\n $map.hallways.each do |h|\n if self.bounding_box_collision?(h)\n @cr = h\n end\n end\n end\n end",
"def setCurrRoomNumber(newRoom)\n @@currentRoom=newRoom\n end",
"def set_room\n @room = current_user.rooms.find_by(id: params[:id] || params[:room_id])\n end",
"def block_room\n\t\tself.room.set_occupied\n\tend",
"def occupy_room(room)\n room.occupied = 1\n end",
"def set_room\n @room = Room.get_room(params[:id], params[:branch_id]).first\n end",
"def set_room\n @room = Room.find(params[:room_id].to_i) unless params[:room_id].nil?\n end",
"def current_room\n @room ||= Room.find(session[:current_room]) if session[:current_room]\n end",
"def set_room\n\t\t\t@room = Room.find(params[:id])\n\t\tend",
"def set_room\n @room = Room.find(params[:id])\n \n end",
"def change_current_player\n game_state.current_player_seat = next_seat\n end",
"def set_room(room_name)\n @room = find_room_by_name(room_name)\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def change_current_player\n current_player == player_1 ? @current_player = @player_2 : @current_player = @player_1\n end",
"def current_room\n if current_or_guest_user != nil and current_or_guest_user.room != nil\n current_or_guest_user.room\n else\n next_room\n end\n end",
"def change_player \n if @current_player == 0\n @current_player = 1\n elsif @current_player == 1\n @current_player = 0\n end\n end",
"def set_room\n @room = Room.find_by_id(params[:id])\n end",
"def move_to_room(room_id)\n if Room.get_room_by_id(room_id)\n @current_room_id = room_id\n update\n end\n end",
"def set_room\n @room = Room.find(params[:id])\n @server_time = Time.now.to_i\n end",
"def set_room\n @room = TmuAdmin::Room.find(params[:id])\n end",
"def set_reserved_room\n @reserved_room = ReservedRoom.find(params[:id])\n end",
"def vacate_room(room)\n room.occupied = 0\n end",
"def current_room\n Room.get_room_by_id(@current_room_id)\n end",
"def starting_room\r\n Game.instance.rooms.dig(@starting_room_id) || Game.instance.rooms.values.first\r\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def show\n gon.current_user = current_user\n gon.users = @room.users\n @new_room = Room.new\n @rooms = Room.all\n end",
"def set_room\n @room = Room.find(params[:room_id])\n end",
"def set_room\n @room = Room.find(params[:room_id])\n end",
"def update_current_player\n\t\t@current_player = @players.rotate![0]\n\tend",
"def set_room\n unless @room = @school.rooms.find_by_id(params[:id])\n redirect_to school_path(@school), :alert => \"That room does not exist.\"\n end\n end",
"def set_room\n id = params[:room_id]\n if !id\n raise \"Invalid Room Id\"\n else\n @room = Room.find(id)\n if !@room.is_active\n raise \"Invalid Room Id\"\n end\n end\n end",
"def set_current_player(player)\n\t\tself.current_player = player\n send_update\n\tend",
"def goto room, args = {}\n\t\treturn false unless (can_goto?(room) && current_room.can_goto?(room))\n\t\t@current_room = room\n\t\tgoto! @current_room\n\t\treturn @current_room\n\tend",
"def switch_current_player\n @current_player = @current_player == @player1 ? @player2 : @player1\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id])\n end",
"def set_room\n @room = Room.find(params[:id]) rescue nil\n return res_with_error(\"Room not found\", :not_found) unless @room\n end",
"def set_admin_room\n @admin_room = Room.unscoped.find(params[:id])\n end",
"def current_player_switch()\n if @current_player == 0 \n @current_player = 1\n elsif @current_player == 1 \n @current_player = 0\n end\n end",
"def set_room\n @room = current_user.rooms.find(params[:id])\n @devices_log = @room.devices.last\n end",
"def change_player\n\t\tif @current_player == @player1\n\t\t\t@current_player = @player2\n\t\t\t@opponent_player = @player1\n\t\telse\n\t\t\t@current_player = @player1\n\t\t\t@opponent_player = @player2\n\t\tend\n\tend",
"def room\n end",
"def set_admin_room\n @admin_room = Room.find(params[:id])\n end",
"def populate_room\n unless @dungeon.first_room\n @enemy = Zarta::Enemy.new(@dungeon) if enemy_spawned\n end\n @dungeon.first_room = false\n @weapon = Zarta::Weapon.new(@dungeon) if weapon_spawned\n @stairs = stairs_spawned\n end",
"def transfer(new_room)\n raise HmsErrors::Bed::CannotMoveOffWard unless self.room.ward == new_room.ward\n \n self.room = new_room\n self.save!\n true\n end",
"def set_occupied_room\n @occupied_room = OccupiedRoom.find(params[:id])\n end",
"def room\n return Cave.roomInstance(@@currentRoom-1)\n end",
"def set_room\n @launch_params = nil\n @room = nil\n @error = nil\n begin\n @room = Room.find(params[:id])\n unless cookies[@room.handler] || session['admin']\n @room = nil\n @error = { key: t('error.room.forbiden.code'), message: t('error.room.forbiden.message'), suggestion: t('error.room.forbiden.suggestion'), :status => :forbidden }\n return\n end\n @launch_params = JSON.parse(cookies[@room.handler])\n rescue ActiveRecord::RecordNotFound => e\n @error = { key: t('error.room.notfound.code'), message: t('error.room.notfound.message'), suggestion: t('error.room.notfound.suggestion'), :status => :not_found }\n end\n end",
"def switch_player\n @current_player = (@current_player == 'x' ? 'o' : 'x')\n end",
"def travel_to!(floor)\n passengers.each {|passenger| passenger.current_floor = self.current_floor}\n\nend",
"def room; end",
"def reset_game\n @current_room_id = 9\n find_room_by_id(9).isLocked = true\n find_item_by_id(8).show_item = false\n @inventory.delete(8)\n @talk_id = 18\n end",
"def room\n return self\n end",
"def set_meetingroom\n @meetingroom = @space.meetingrooms.find(params[:id])\n end",
"def set_meetingroom\n @meetingroom = @space.meetingrooms.find(params[:id])\n end",
"def magic\n room = Room.random\n return self.magic if room.name == \"Entrance\" || room.name == \"Exit\"\n @game.current_room = room.name\n\n \"You moved to another room...\\n\"\n end",
"def set_position\n if @player_correct[-1] == true\n @player_pos << (@player_pos[-1]) - 5\n else\n @player_pos << @player_pos[-1]\n end\n if @computer_correct[-1] == true\n @computer_pos << (@computer_pos[-1]) - 5\n else\n @computer_pos << @computer_pos[-1]\n end\n end",
"def set_chat_room\n @chat_room = current_user.chat_rooms.find(params[:id])\n \n end",
"def change_player\n @curr_player == @player1 ? @curr_player = @player2 : @curr_player = @player1\n end",
"def update_match_winner\n match.set_current_match_winner\n end",
"def update_rooms\n Room.find_or_create_by(name: @moving_item.room)\n end",
"def switch_player()\n\t\tif $current_player == @player1\n\t\t\t$current_player = @player2\n\t\telse \n\t\t\t$current_player = @player1\n\t\tend \n\tend",
"def change_turns\n (@current_player == @p1) ? @current_player = @p2 : @current_player = @p1\n end",
"def switch_player\n @current_player = @current_player == @players.first ? @players.last : @players.first\n end",
"def groom\n end",
"def setplayer1\r\n\t\t\t@player1 = \"O\"\r\n\t\tend",
"def switch_players!\n if current_player==player1\n @current_player=player2\n else\n @current_player=player1\n end\n end",
"def room_enter(player, value)\r\n self.synchronize do\r\n iroom = value\r\n if iroom < 0\r\n room = Room.new(player, @batch_game)\r\n @rooms << room\r\n iroom = @rooms.size - 1\r\n else\r\n room = @rooms[iroom]\r\n room.process(player, Server::CMD_ROOM_ENTER, nil)\r\n end\r\n @lobby.process(player, Server::CMD_ROOM_ENTER, iroom)\r\n end\r\n end",
"def set_grooming\n @grooming = Grooming.find(params[:id])\n end",
"def get_new_room (user_input, current_room)\n\t\tnew_location = current_room.location\n\t\tcase user_input\n\t\twhen \"N\"\t \n\t\t\t new_location[:y] +=1\n\t\twhen \"E\"\n\t\t\tnew_location[:x] +=1\n\t\twhen \"S\"\n\t\t\tnew_location[:y] -=1\n\t\twhen \"W\"\n\t\t\tnew_location[:x] -=1\n\t\tend\n\t\tnew_room = @rooms.select do |name, room|\n\t\t\troom.location == new_location\n\t\tend\n\t\treturn new_room.to_a[0][1]\n\tend",
"def roster(target)\n room_roster target.id\n end",
"def go_room(command)\n if @current_room.has_exit?(command) \n # current room has this exit \n exit_room = @current_room.get_exit(command) # return string of room name\n # Search for instance of this room\n # update current room\n @game_rooms.each do |room|\n if room.is_room?(exit_room)\n @current_room = room # update current room\n end\n end\n puts \"\\nYou have entered the #{@current_room.print_name}!\\n\"\n else \n puts \"That is not a direction you can travel.\\n\"\n end\n end"
] |
[
"0.75193226",
"0.67963445",
"0.64896613",
"0.64135283",
"0.638486",
"0.6344326",
"0.62918764",
"0.629002",
"0.62308913",
"0.6220066",
"0.61551213",
"0.61460614",
"0.61438286",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61435413",
"0.61226046",
"0.61196285",
"0.6108583",
"0.6091534",
"0.6087141",
"0.60783213",
"0.60754186",
"0.6047474",
"0.6038867",
"0.6021665",
"0.59839296",
"0.5964039",
"0.59628576",
"0.5960698",
"0.5960698",
"0.59544516",
"0.5939124",
"0.59147114",
"0.59114665",
"0.590637",
"0.5897664",
"0.58961934",
"0.58961934",
"0.58961934",
"0.58961934",
"0.58961934",
"0.58961934",
"0.58961934",
"0.58961934",
"0.587907",
"0.5805492",
"0.57680506",
"0.5759652",
"0.5756457",
"0.5740388",
"0.5737811",
"0.5731866",
"0.57318586",
"0.57238346",
"0.57135844",
"0.57008296",
"0.5699072",
"0.56839186",
"0.56815344",
"0.5671418",
"0.56680435",
"0.56640077",
"0.56640077",
"0.5661677",
"0.5644856",
"0.56175774",
"0.5615019",
"0.55981815",
"0.5567349",
"0.5557186",
"0.55323625",
"0.55319184",
"0.5525743",
"0.5521978",
"0.55113757",
"0.55039316",
"0.54968727",
"0.5492407",
"0.54894465",
"0.5482951"
] |
0.5576684
|
88
|
grue_room : string player_room : string edges : array of arrays each element has the form [room1, room2, direction]
|
def grue_path(grue_room, player_room, edges)
shortest_path = []
edges_to_check = edges.select do |arr|
arr.first == grue_room
end
unchecked_edges = edges - edges_to_check
edges_to_check.each do |e|
path = [e]
if e[1] != player_room
next_node = (e - [grue_room]).first
remaining_path = grue_path(next_node, player_room, unchecked_edges)
if remaining_path.empty?
path.clear
else
path += remaining_path
end
else
path
end
if path_distance(path) < path_distance(shortest_path)
shortest_path = path
end
end
shortest_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def spawn(player_room)\n # get all possible paths and create a hash indexed by size\n paths_to_player = self.rooms.inject({}) do |hsh, room|\n path = self.class.grue_path(room, player_room, self.edges)\n hsh[path.size] = path\n hsh\n end\n\n # get the longest of the shortest paths\n # (this is as far away as we can get)\n longest_path = paths_to_player[paths_to_player.keys.max]\n\n # get the first element of the first edge\n self.current_room = longest_path.first.first\n end",
"def traverse room, direction\n case direction.to_sym\n when :right\n return @graph[room.coords[:y]][room.coords[:x] + 1] unless room.is_right?\n when :left\n return @graph[room.coords[:y]][room.coords[:x] - 1] unless room.is_left?\n when :up\n return @graph[room.coords[:y] - 1][room.coords[:x]] unless room.is_top?\n when :down\n return @graph[room.coords[:y] + 1][room.coords[:x]] unless room.is_bottom?\n end\n\n return false\n end",
"def neighbors\n return roomAdj.to_a\n end",
"def each_room\n get_attribute(:rooms).each_pair\n end",
"def initialize\n \t@grid_w = 50\n \t@grid_h = 40\n \t@grid = []\n\t\n\t\t@player_x = 0\n\t\t@player_y = 0\n\t\t@has_enviroment_rendered=false\n\t\t#setup and fill grid with walls\n \t@grid_w.times.with_index do |x|\n \t\t@grid[x] = []\n\t\t\t@grid_h.times.with_index do |y|\n \t\t\t@grid[x][y]= 1\n \t \tend\n \tend\n\t\tmin_rooms = 2\n\t\tmax_rooms = 10\n\t\t#setup number of rooms that will exist\n\t\t@n_rooms = rand(max_rooms - min_rooms) + min_rooms\n\t\tputs \"n rooms #{@n_rooms}\"\n\t\trooms = []\n\t\t#define the size of each room\n\t\t@n_rooms.times.with_index do |room|\n\t\t\trooms[room] = make_room 8,10\n\t\tend\n\t\n\t\t#clears the walls from where rooms will be \n\t\trooms.each_with_index do |r,i| \n\t\t\t(r[:x]..r[:x] + r[:w]).each do |x|\n\t\t\t\t(r[:y]..r[:y] + r[:h]).each do |y|\n\t\t\t\t\t@grid[x][y]= 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#create pathways towards the next room\n\t\trooms.each_cons(2) do |(cur_room, next_room)|\n\t\t\t#find the center of each room \n\t\t\tcenter_x = cur_room[:x] + cur_room[:w].idiv(2)\n\t\t\tcenter_y = cur_room[:y] + cur_room[:h].idiv(2)\n\n\t\t\tnext_center_x = next_room[:x] + next_room[:w].idiv(2)\n\t\t\tnext_center_y = next_room[:y] + next_room[:h].idiv(2)\n\n\t\t\t#loops between each rooms X and Y positions \n\t\t\t#this can be approached differently\n\t\t\t(min(center_x,next_center_x)..max(center_x,next_center_x)).each do |x|\n\t\t\t\t(min(center_y,next_center_y)..max(center_y,next_center_y)).each do |y|\n\t\t\t\t\t#checking if this position is in-line with either rooms x or y centres\n\t\t\t\t\t@grid[x][y] = 0 if y == center_y || y == next_center_y || x == center_x || x == next_center_x\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@new_grid = []\n\t\t#set new grid to prune unneeded walls to improve performance\n\t\t@grid_w.times.with_index do |x|\n\t \t@new_grid[x] = []\n\t \t@grid_h.times.with_index do |y|\n \t\t\t@new_grid[x][y]= @grid[x][y]\n\t\t\tend\n\t end\n\t\t#set up values\n\t\t@grid_w.times.with_index do |x|\n \t\t@grid_h.times.with_index do |y|\n\t\t\t\t#if surrounded it should not be filled in\n\t\t\t\tif check_surrounding_tiles x,y\n\t\t\t\t\t@grid[x][y] = 0\n\t\t\t\tend\n \t\tend\n \tend\n\t\t#this will set the players starting position to a known safe area\n\t\t@player_x = rooms[0][:x] + rooms[0][:w].idiv(2)\n\t\t@player_y = rooms[0][:y] + rooms[0][:h].idiv(2)\n\t\t@grid[@player_x][@player_y] = 2\n\tend",
"def connect(room)\n \n temp=Set.new([room])\n \n #Nil arr = false\n if !@@adjToRoom[self.number-1]\n @@adjToRoom[self.number-1]=temp\n #Add connectivity to reciprocal list \n connectBiDirectional(self,room)\n else \n @@adjToRoom[self.number-1].add(room) \n connectBiDirectional(self,room)\n end \n end",
"def adjacent_rooms(map, y, x)\n \n north = map[y-1][x]\n south = map[y+1][x]\n west = map[y][x-1]\n east = map[y][x+1]\n\n [north, south, west, east]\nend",
"def get_avail_edg(player, opponent)\n taken = player + opponent # all occupied board positions\n avail_edg = @edges - (@edges & taken) # determine which edges are taken\n position = avail_edg.sample # take one of them\n end",
"def room_items(r)\n (r.z1..r.z2).each { |z|\n ((r.x1 & -16)..r.x2).step(16) { |x|\n ((r.y1 & -16)..r.y2).step(16) { |y|\n df.map_tile_at(x, y, z).mapblock.items_tg.each { |i|\n yield i if i.flags.on_ground and i.pos.x >= r.x1 and i.pos.x <= r.x2 and i.pos.y >= r.y1 and i.pos.y <= r.y2 and i.pos.z == z\n }\n }\n }\n }\n end",
"def room_items(r)\n (r.z1..r.z2).each { |z|\n ((r.x1 & -16)..r.x2).step(16) { |x|\n ((r.y1 & -16)..r.y2).step(16) { |y|\n df.map_tile_at(x, y, z).mapblock.items_tg.each { |i|\n yield i if i.flags.on_ground and i.pos.x >= r.x1 and i.pos.x <= r.x2 and i.pos.y >= r.y1 and i.pos.y <= r.y2 and i.pos.z == z\n }\n }\n }\n }\n end",
"def test_room_paths()\n \t# the parameter is the (name, description) in initialize in class Room\n \t# to create new room of center/north/south\n center = Room.new(\"Center\", \"Test room in the center.\")\n north = Room.new(\"North\", \"Test room in the north.\")\n south = Room.new(\"South\", \"Test room in the south.\")\n\n # to add path of center room\n center.add_paths({:north => north, :south => south})\n\n # check if center.go(:north) really goes to north\n assert_equal(center.go(:north), north)\n # check if center.go(:south) really goes to south\n assert_equal(center.go(:south), south)\n end",
"def get_room_lookup_table(parsed_rooms)\n room_lookup = {} \n parsed_rooms.each do |room|\n room_lookup[room[1]] = room.first\n end \n room_lookup\nend",
"def ai_strategy_edges(board)\n\t\tcounter = 0\n\t\tmove = 0\n\t\tedges = [\"2\", \"4\", \"6\", \"8\"] # Edge positions\n\t\tedges.each do |a|\n\t\t\tif @other_player_positions.include?(a) # Is the other player in an edge position?\n\t\t\t\tcounter+= 1\n\t\t\tend\n\t\tend\n\t\tif counter > 0 && board.valid_move?(\"5\") # If the other player is in an edge position and centre position is valid\n\t\t\tcounter = 0\n\t\t\tmove = \"5\" # current player moves to the centre position\n\t\tend\n\tend",
"def setup_rover_data(rover)\n data = {}\n data[:location] = {x: rover[0][0], y: rover[0][1], orientation: rover[0][2]}\n data[:movements] = rover[1].split('') # Array of movements\n data\nend",
"def room_cycle rooms, location\n x = 1\n while x != rooms.count\n puts x.to_s + ': ' + rooms[x][0]\n x = x+1\n end\nend",
"def rooms_around(room)\n # Get the person's rooms in alphabetical order\n rooms = memberships.unarchived.alpha\n\n # If there are 5 or fewer we don't need to do anything fancy\n return rooms if rooms.length <= 5\n\n # Get the index for the current room\n room_idx = rooms.index(Membership.joining(self,room).first)\n\n # By default, show two rooms on either side\n lower = room_idx-2 < 0 ? 0 : room_idx-2\n upper = room_idx+2 > rooms.length-1 ? rooms.length-1 : room_idx+2\n\n # If this room is near the bottom of the list, fill in from the top\n if lower < 2\n upper += 2-lower\n rooms = rooms[lower..upper][0,5]\n\n # If this room is near the top of the list, fill in from the bottom\n elsif rooms.length-upper < 2\n lower -= rooms.length-upper+1\n logger.debug(\"__NOW__ LENGTH: #{rooms.length}, LOWER: #{lower}, UPPER: #{upper}, IDX: #{room_idx}\")\n rooms = rooms[lower..upper][-5,5]\n\n # No need to fill, just show that subset\n else\n rooms = rooms[lower..upper]\n end\n\n rooms\n end",
"def room\n @map[@row][@col]\nend",
"def edge\n competition.matches.where(\"(player_id = ? OR opponent_id = ?) AND round = ?\", winner_id, winner_id, round + 1).first\n end",
"def roster(room)\n [user]\n end",
"def get_next_room(rooms)\n r = rooms.shift\n\n # count previous r's visited, todo fixme\n @history.reverse_each do |h|\n if h.class != r\n break\n end\n\n r = rooms.shift\n end\n\n if not r\n throw :quit\n end\n\n # todo modify methods\n\n r\n end",
"def roomAdj\n return @@adjToRoom[self.number-1]\n end",
"def find_room_in_direction(direction)\n\t\tfind_room_in_dungeon(@player.location).connections[direction]\n\tend",
"def find_room_in_direction(direction)\n\t\tfind_room_in_dungeon(@player.location).connections[direction]\n\tend",
"def print_plateau(rovers)\n (0..boundary_y).reverse_each do |y|\n grid = \"\"\n (0..boundary_x).each do |x|\n roverNames = \"\"\n rovers.each_with_index do |rover, index|\n roverNames = \" #{index+1}\" if rover.position_x == x && rover.position_y == y\n end\n grid += roverNames.empty? ? \" +\" : roverNames\n end\n puts grid\n end\n end",
"def range_from_diagram(str_arr, dir, aoe = false)\n \n if !aoe\n @tbs_spec_range = {} \n @tbs_spec_range[dir] = []\n else\n @tbs_aoe_range = {}\n @tbs_aoe_range[dir] = []\n end\n \n ox,oy = -1,-1\n \n # initial pass finds origin\n str_arr.each_with_index do |arr,i|\n arr.each_with_index do |letter,j|\n if TactBattleManager.orig_char?(letter)\n ox, oy = j, i\n end\n end\n end\n \n raise \"Invaid range in db notes for skill #{@id}.\\n\" if ox == -1 || oy == -1\n \n # second pass offsets coordinates based on origin\n str_arr.each_with_index do |arr,i|\n arr.each_with_index do |letter,j|\n \n if TactBattleManager.hit_char?(letter)\n case aoe\n when false # pos relative to player\n @tbs_spec_range[dir].push(Vertex.new(j-ox,i-oy))\n when true\n @tbs_aoe_range[dir].push(Vertex.new(j-ox,i-oy))\n end\n end # if TactBattleManager.hit_char?(letter)\n \n end # arr.each_with_index\n end # str_arr.each_with_index\n \n if aoe\n load_other_ranges(dir, @tbs_aoe_range)\n else\n load_other_ranges(dir, @tbs_spec_range)\n r = @tbs_spec_range\n @tbs_spec_range[:all] = r[:up] + r[:down] + r[:right] + r[:left]\n end\n end",
"def assign_rooms(guests)\n guests.map{|guest| \"Hello, #{guest}! You'll be assigned to room #{guests.index(guest) + 1}!\"}\nend",
"def assign_rooms(array)\n\tempty_array = []\n\tarray.each_with_index do |value, index|\n\t\tempty_array << \"Hello, #{value}! You'll be assigned to room #{index + 1}!\"\n\tend\n\treturn empty_array\nend",
"def assign_rooms(attendee)\n badges = []\n attendee.each.with_index(1) { |val,index| badges.push \"Hello, #{val}! You'll be assigned to room #{index}!\"}\n return badges\nend",
"def room_info\n ret = []\n ret << id.force_encoding('UTF-8')\n ret << name.force_encoding('UTF-8')\n ret << stage\n ret << rule\n @avatar_ids = []\n i = 0\n while i < ROOM_CAP\n temp_player_avatar = nil\n temp_player = player_array[i]\n temp_player_avatar = temp_player.current_avatar if temp_player\n if temp_player_avatar\n @avatar_ids << temp_player_avatar.id\n ret << temp_player_avatar.id\n ret << temp_player_avatar.name.force_encoding('UTF-8')\n ret << temp_player_avatar.level\n ret << temp_player_avatar.point\n ret << temp_player_avatar.win\n ret << temp_player_avatar.lose\n ret << temp_player_avatar.draw\n else\n @avatar_ids << -1\n ret << -1\n ret << -1\n ret << -1\n ret << -1\n ret << -1\n ret << -1\n ret << -1\n end\n if i < player_array.size && player_array.size == ROOM_CAP && temp_player\n if temp_player.id == AI_PLAYER_ID\n ret << CpuCardData[cpu_card_data_id].current_cards_ids\n else\n ret << temp_player_avatar.current_cards_ids\n end\n else\n ret << [-1, -1, -1]\n end\n i += 1\n end\n ret\n end",
"def neighbor_vertices\n @meeting_edges.map &:to\n end",
"def add_rooms_to_dungeon(dungeon)\n dungeon.add_room(:largecave,\n \"Large Cave\",\n \"a large cavernous cave\",\n { :west => :smallcave })\n\n dungeon.add_room(:smallcave,\n \"Small Cave\",\n \"a small, claustrophobic cave\",\n { :east => :largecave })\n\nend",
"def find_adjacent_rooms(from)\r\n return from.return_adjacent_rooms\r\n end",
"def ensure_adjacent_rooms(map)\n map.each do |row|\n x_coordinate = map.index(row)\n row.each do |room|\n index = map[row].index(room)\n puts index\n end\n\n \n # x_coordinates = row.collect! { |room| room = row.index(room) }\n \n # x_coordinates.each { |coordin| puts coordin } \n # \n # row.each { |coordin| puts coordin } \n end\nend",
"def compute_dungeon_corners\n @d_top_left_x = @d_top_left_y = @d_bottom_right_x = @d_bottom_right_y = 0\n @rooms.each do |room|\n top_left_x, top_left_y, bottom_right_x, bottom_right_y = room.room_corners\n\n @d_top_left_x = top_left_x if top_left_x < @d_top_left_x\n @d_top_left_y = top_left_y if top_left_y < @d_top_left_y\n\n @d_bottom_right_x = bottom_right_x if bottom_right_x > @d_bottom_right_x\n @d_bottom_right_y = bottom_right_y if bottom_right_y > @d_bottom_right_y\n end\n end",
"def room(file)\n line = file.gets\n rooms = 0\n if line == nil then return end\n sz, sx, sy, ex, ey = line.split(/\\s/)\n size = sz.to_i\n #Course will represents cells\n #These cells will repsents if it's open or not\n course = Array.new(size)\n course.map!{Array.new(size, \"No\")}\n \n #find_open_rooms will be a recursive method that counts\n #each open room connected each other\n def find_open_rooms(x, y, course) \n temp = 0\n if (course[x][y] != \"Yes\")\n return 0\n else \n #Makes sure it marks as Counted\n course[x][y] = \"Counted\"\n temp+=1\n if x != 0\n temp += find_open_rooms(x-1, y, course)\n end\n if x != course.size-1\n temp += find_open_rooms(x+1, y, course)\n end\n if y != 0\n temp += find_open_rooms(x, y-1, course)\n end\n if y != course.size-1\n temp += find_open_rooms(x, y+1, course)\n end\n return temp\n end \nend\n \n while line = file.gets do\n #Only looks at cell specifications\n if line[0...4] != \"path\"\n x, y, directions, w = line.split(/\\s/,4)\n # checks if all below is true\nif (directions !~ /[A-Za-ce-km-qstv-z]/ && directions.size == 4)\n if (x.to_i != 0 && y.to_i != 0 && y.to_i != size-1 && x.to_i != size-1)\n if directions =~ /l/\n if directions =~ /u/\n if directions =~ /r/\n if directions =~ /d/\n course[x.to_i][y.to_i] = \"Yes\"\n end\n end\n end\n end\n end\n end\n end\n end\n #Will go through each room and counts near open cells\n (1...size-2).each{|x|\n (1...size-2).each{ |y|\n sum = find_open_rooms(x,y,course)\n if sum > rooms\n rooms = sum\n end\n }\n }\n puts rooms\nend",
"def set_neighbors\n\t\t\t\t## Get all neighbors\n\t\t\t\t@neighbors = @data['neighbors'].map do |roomstr|\n\t\t\t\t\troomname = roomstr.to_sym\n\t\t\t\t\tif (room = Instances::Rooms::ROOMS[roomname])\n\t\t\t\t\t\tnext [roomname, room]\n\t\t\t\t\telse\n\t\t\t\t\t\t## Room doesn't exist, log warning\n\t\t\t\t\t\tclassname = get_classname\n\t\t\t\t\t\tlog \"WARNING: Room '#{classname}' tried to set Room '#{roomname}' as neighbor which doesn't exist!\"\n\t\t\t\t\t\tnext nil\n\t\t\t\t\tend\n\t\t\t\tend .reject { |x| !x } .to_h\n\t\t\tend",
"def smooth_room_access(r)\n smooth_room(r)\n r.accesspath.each { |a| smooth_room_access(a) }\n end",
"def smooth_room_access(r)\n smooth_room(r)\n r.accesspath.each { |a| smooth_room_access(a) }\n end",
"def assign_rooms(names)\n assignments = []\n rooms = (1..7).to_a\n names.each_with_index do |name, index|\n assignments.push(\"Hello, #{name}! You'll be assigned to room #{rooms[index]}!\")\n end\n return assignments\nend",
"def get_edges(script)\n edges = []\n last_scene = nil\n script.each do |scene|\n case scene[0]\n when '.' then\n edges << [last_scene, scene[1]] if last_scene\n last_scene = scene[1]\n when '<' then\n edges << [scene[1], last_scene] if last_scene\n else\n edges << [last_scene, scene[1]] if last_scene\n end\n end\n edges\nend",
"def assign_rooms(array_speakers)\n room_assignments = []\n array_speakers.each_with_index {|speaker, room| room_assignments.push \"Hello, #{speaker}! You'll be assigned to room #{room+1}!\"}\n room_assignments\nend",
"def connected_rooms\n return (self.exits.map(&:destination) + @entrances.to_a).reject{ |room| room == self }\n end",
"def assign_rooms(names)\n assignments = [];\n names.each_with_index { |name, index| assignments.push(\"Hello, #{name}! You'll be assigned to room #{index + 1}!\")};\n return assignments;\nend",
"def printer (array)\nrooms = assign_rooms(array)\nnames = batch_badge_creator(array)\nrooms.each do |room1|\n puts room1\nend\nnames.each do |name1|\n puts name1\nend\nend",
"def each_relation_edge(rg)\n rg.nodes.each { |node|\n [:src,:dst].each { |rg_level|\n next unless node.get_block(rg_level)\n node.successors(rg_level).each { |node2|\n if node2.type == :exit || node2.get_block(rg_level)\n yield IPETEdge.new(node,node2,pml_level(rg_level))\n end\n }\n }\n }\n end",
"def conversion?(dir, array)\n\t\tright_edges=@board_arr.select{|x| passed_left_edge?(x)}\n\t\tleft_edges=@board_arr.select{|x| passed_right_edge?(x)}\n\t\ttop_edges= Array(0..@board_width-1)\n\t\tbottom_edges= Array(@board.length-@board_width..@board.length-1)\n\t\t\n\t\tif array.empty?\n\t\t\treturn false\n\t\telse \n\t\t\tcase dir\n\t\t\t\n\t\t\t# If the opposite player's piece is at the top edge of the board, pieces are unable to be converted\n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"up\"\n\t\t\t\tif top_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last-@board_height)\n\t\t\t\t\treturn false \n\t\t\t\telse\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\t\n\t\t\t# If the opposite player's piece is at the bottom edge of the board, pieces are unable to be converted\n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"down\"\n\t\t\t\tif bottom_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last+@board_height)\n\t\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t\t\n\t\t\t# If the opposite player's piece is at the right edge of the board, pieces are unable to be converted\n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"right\"\n\t\t\t\tif right_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last+1)\n\t\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\treturn true\n\t\t\t\tend \n\t\t\t\t\n\t\t\t# If the opposite player's piece is at the left edge of the board, pieces are unable to be converted\n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"left\"\n\t\t\t\tif left_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last-1)\n\t\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\treturn true \n\t\t\t\tend \n\t\t\t\n\t\t\t# Right Upward Diagonal\n\t\t\t# If the opposite player's piece is at the right edge or top edge of the board, pieces are unable to be converted\n\t\t\t# Because we are checking RIGHT UPWARD diagonally, we either reach the right edge or the top edge of the board. Rarely both. \n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"RUD\"\n\t\t\t\tif top_edges.include?(array.last)|| right_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last+1-@board_height)\n\t\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t \n\t\t\t# Right Downward Diagonal \n\t\t\t# If the opposite player's piece is at the right edge or bottom edge of the board, pieces are unable to be converted\n\t\t\t# Because we are checking RIGHT DOWNWARD diagonally, we either reach the right edge or the bottom edge of the board. Rarely both. \n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"RDD\"\n\t\t\t\tif bottom_edges.include?(array.last) || right_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last+1+@board_height)\n\t\t\t\t\treturn false\n\t\t\t\telse \n\t\t\t\t\treturn true\n\t\t\t\tend \n\t\t\t \n\t\t\t# Left Downward Diagonal\n\t\t\t# If the opposite player's piece is at the left edge or bottom edge of the board, pieces are unable to be converted\n\t\t\t# Because we are checking LEFT DOWNWARD diagonally, we either reach the right edge or the bottom edge of the board. Rarely both. \n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"LDD\"\n\t\t\t\tif bottom_edges.include?(array.last)|| left_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last-1+@board_height)\n\t\t\t\t\treturn false\n\t\t\t\telse \n\t\t\t\t\treturn true \n\t\t\t\tend \n\t\t\t\n\t\t\t# Left Upward Diagonal\n\t\t\t# If the opposite player's piece is at the left edge or bottom edge of the board, pieces are unable to be converted\n\t\t\t# Because we are checking LEFT UPWARD diagonally, we either reach the left edge or the top edge of the board. Rarely both. \n\t\t\t# (Current player's pieces must SURROUND opposite player's pieces to convert pieces)\n\t\t\twhen \"LUD\"\n\t\t\t\tif top_edges.include?(array.last) || left_edges.include?(array.last)\n\t\t\t\t\treturn false\n\t\t\t\telsif empty_space?(array.last-1-@board_height)\n\t\t\t\t\treturn false\n\t\t\t\telse \n\t\t\t\t\treturn true\n\t\t\t\tend \n\t\t\tend \n\t\tend \n\tend",
"def move_r6(wins, player, opponent)\n taken = player + opponent # all occupied board positions\n open_corners = (@corners - (taken & @corners)) # all open corners\n open_edges = (@edges - (taken & @edges)) # all open edges\n if adj_cor_op_edg?(player, opponent) # if opponent has adjacent corners and opposing edge\n position = open_edges.sample # take a random open edge\n elsif adj_edg_op_cor?(player, opponent) # if opponent has adjacent edges and opposing corner\n position = open_corners.sample # take a random open corner, or use win/block/edge logic\n else\n position = win_check(wins, player, opponent) # otherwise use win/block/edge logic\n end\n end",
"def play_game\n river = \"-----,--C--,CC-CC,CC-CC\"\n river_original = river.split(',')\n\n river = river.split(',')\n\n river[0][2] = 'P' \n\n current_stage = 0\n\n while true\n if current_stage == 4\n puts \"You survived!\"\n break\n end\n\n puts river\n\n position = river[current_stage].index('P')\n\n if river_original[current_stage][position] == \"C\"\n puts \"You were eaten\" \n break\n end\n\n puts \"Type left, right or neither\"\n user_input = gets.chomp\n\n case user_input\n when \"left\" \n unless river[current_stage + 1] == nil \n river[current_stage + 1][position - 1] = 'P'\n river[current_stage] = river_original[current_stage]\n end\n \n when \"right\"\n unless river[current_stage + 1] == nil\n river[current_stage + 1][position + 1] = 'P'\n river[current_stage] = river_original[current_stage]\n end\n \n when \"neither\"\n unless river[current_stage + 1] == nil\n river[current_stage + 1][position] = 'P'\n river[current_stage] = river_original[current_stage] \n end\n end\n current_stage += 1\n end \nend",
"def other_room_str\n room_str = \"\"\n rooms.each do |room|\n room_str << \"#{room.display_str}, \"\n end\n room_str.delete_suffix(\", \")\n end",
"def rectilinear_obstruction_array(destination_row, destination_col)\n # Store initial variables\n new_row_position = current_row_index\n new_column_position = current_column_index\n obstruction_array = []\n # Determine horizontalincrements\n if new_row_position == destination_row # protector piece is on same row with king\n # begin moving across column positions\n column_increment = destination_col > new_column_position ? 1 : -1\n new_column_position += column_increment\n while (destination_col - new_column_position).abs > 0\n obstruction_array << [new_row_position, new_column_position]\n new_column_position += column_increment\n end\n elsif new_column_position == destination_col # protector piece is on same column with king\n # begin moving across row positions\n row_increment = destination_row > new_row_position ? 1 : -1\n new_row_position += row_increment\n while (destination_row - new_row_position).abs > 0\n obstruction_array << [new_row_position, new_column_position]\n new_row_position += row_increment\n end\n end\n # return obstruction array (values will be checked later )\n obstruction_array\n end",
"def room; end",
"def room\n end",
"def populate_inbound_archs\n new_vertices = []\n @a.each do |key, value|\n value[0].each do |vertex|\n # puts vertex\n # @a[vertex].insert(1, Array.new()) if @a[vertex][1] == false\n if @a[vertex]\n @a[vertex][1] << key\n # puts @a[vertex].inspect\n else\n # puts \"detected alone vertex '#{vertex}'\"\n new_vertices << [vertex, [[], [key], false]]\n end\n end\n end\n new_vertices.each do |data|\n @a[data[0]] = data[1]\n end\n end",
"def find_room_with_spaces\n available_rooms = Array.new()\n available_rooms = @rooms\n .find_all { |room| room.is_full == false}\n .map { |room| room.name }\n return available_rooms\nend",
"def random_neighbor\n if roomAdj\n # Choose neighboring adjacent room\n return roomAdj.to_a.sample \n end \n end",
"def place_room(w,h,room_id)\n \n max_tries = Dungeon::MAX_PLACEMENT_ITERATION\n c_try = 0\n while c_try < max_tries\n\n # Get the top left corner, must be even \n tli = (rand*@width).floor\n tli += 1 if tli.odd?\n tlj = (rand*@height).floor\n tlj += 1 if tlj.odd?\n\n # Check all the cells from this point are unallocated, \n # and an extra 1 width around for perimeter\n failed = false\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n if !failed\n failed = true if @cells[i][j].type != Cell::UNALLOCATED\n end\n end\n end\n\n \n # if checks ok, build the room and the perimeter\n if !failed\n\t\t\t\t# Probability falls so there are an average of 2 doors per room\n\t\t\t\tper = 2*(w+h)\n\t\t\t\tdoor_chance = Dungeon::ROOM_DOORS/per\n\n\t\t\t\t# Prep for building a logical object ready for dead end removal\n\t\t\t\troom_cells = []\n\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n @cells[i][j].type = Cell::ROOM\n @cells[i][j].room_id = room_id\n\t\t\t\t\t\t\t# If perimeter wall, assign door if random number is under the threshold\n \t\t\t\t\t\tif i == tli || i == tli+w+1 || j == tlj || j == tlj+h+1 \n @cells[i][j].type = Cell::PERIMETER \n\t\t\t\t\t\t\t\tif i.odd? || j.odd?\n\t\t @cells[i][j].type = Cell::ENTRANCE if rand < door_chance\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# Store the room cells read for assignment to logical structure\n\t\t\t\t\t\t\troom_cells << @cells[i][j];\n end\n end\n # Meet loop criterea\n c_try = Dungeon::MAX_PLACEMENT_ITERATION\n\n\t\t\t\t# Build logical object and map entrance cells to the room\n\t\t\t\troom_obj = RoomBranch.new(room_cells)\n\t\t\t\troom_cells.each { |c| room_map[c] = room_obj if c.type == Cell::ENTRANCE }\n\n end\n \n c_try += 1\n end\n \n end",
"def roster **players_with_positions\n\tplayers_with_positions.each do |player, position|\n\t\tputs \"Player: #{player}\"\n\t\tputs \"Position: #{position}\"\n\t\tputs \"\\n\"\n\tend\nend",
"def createRoom()\n\t\twidth = rand(@areaWidth * 0.5 .. @areaWidth * 0.7).floor\n\t\theight = rand(@areaHeight * 0.5 .. @areaHeight * 0.7).floor\n\t\t@room = [\n\t\t\trand(@areaX + @areaWidth * 0.15 .. @areaX + @areaWidth - width * 1.15).ceil,\n\t\t\trand(@areaY + @areaHeight * 0.15 .. @areaY + @areaHeight - height * 1.15).ceil,\n\t\t\twidth,\n\t\t\theight,\n\t\t]\n\tend",
"def transfer_scene(map,room=nil,dir=nil)\n\n\tid = map\n\tid = find_map_id(map) if map.is_a?(String)\n\troom = map if room == nil\n\t$map.setup id\n\n\n ev = gev(room)\n \n\t case dir\n\t when 'd'\n\t $player.direction = 2\n\t when 'l'\n\t $player.direction = 4\n\t when 'r'\n\t $player.direction = 6\n\t when 'u'\n\t $player.direction = 8\n\t end\n\n dx = 0\n dy = 0\n dx = 1 if $player.direction == 6\n dx = -1 if $player.direction == 4\n dy = 1 if $player.direction == 2\n dy = -1 if $player.direction == 8\n\n tx = ev.x + dx\n ty = ev.y + dy\n\n if ev.width > 1\n tx += ev.width/2\n end\n\n if ev.height > 1\n ty += ev.height/2\n end\n\n $player.moveto(tx,ty)\n\nend",
"def move_grue(direction)\n next_grue_room = @grue_room.door_destination(direction)\n\n @grue_room.move_grue_from\n @grue_room = get_room_by_name(next_grue_room)\n @grue_room.move_grue_to\n end",
"def assign_rooms(names_array)\n room_assignments_array = []\n\n names_array.each_with_index { | name, index |\n room_assignments_array.push(room_assignment_maker(name, index))\n }\n\n room_assignments_array\nend",
"def edges\n h = hedges\n v = vedges\n [ h[0], v[1], h[1], v[0] ]\n end",
"def go_room(command)\n if @current_room.has_exit?(command) \n # current room has this exit \n exit_room = @current_room.get_exit(command) # return string of room name\n # Search for instance of this room\n # update current room\n @game_rooms.each do |room|\n if room.is_room?(exit_room)\n @current_room = room # update current room\n end\n end\n puts \"\\nYou have entered the #{@current_room.print_name}!\\n\"\n else \n puts \"That is not a direction you can travel.\\n\"\n end\n end",
"def assign_rooms(guest_list)\n #each_with_index: keep track of each name provided and push the message to new array with the name and message\n room_assignments = []\n guest_list.each_with_index { |name, index| room_assignments << \"Hello, #{name}! You'll be assigned to room #{index+1}!\" }\n room_assignments\nend",
"def assign_rooms(speakers)\n assigned_rooms = []\n speakers.each.with_index(1) do |speaker, room| \n assigned_rooms << \"Hello, #{speaker}! You'll be assigned to room #{room}!\"\n end\n return assigned_rooms\nend",
"def get_oute_judgement(sente, board)\n if sente > 0\n role_value = Piece::OU\n opponent_kiki = board.gote_kikis\n else\n role_value = - Piece::OU\n opponent_kiki = board.sente_kikis\n end\n 11.upto(99).each do |point|\n piece = board.board[point]\n next if piece == Piece::WALL\n next unless piece != Piece::NONE && piece == role_value\n # this piece is ou\n # check if oute?\n move_kikis = opponent_kiki.get_move_kikis(point)\n jump_kikis = opponent_kiki.get_jump_kikis(point)\n if move_kikis.size > 0 || jump_kikis.size > 0\n return [point, move_kikis, jump_kikis]\n end\n end\n nil\n end",
"def draw_graph\n @graph = Array.new((2 * (self.down) + 1)){Array.new((2 * (self.across) + 1),\"\")}\n for i in 0..(2 * (self.down)) do\n for j in 0..(2 * (self.across)) do\n plane[i][j] == 1? graph[i][j] = '*': graph[i][j] = ' '\n end\n end\n end",
"def graph_room_list()\n return MicrosoftGraph::Places::GraphRoomList::GraphRoomListRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def edges\n @structure.reduce([]) do |acc, node|\n acc + node[1].map { |dest| [node[0], dest] }\n end\n end",
"def directions\n [\"Northbound\", \"Southbound\", \"Eastbound\", \"Westbound\"]\n end",
"def save_edges( all_edges, grid, id )\n grid.edges.each_with_index do |edge,index|\n all_edges[edge] ||= []\n all_edges[edge] << { :id => id, :orientation => index, :grid => grid }\n end\n vflip = grid.vflip\n vflip.edges.each_with_index do |edge,index|\n all_edges[edge] ||= []\n all_edges[edge] << { :id => id, :orientation => index, :grid => vflip }\n end\n hflip = grid.hflip\n hflip.edges.each_with_index do |edge,index|\n all_edges[edge] ||= []\n all_edges[edge] << { :id => id, :orientation => index, :grid => hflip }\n end\nend",
"def join_rooms\n all_caves = populate_caves\n for cave in all_caves.keys()\n join_points(all_caves[cave][0])\n end\n end",
"def groom\n end",
"def getHubCity()\n vertex = 0\n city = \"\"\n @parse.map{ |airport|\n if(airport[\"destinations\"].length > vertex)#if target has more vertex swap\n city = airport[\"name\"]\n vertex =airport[\"destinations\"].length\n end\n }\n \n puts \"The city with more connections is \" + city + \" with #{vertex}\"\n end",
"def assign_rooms(names)\n room_array = [ ]\n names.each_with_index do |name, index|\n room = index + 1\n room_array << \"Hello, #{name}! You'll be assigned to room #{room}!\" \n end \n return room_array\nend",
"def get_fellows_room_allocation(fellows)\n fellows_list = []\n fellows.each do |fellow|\n fellow_data = {}\n fellow_data[\"name\"] = fellow.name\n fellow_data[\"room\"] = fellow.room\n fellows_list.push fellow_data\n end\n return fellows_list\n end",
"def edgeu(cmd)\n $dist[cmd[0]] = cmd[1].to_i\n $neighbors[cmd[0]] = cmd[1].to_i\n client = $clients[cmd[0]]\n msg = Msg.new\n msg.setConfig(\"type\", 2)\n msg.setMessage($hostname + \" \" + cmd[1].to_i.to_s)\n sendMessage(client, msg)\n fillInNodes()\nend",
"def assign_rooms(speakers)\n speakers.each.with_index(1).collect {|speaker, index| \"Hello, #{speaker}! You'll be assigned to room #{index}!\"}\nend",
"def directions\n STRAIGHT + DIAGONAL\n end",
"def assign_rooms(speakerArray)\n messages = []\n roomNumber = 1\n speakerArray.each do |speaker|\n messages << \"Hello, #{speaker}! You'll be assigned to room #{roomNumber}!\"\n roomNumber+= 1\n end\n messages\nend",
"def create_in_direction dir\n new_room = Room.create({:created_at=>Time.now, :x=>self.x, :y=>self.y, :z=>self.z})\n \n case dir\n when \"north\",:north, 0\n new_room.y += 1\n when \"east\", :east, 1\n new_room.x += 1\n when \"south\",:south, 2\n new_room.y -= 1\n when \"west\",:west, 3\n new_room.x -= 1\n when \"up\",:up, 4\n new_room.y += 1\n when \"down\",:down, 5\n new_room.y -= 1\n end\n \n create_exit(dir, new_room, true) # two way exit\n return new_room\n end",
"def establish_world(cell_width, cell_height)\n puts \"World is #{cell_width}x#{cell_height} cells\"\n @cell_width, @cell_height = cell_width, cell_height\n\n # Outer array is X-indexed; inner arrays are Y-indexed\n # Therefore you can look up @grid[cell_x][cell_y] ...\n # However, for convenience, we make the grid two cells wider, two cells\n # taller. Then we can populate the edge with Wall instances, and treat (0,\n # 0) as a usable coordinate. (-1, -1) contains a Wall, for example. The\n # at(), put(), and cut() methods do the translation, so only they should\n # access @grid directly\n @grid = Array.new(cell_width + 2) do |cy|\n Array.new(cell_height + 2) do |cx|\n Cell.new(cx-1, cy-1)\n end\n end\n\n # Top and bottom, including corners\n (-1 .. cell_width).each do |cell_x|\n put(cell_x, -1, Wall.new(self, cell_x, -1)) # top\n put(cell_x, cell_height, Wall.new(self, cell_x, cell_height)) # bottom\n end\n\n # Left and right, skipping corners\n (0 .. cell_height - 1).each do |cell_y|\n put(-1, cell_y, Wall.new(self, -1, cell_y)) # left\n put(cell_width, cell_y, Wall.new(self, cell_width, cell_y)) # right\n end\n\n self\n end",
"def edges\n @pathway.relations.collect do |rel|\n [ rel.node[0], rel.node[1], rel.relation ]\n end\n end",
"def show_squares_between\n case direction\n when 'left'\n ['b1', 'c1', 'd1']\n when 'right'\n ['f1', 'g1']\n end\n end",
"def vertices\n end",
"def vertices\n end",
"def assign_room_for_bracket(num_rooms, teams, sorted_chairs, sorted_wings, rooms, round, format)\n\t\t \t#select a room at random for this room\n\t\t \troom = rooms.pop(); #they have already been shuffled\n\n\t\t #for now, we randomly assign teams within the bracket\n\t\t rd = RoomDraw.new(tournament_id: round.tournament[:id], round_id: round[:id], \n\t\t \t\t\t\t\t room_id: room, #it is already an id \n\t\t \t\t\t\t\t status: GlobalConstants::ROOM_DRAW_STATUS[:not_finished]);\n\n\t\t i = 0;\n\t\t while(i < GlobalConstants::FORMAT[format][:num_teams_per_room])\n\t\t #select team at random from the remaining amount\n\t\t chosen_team = teams.pop(); #the bracket was already shuffled\n\t\t #we can just pick them out in order\n\n\t\t #ensure this team has not been this position too many times\n\t\t #the position is i (0 for OG, 1 for OO, etc.)\n\t\t #SOME LOGIC\n\n\t\t #if good selection, remove from the hat\n\t\t teams.delete(chosen_team); #remove team since taken for round\n\t\t \t \n\t\t #input team into room draw\n\t\t input_team(rd, chosen_team, i, format);\n\t\t \n\t\t i = i + 1; #increment to know we have allocated a team\n\t\t end\n\n\t\t #try to save this room since we have all the info\n\t\t if !rd.save();\n\t\t \tthrow(\"Could not save RoomDraw.\");\n\t\t end\n\t\t \n\t\t #throw in the adjs based simply on rank and top room\n\t\t input_adjs(rd, sorted_chairs, sorted_wings, \n\t\t \t\t\t calculate_num_adjs(num_rooms, sorted_chairs.count, sorted_wings.count));\n\n\t \t\n\t \t@num_rooms_assigned = @num_rooms_assigned + 1;\n\t \tround.tournament.update(progress: ((@num_rooms_assigned / num_rooms.to_f) * 100));\n\t\t end",
"def walk(grid, x, y)\n [N, S, E, W].shuffle.each do |dir|\n nx, ny = x + DX[dir], y + DY[dir]\n if nx >= 0 && ny >= 0 && ny < grid.length && nx < grid[ny].length && grid[ny][nx] == 0\n grid[y][x] |= dir\n grid[ny][nx] |= OPPOSITE[dir]\n \n return [nx, ny]\n end\n end\n \n nil\nend",
"def get_room\n @key = @a_keys.shift\n find_room(@key)\n end",
"def sel_adj_edg(wins, player, opponent)\n adjacent = false # determine adjacency\n @sides.each { |side| adjacent = true if (opponent & side).size > 1 } # check if edge and corner are adjacent\n if adjacent == false # if edge and corner not adjacent, take open edge opposite opponent corner\n corner = (@corners & opponent)[0] # opponent corner\n edge = @edges & opponent # opponent edge\n op_adjedg = @adjedg[@corners.index(corner)] # pair of adjacent edges opposite to corner\n position = (op_adjedg - edge)[0] # take open edge in adjacent edges pair\n else\n position = block_check(wins, player, opponent) # otherwise edge and corner are adjacent, so block at corner\n end\n end",
"def make_adjlists(layout)\n layout.each do |edge|\n start = edge.village1\n ending = edge.village2\n color = edge.color\n type = edge.type_transit\n layout.each do |surround| \n if surround.village1 == ending && surround.village2 != start\n if surround.color == color || surround.type_transit == type\n edge.add_adjlist(surround)\n end\n end\n end\n end\nend",
"def place_room(w, h, room_id)\n\n max_tries = Dungeon::MAX_PLACEMENT_ITERATION\n c_try = 0\n while c_try < max_tries\n\n # Get the top left corner, must be even \n tli = (rand*@width).floor\n tli += 1 if tli.odd?\n tlj = (rand*@height).floor\n tlj += 1 if tlj.odd?\n\n # Check all the cells from this point are unallocated, \n # and an extra 1 width around for perimeter\n failed = false\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n if !failed\n failed = true if @cells[i][j].type != Cell::UNALLOCATED\n end\n end\n end\n\n\n # if checks ok, build the room and the perimeter\n if !failed\n # Probability falls so there are an average of 2 doors per room\n per = 2*(w+h)\n door_chance = Dungeon::ROOM_DOORS/per\n\n # Prep for building a logical object ready for dead end removal\n room_cells = []\n\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n @cells[i][j].type = Cell::ROOM\n @cells[i][j].room_id = room_id\n # If perimeter wall, assign door if random number is under the threshold\n if i == tli || i == tli+w+1 || j == tlj || j == tlj+h+1\n @cells[i][j].type = Cell::PERIMETER\n if i.odd? || j.odd?\n @cells[i][j].type = Cell::ENTRANCE if rand < door_chance\n end\n end\n\n # Store the room cells read for assignment to logical structure\n room_cells << @cells[i][j];\n end\n end\n # Meet loop criterea\n c_try = Dungeon::MAX_PLACEMENT_ITERATION\n\n # Build logical object and map entrance cells to the room\n room_obj = RoomBranch.new(room_cells)\n room_cells.each { |c| room_map[c] = room_obj if c.type == Cell::ENTRANCE }\n\n end\n\n c_try += 1\n end\n\n end",
"def rooms_list\n\t\t\t@rooms.map {|room| \"Room: #{room.id}\"}.join(\", \")\n\t\tend",
"def count_rooms\n room_count = 0\n rooms = Array.new(@width)\n rooms.each_index() do |index|\n rooms[index] = Array.new(@height, 0)\n end\n @map.each_index() do |x|\n @map[x].each_index() do |y|\n if(!is_solid?(x, y) && rooms[x][y] == 0)\n room_count += 1\n flood_fill(x, y, rooms, room_count)\n end\n end\n end\n return {:rooms => rooms, :room_count => room_count}\n end",
"def vertices\n vertices = []\n\n vertices << [(@origin[0] + @l/2.0), (@origin[1] + @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] + @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] - @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] - @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] - @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] - @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] + @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] + @h/2.0), (@origin[2] + @w/2.0)]\n\n vertices\n end",
"def find_room_in_maze(reference)\n\t\t@maze.rooms.detect{|room| room.reference == reference}\n\tend",
"def reachable\n @vertices.each do |vk, is_up|\n if is_up\n print \"#{vk}\\n\"\n if @edges_up[vk]\n @edges_up[vk].each do |ek, up_too|\n if up_too\n print \" #{ek}\\n\"\n end\n end\n end\n end\n end\n end",
"def seperateGenericRooms(roomsArray)\n i = 0\n j = 0\n genericRoomsArray = []\n while i < roomsArray.length\n if roomsArray[i].food == \"No\" #Allows computer rooms in generic rooms for practicality reasons\n genericRoomsArray[j] = roomsArray[i]\n j+=1\n end\n i+=1\n end\n return genericRoomsArray\nend",
"def twoPluses(grid)\n areas = []\n grid.each_index do |i|\n grid[i].chars.each_index do |j|\n explore(grid, i, j, areas) if grid[i][j] == 'G'\n end\n end\n areas.combination(2).map { |i,j| (i[:indexes] & j[:indexes]).empty? ? i[:area] * j[:area] : 0 }.max\nend",
"def assign_rooms(speakers)\n room_assignments = []\n speakers.each_with_index { |speaker,index| room_assignments << \"Hello, #{speaker}! You'll be assigned to room #{index+1}!\"}\n room_assignments\nend"
] |
[
"0.62335527",
"0.609226",
"0.584873",
"0.5763222",
"0.57085866",
"0.5682897",
"0.55582434",
"0.54677194",
"0.544372",
"0.544372",
"0.53926706",
"0.53339165",
"0.5329858",
"0.52780896",
"0.52700406",
"0.52458787",
"0.52248937",
"0.52089703",
"0.5196735",
"0.51926434",
"0.51824486",
"0.51624393",
"0.51624393",
"0.515329",
"0.5135351",
"0.512743",
"0.51246417",
"0.510944",
"0.50916874",
"0.507427",
"0.50667137",
"0.5054741",
"0.50445265",
"0.50403196",
"0.50360656",
"0.5010393",
"0.50075656",
"0.50075656",
"0.49972278",
"0.49920487",
"0.4991403",
"0.4990566",
"0.49772713",
"0.49420017",
"0.49390548",
"0.49342868",
"0.49311376",
"0.4927962",
"0.49222305",
"0.49079835",
"0.49030423",
"0.48996088",
"0.4875479",
"0.4870439",
"0.48664936",
"0.48615482",
"0.48553303",
"0.48482764",
"0.48479098",
"0.4847891",
"0.48350993",
"0.48315135",
"0.48311207",
"0.48270643",
"0.48178458",
"0.48161796",
"0.48081955",
"0.4800773",
"0.47858763",
"0.47771713",
"0.47766355",
"0.47742012",
"0.47730812",
"0.4767647",
"0.47550625",
"0.4751408",
"0.47382262",
"0.4735874",
"0.473465",
"0.4728421",
"0.47213608",
"0.4719106",
"0.4718128",
"0.47142354",
"0.47110626",
"0.47110626",
"0.47073567",
"0.47018355",
"0.46989363",
"0.46936452",
"0.4693248",
"0.46928203",
"0.4691389",
"0.46864432",
"0.46803004",
"0.46798924",
"0.46776462",
"0.46730205",
"0.46727705",
"0.46724933"
] |
0.7357046
|
0
|
Generate a string representing the contents of a docx file.
|
def generate
Zip::File.open(@template_path) do |template_zip|
buffer = Zip::OutputStream.write_buffer do |out|
template_zip.each do |entry|
out.put_next_entry entry.name
if @replaceable_files[entry.name]
source = entry.get_input_stream.read.sub(/(<w:body>)(.*?)(<w:sectPr)/, "\\1#{@replaceable_files[entry.name]}\\3")
out.write(source)
else
out.write(template_zip.read(entry.name))
end
end
end
buffer.string
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_docx_contents_as_string(docx, collapse: false)\n Tempfile.create(\"court_report.zip\", \"tmp\") do |file|\n file << docx.force_encoding(\"UTF-8\")\n\n xml_document = Zip::File.open(file.path) do |docx_extracted|\n docx_extracted.find_entry(\"word/document.xml\").get_input_stream.read.force_encoding(\"UTF-8\")\n end\n separate_with = collapse ? \"\" : \"\\n\"\n xml_document.gsub(/<[^>]*>+/, \"\\n\").gsub(/\\n+/, separate_with)\n end\n end",
"def doc_xml(file)\n content = nil\n Zip::Archive.open(file) do |archive|\n archive.fopen('word/document.xml') do |f|\n content = f.read\n end\n end\n content\n end",
"def convert_document_docx_to_txt(input_file, opts = {})\n data, _status_code, _headers = convert_document_docx_to_txt_with_http_info(input_file, opts)\n data\n end",
"def to_text\n unless pandoc? or docx2text?\n raise \"Cannot find either docx2txt or pandoc -- at least one must be installed\"\n end\n #################################################################################\n # Document must end in .docx (case sensitive) in order for the old jiggery-pokery\n # to work\n # This is what docx2txt does:\n # filename.docx --> filename.txt\n # filename.DOCX --> filename.DOCX.txt\n #################################################################################\n\n # Usage: /usr/bin/docx2txt [infile.docx|-|-h] [outfile.txt|-]\n # /usr/bin/docx2txt < infile.docx\n # /usr/bin/docx2txt < infile.docx > outfile.txt\n #\n # In second usage, output is dumped on STDOUT.\n #\n # Use '-h' as the first argument to get this usage information.\n #\n # Use '-' as the infile name to read the docx file from STDIN.\n #\n # Use '-' as the outfile name to dump the text on STDOUT.\n # Output is saved in infile.txt if second argument is omitted.\n #\n # Note: infile.docx can also be a directory name holding the unzipped content\n # of concerned .docx file.\n if pandoc?\n #binding.pry\n extension = File.extname(current_path)\n\n file_type = extension.downcase.delete_prefix('.').to_sym\n\n raise \"unknown file type (#{file_type})\" unless PANDOC_FILETYPES.include? file_type\n\n #txt_path = File.join( File.dirname(current_path), File.basename(current_path, extension) + '.md' )\n\n output = PandocRuby.new([current_path], from: file_type).to_commonmark\n\n File.write(current_path, output)\n else\n txt_path = current_path.sub(/docx$/i, 'txt')\n # Explicitly define destination because otherwise docx2txt is inconsistent\n # At this point the .docx is ONLY in public/uploads/tmp/\n `docx2txt < \"#{current_path}\" > \"#{txt_path}\"`\n # Still only in tmp\n File.rename txt_path, current_path\n # At some point after this, the two files get moved over to public/uploads/document/file/xxx\n end\n end",
"def parse_DOCX input_file\n\n begin\n reader = Docx::Document.open(input_file.tempfile)\n \n # Catch common error to invalid DOCX\n rescue Zip::ZipError => error\n flash[:alert] = \"Error parsing document. Is this a Word Docuemnt (docx)?\"\n return \"\"\n end\n document = Nokogiri::HTML(reader.to_html).text\n \n flash[:notice] = \"Word Document (docx) Processed.\"\n return document\n \n end",
"def extract_docx_document_xml\n extract_zip_archive_file_contents(\n 'word/document.xml'\n )\n end",
"def convert_document_docx_to_txt_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_docx_to_txt ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_docx_to_txt\"\n end\n # resource path\n local_var_path = '/convert/docx/to/txt'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'textFormattingMode'] = opts[:'text_formatting_mode'] if !opts[:'text_formatting_mode'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TextConversionResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_docx_to_txt\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def convert_document_doc_to_txt(input_file, opts = {})\n data, _status_code, _headers = convert_document_doc_to_txt_with_http_info(input_file, opts)\n data\n end",
"def text\n res = \"\"\n @contents.each{|c|\n if c.is_a? XML\n res << c.text\n elsif c.is_a? String\n res << c\n end # Ignore XML_PI/XML_Comment\n }\n res\n end",
"def doc_content\n @doc_content\n end",
"def get_content()\n if @state == RedXmlResource::STATE_LAZY\n @document = @doc_service.find_document(@doc_name)\n @state = RedXmlResource::STATE_LOADED\n end\n return \"#{@document}\"\n end",
"def to_s; \"Doc-#{target}\\n#{text}\" end",
"def generate\n po = extract_messages\n pot_path = 'rdoc.pot'\n File.open(pot_path, \"w\") do |pot|\n pot.print(po.to_s)\n end\n end",
"def documentation\n\troot = settings.root + '/doc'\n\tcontent = File.open(\"#{root}/#{@user.default_locale}.textile\", 'r').read()\n\tRedCloth.new(content).to_html\nend",
"def to_docx(tag); end",
"def convert_document_docx_to_doc(input_file, opts = {})\n data, _status_code, _headers = convert_document_docx_to_doc_with_http_info(input_file, opts)\n data\n end",
"def attributes_to_docx; end",
"def convert_document_doc_to_docx_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_doc_to_docx ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_doc_to_docx\"\n end\n # resource path\n local_var_path = '/convert/doc/to/docx'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_doc_to_docx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def convert_document_docx_to_doc_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_docx_to_doc ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_docx_to_doc\"\n end\n # resource path\n local_var_path = '/convert/docx/to/doc'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_docx_to_doc\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def convert_document_odt_to_docx(input_file, opts = {})\n data, _status_code, _headers = convert_document_odt_to_docx_with_http_info(input_file, opts)\n data\n end",
"def convert_document_rtf_to_docx(input_file, opts = {})\n data, _status_code, _headers = convert_document_rtf_to_docx_with_http_info(input_file, opts)\n data\n end",
"def split_document_docx(input_file, opts = {})\n data, _status_code, _headers = split_document_docx_with_http_info(input_file, opts)\n data\n end",
"def convert_document_doc_to_docx(input_file, opts = {})\n data, _status_code, _headers = convert_document_doc_to_docx_with_http_info(input_file, opts)\n data\n end",
"def text\n document.text\n end",
"def content\n options = { \"indent\" => \"yes\", \"encoding\" => \"UTF-8\",\n \"expand-xincludes\" => \"yes\" }\n return @client.call(\"getDocument\", @path, options)\n rescue XMLRPC::FaultException => e\n raise e\n rescue\n raise ExistException.new(\"Failed to load content of Document\", 11), callers\n end",
"def to_s\n return @doc.to_s\n end",
"def get_text_only(doc)\n text = StringIO.new\n if doc.kind_of?(Hpricot::Text)\n text.printf(\"%s\\n\", doc.to_s.strip) unless doc.to_s.strip.empty?\n else\n if doc.respond_to?(:children)\n doc.children.each do |child|\n text.printf(\" %s\", get_text_only(child))\n end\n end\n end\n text.string.strip\n end",
"def show\n @apprenticeship_type = ApprenticeshipType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apprenticeship_type }\n format.xml { render xml: @apprenticeship_type }\n # format.docx { render word: @apprenticeship_type }\n # file = Rails.root.join(\"public\",\"resources\", \"test.docx\");\n format.docx { send_file @apprenticeship_type.render_to_word, :disposition => 'attachment' }\n # format.docx { send_data @apprenticeship_type.render_to_word(), :disposition => 'attachment' }\n\n # \"#{RAILS_ROOT}/public/resources/newdoc.docx\",\n # :filename=> \"newdoc.docx\",\n # :type=>mime_type)\n\n end\n end",
"def convert_document_odt_to_docx_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_odt_to_docx ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_odt_to_docx\"\n end\n # resource path\n local_var_path = '/convert/odt/to/docx'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_odt_to_docx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def convert_document_docx_to_html_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_docx_to_html ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_docx_to_html\"\n end\n # resource path\n local_var_path = '/convert/docx/to/html'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_docx_to_html\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def exec_doc\n output = File.join('doc', 'rdoc')\n title = (PACKAGE.capitalize + \" API\").strip\n main = Dir.glob(\"README{,.txt}\", File::FNM_CASEFOLD).first\n template = config.doctemplate || 'html'\n\n opt = []\n opt << \"-U\"\n opt << \"-S\"\n opt << \"--op=#{output}\"\n opt << \"--template=#{template}\"\n opt << \"--title=#{title}\"\n opt << \"--main=#{main}\" if main\n\n if File.exist?('.document')\n files = File.read('.document').split(\"\\n\")\n files.reject!{ |l| l =~ /^\\s*[#]/ || l !~ /\\S/ }\n files.collect!{ |f| f.strip }\n opt << files\n else\n opt << main if main\n opt << [\"lib\", \"ext\"]\n end\n\n opt = opt.flatten\n\n if no_harm?\n puts \"rdoc \" + opt.join(' ').strip\n else\n #sh \"rdoc {opt.join(' ').strip}\"\n require 'rdoc/rdoc'\n ::RDoc::RDoc.new.document(opt)\n end\n end",
"def xpath_get_text(doc)\n \"#{doc}\"\n # begin\n # if doc.text? == false\n # return doc.content\n # else\n # return \"\"\n # end\n # rescue\n # return \"\"\n # end\n end",
"def to_s\n @doc.to_s\n end",
"def children_to_docx\n ''\n end",
"def doc_src\n @doc_src ||= unless doc_place\n \"no documentation available\" \n else\n file, line = doc_place\n RubyTools::extract_file_rdoc(file, line, true)\n end\n end",
"def to_docbook( *rules )\n @stack = Array.new\n @ids = Array.new\n @references = Array.new\n @automatic_content_ids = Array.new\n\n rules = DEFAULT_RULES if rules.empty?\n # make our working copy\n text = self.dup\n \n @urlrefs = {}\n @shelf = []\n @rules = rules.collect do |rule|\n case rule\n when :docbook\n DOCBOOK_RULES\n else\n rule\n end\n end.flatten\n \n # standard clean up\n incoming_entities text \n clean_white_space text \n\n # start processor\n @pre_list = []\n pre_process_docbook text\n\n no_docbook text\n docbook_rip_offtags text\n docbook_hard_break text\n\n refs text\n docbook_blocks text\n inline text\n \n smooth_offtags text\n retrieve text\n \n post_process_docbook text\n clean_html text if filter_html\n text.strip!\n \n text << \"\\n\"\n @stack.each_with_index {|sect,index| text << \"</sect#{@stack.size-index}>\\n\"}\n text << \"</chapter>\" if @chapter\n \n if (@references - @ids).size > 0\n text << %{<chapter label=\"86\" id=\"chapter-86\"><title>To Come</title>}\n (@references - @ids).each {|name| text << %!<sect1 id=\"#{name}\"><title>#{name.split('-').map {|t| t.capitalize}.join(' ')}</title><remark>TK</remark></sect1>\\n!}\n text << \"</chapter>\"\n end\n \n text\n\n end",
"def content_fulltext(page_xml, paper_title, page_title)\n page_path = Pathname.new(@source)\n basename = page_path.basename.to_s.gsub('.xml', '')\n full_text_path =\n File.join(page_path.parent, basename, paper_title, page_title)\n full_text_file = \"#{full_text_path}/fulltext.txt\"\n FileUtils.mkdir_p full_text_path\n page_text = page_xml.xpath('pagetext').map(&:content).first.to_s\n File.open(full_text_file, \"w\") { |f| f.write(page_text) }\n full_text_file.gsub Pathname.pwd.to_s + \"/\", \"\"\n end",
"def doc_file_path\n \"#{@structure[:working_path]}/docs/#{@structure[:full_relation_name]}.md\"\n end",
"def document(file_name)\n origin = File.open(\"#{file_name}\",'r')\n docs = File.open(\"docs/doc-#{file_name.split('/')[-1]}.html\",'w')\n comment = true\n script = Script.new(file_name)\n \n # Need to refactor this into some form of a rules engine. It's getting a bit hairy\n str = origin.each_line.inject(\"\") do |str, line|\n # Skip if it's a shebang\n if line =~ /^ *#!/\n str << \"\"\n \n # Blank Comment line, insert newline\n elsif line =~ /^ *# *$/\n comment = true\n str << \"\\n\"\n \n # Evaluate as text if it's a comment with spaces prior\n elsif line =~ /^ *#/\n str << \"\\n\" unless comment \n comment = true\n \n # Find the meta-information in the comments and harvest it\n if line.include? '**Author**'\n script.author = line.gsub(/^.*: /,'').chomp\n elsif line.include? '**Description**'\n script.description = line.gsub(/^.*: /,'').chomp\n elsif line.include? '**Usage**'\n script.usage = line.gsub(/^.*: /,'').chomp\n elsif line.include? '**Type**'\n script.type = line.gsub(/^.*: /,'').chomp\n end\n \n str << \"#{line.gsub(/^ *# /,'')}\"\n \n # Find the Gems used\n elsif line =~ /^ *require /\n gemname = line.gsub(/^ *require /,'').delete(\"'\").delete('\"').gsub('/','-').chomp\n # Don't add it unless it's not there or it's an absolute path\n unless ($gems.include? gemname) or (gemname =~ /^[A-Za-z]\\:/)\n $gems << gemname\n end\n \n str << \"\\n\" if comment \n comment = false\n str << \" #{line}\"\n # Evaluate as a code block if it's code\n else\n str << \"\\n\" if comment \n comment = false\n str << \" #{line}\"\n end\n end\n \n # Add the current script to the collection for indexing\n $scripts << script\n \n # The following outputs a complete documentation for each and every single script that's in the directory. Very useful if you remember to type them out properly, otherwise you get to spend a few hours fixing it. Do it right the first time, trust me.\n \n # Headers and style information\n docs.puts \"<html>\"\n docs.puts \"<link rel='stylesheet' type='text/css' href='style.css' />\"\n docs.puts \"<body>\"\n \n docs.puts \"<a href='index.html'>( << Back to Index )</a>\"\n \n # Insert the string into the docs\n docs.puts GitHub::Markdown.render(str)\n \n docs.puts \"<a href='index.html'>( << Back to Index )</a>\"\n docs.puts \"</body></html>\"\nend",
"def get_attach_file_name_docx staff_id_hash, serial_number, base_url\n\n f = File.open(\"#{Rails.root}/lib/tasks/doc_template/document.xml.rels\")\n doc = ''\n\n f.each do |line|\n doc += line\n end\n f.close\n\n # insert staff_id serial number into doc file\n new_doc = doc.gsub(/%URL%/, base_url.gsub(/%TYPE%/, SendMember::TYPE_FILE_OPEN)).gsub(/%HOST%/, \"http://#{Settings.host}\")\n file_name = \"#{Rails.root}/lib/tasks/doc_template/create/word/_rels/document.xml.rels\"\n f = File.open(file_name, 'w')\n f.write new_doc\n f.close\n docx_name = \"#{Rails.root}/lib/tasks/doc_template/send/#{Staff.decrypt(staff_id_hash)}_#{serial_number}.docx\"\n directoryToZip = \"#{Rails.root}/lib/tasks/doc_template/create/\"\n\n zf = ZipFileGenerator.new(directoryToZip, docx_name)\n zf.write()\n docx_name\n end",
"def to_s\n @doc\n end",
"def children_to_docx; end",
"def convert_document_doc_to_txt_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_doc_to_txt ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_doc_to_txt\"\n end\n # resource path\n local_var_path = '/convert/doc/to/txt'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TextConversionResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_doc_to_txt\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def support_rdoc_document_file!\n IO.read(\".document\").gsub(/^[ \\t]*#.+/m, '').split(/\\s+/)\n rescue Errno::ENOENT\n []\n end",
"def attributes_to_docx\n return '' if @attributes.nil? || @attributes.empty?\n ' ' + @attributes.map { |k, v| %(#{k}=\"#{v}\") }.join(' ')\n end",
"def create_doc(path)\n doc = File.read(path)\n @current_xml_document = doc\n Hpricot.XML(doc)\n end",
"def convert_document_xlsx_to_txt(input_file, opts = {})\n data, _status_code, _headers = convert_document_xlsx_to_txt_with_http_info(input_file, opts)\n data\n end",
"def document_snippet(doc)\n ret = nil\n File.open(\"./test 90/#{doc}\", \"r\") do |f|\n f.seek(12)\n ret = f.read(50)\n end\n return ret\nend",
"def body\n @document.to_s\n end",
"def read document_file_name\n path_to_document = File.join(items_from, document_file_name)\n \n raise DocumentNotFound unless document_exists? path_to_document\n \n ActiveDocument::FileUtils.open path_to_document\n end",
"def copy_docx_import_to_content(options)\n input_base_dir = config.compute_base_dir(options['base-dir'] || :docx_import_dir)\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(options['file-extension'] || :at_extension)\n output_base_dir = options['output'] || config.base_dir(:content_dir)\n\n Repositext::Cli::Utils.copy_files(\n input_base_dir,\n input_file_selector,\n input_file_extension,\n output_base_dir,\n options['file_filter'],\n \"Copying DOCX imported AT files to content\",\n options.merge(\n :output_path_lambda => lambda { |input_filename|\n input_filename.gsub(input_base_dir, output_base_dir)\n .gsub(/\\.docx\\.at\\z/, '.at')\n }\n )\n )\n end",
"def create_document kwargs\n title = kwargs.fetch(:title, \"Untitled\")\n template_file = kwargs.fetch(:template_file, \"#{$TEMPLATES_DIRECTORY}/input/document.adoc.erb\")\n path = kwargs.fetch(:path, \"./\")\n template_file = Pathname.new template_file\n\n # Creating the directories of the path\n path = Pathname.new path\n FileUtils.mkpath(path)\n\n file_name = kebab_case title\n path += file_name + \".adoc\"\n\n begin\n template = File.read template_file\n rescue\n template = $DEFAULT_TEMPLATE\n end\n\n # Create a binding object with the current context.\n # All variables in this function will be included.\n b = binding\n erb = ERB.new template, :trim_mode => \"-\"\n output_file = File.new path.to_s, mode = \"w+\"\n output_file.write erb.result b\n\n path\nend",
"def convert_document_docx_to_rtf(input_file, opts = {})\n data, _status_code, _headers = convert_document_docx_to_rtf_with_http_info(input_file, opts)\n data\n end",
"def show\n Iconv.open('UTF-8//IGNORE', 'UTF-8') do |ic|\n @document[:content] = ic.iconv(File.open(@document.attachment.path, 'r').read)\n end\n end",
"def convert_document_pptx_to_txt(input_file, opts = {})\n data, _status_code, _headers = convert_document_pptx_to_txt_with_http_info(input_file, opts)\n data\n end",
"def convert_document_rtf_to_docx_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_rtf_to_docx ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_rtf_to_docx\"\n end\n # resource path\n local_var_path = '/convert/rtf/to/docx'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_rtf_to_docx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def split_document_docx_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SplitDocumentApi.split_document_docx ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling SplitDocumentApi.split_document_docx\"\n end\n # resource path\n local_var_path = '/convert/split/docx'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'returnDocumentContents'] = opts[:'return_document_contents'] if !opts[:'return_document_contents'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SplitDocxDocumentResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SplitDocumentApi#split_document_docx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def render_refworks_texts(documents)\n val = ''\n documents.each do |doc|\n if doc.exports_as? :refworks_marc_txt\n val += doc.export_as(:refworks_marc_txt) + \"\\n\"\n elsif doc.exports_as? :refworks_archives\n val += doc.export_as(:refworks_archives) + \"\\n\"\n elsif doc.doc.exports_as? :refworks_dcs\n val += doc.export_as(:refworks_dcs) + \"\\n\"\n end\n end\n val\n end",
"def generate_doc\n\n end",
"def get_content(options = {})\n # TODO: Maybe port this to hpricot/nokogiri too\n text_to_parse = all_text\n \n # if xsl_file option is specified, execute transformation\n if (options[:xsl_file])\n text_to_parse = xslt_transform(file_path, options[:xsl_file])\n end\n\n # create document object\n document = REXML::Document.new text_to_parse\n \n # get content\n if ((mime_subtype == \"html\") or \n ((mime_subtype == \"xml\") and (!options.nil?) and (!options[:xsl_file].nil?)))\n content = document.elements['//body'].elements\n elsif ((mime_subtype == \"xml\") or (mime_subtype == \"hnml\"))\n content = document.root.elements\n end\n \n # adjust/replace items path\n content.each { |i| wrapItem i }\n \n # return content\n return content\n end",
"def to_docx(tag)\n prop_str = @properties.to_docx if @properties\n #\n \"<#{tag}#{attributes_to_docx}>#{prop_str}#{children_to_docx}</#{tag}>\"\n end",
"def test_get_document_with_format_and_out_path\n filename = 'test_multi_pages.docx'\n remote_name = 'TestGetDocumentWithFormat.docx'\n format = 'text'\n out_path = 'Out/TestGetDocumentWithFormat.txt'\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_common_folder + filename, \"r\").read\n @storage_api.put_create st_request\n\n request = GetDocumentWithFormatRequest.new remote_name, format, remote_test_folder + test_folder, :out_path => out_path\n result = @words_api.get_document_with_format request\n assert result.length > 0, 'Error occurred while converting document'\n end",
"def to_s\n return self.xml_header + self.xml_docs.join + self.xml_footer\n end",
"def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end",
"def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end",
"def extract_docx_styles_xml\n extract_zip_archive_file_contents(\n 'word/styles.xml'\n )\n end",
"def yardoc_file; end",
"def html\n @doc.to_s\n end",
"def html\n @doc.to_s\n end",
"def create_document\n filename = 'NewDocument.docx'\n folder = 'Word Documents'\n storage = 'Default Storage'\n\n request = PutCreateDocumentRequest.new storage, filename, folder\n result = @words_api.put_create_document request\n end",
"def document(path); end",
"def to_s\n @file_text\n end",
"def to_s\n @file_text\n end",
"def content\n return @content if @content\n\n @content = @ftp.gettextfile(@filename, nil)\n\n @content\n end",
"def convert_document_pdf_to_docx(input_file, opts = {})\n data, _status_code, _headers = convert_document_pdf_to_docx_with_http_info(input_file, opts)\n data\n end",
"def convertExcel exceldoc, fname, tmpdir\n uniqName = fname\n begin\n if File.extname(fname) == \"\"\n fname = \"#{fname}.xml\"\n else\n fname = File.basename(fname, File.extname(fname)) + \".xml\"\n end\n fname = File.join(tmpdir, fname)\n excelXML exceldoc.path, fname, @lock\n File.open(fname)\n rescue Exception => e\n errorStore(uniqName,e.message)\n false\n end\n end",
"def openoffice_content(layout_path, basename)\n filename = basename[0..(basename.index(\".\")-1)]\n template_path = \"app/views/#{params[:controller]}/#{params[:format]}/#{params[:action]}/#{basename}\"\n layout_path = \"app/views/layouts/#{params[:format]}/#{basename}\"\n temp_ref_path = \"#{params[:controller]}/#{params[:format]}/#{params[:action]}/#{filename}.xml\"\n layout_ref_path = \"layouts/#{params[:format]}/#{filename}.xml\"\n\n #each registered mime-type needs a template directory in app/views/layouts that corresponds to the mimetype. Example:\n #the template for odp can be found in app/views/layouts/odp\n\n #if there's a template in the directory, render it with the layout. if there's not, just render the layout.\n\n if File.exists?(template_path)\n #for each file, evaluate the template code to a string\n content = render_to_string(:template => temp_ref_path, :layout => layout_ref_path)\n else\n content = render_to_string(:template => layout_ref_path)\n end\n content\n end",
"def index (path)\n extension = FileUtils.extension(path).downcase\n\n if extension == 'txt'\n return IO.read(path)\n end\n\n if extension == 'html' || extension == 'htm'\n return IO.read(path)\n end\n\n tmp = self.temp('html')\n begin\n FileUtils::OpenOffice.convert(path, tmp)\n return IO.read(tmp) if File.exists?(tmp)\n rescue\n ensure\n File.delete(tmp) if File.exists?(tmp) && File.writable?(tmp)\n end\n\n ''\n end",
"def convert_document_pdf_to_docx_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_pdf_to_docx ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_pdf_to_docx\"\n end\n # resource path\n local_var_path = '/convert/pdf/to/docx'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_pdf_to_docx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def document(path)\n begin\n target_path = File.join(root_path, lang.to_s, doc_to_fs_path(path))\n doc_file = open(target_path, \"r\")\n rescue Errno::ENOENT\n raise Documentation::DocumentNotFoundError, \"No such document: #{path.inspect}, lang: #{lang} (filesystem: #{target_path.inspect})\"\n end\n\n body = doc_file.read\n Documentation::Markdown::Preprocessing.preprocess! body\n\n @renderer.reset_for_reuse!\n rendered_source = @redcarpet.render(body)\n\n Documentation::Document.new(rendered_source, @renderer.toc_root)\n end",
"def choose_file(docx)\n\tfz = list_files(docx)\n\tpayload = select_payload\n\n\tputs \"|+| #{payload} selected\"\n\tchoose do |menu|\n\t\tmenu.prompt = \"Choose File to insert XXE into:\"\n\t\tmenu.choice \"Insert Into All Files Creating Multiple OOXML Files\" do add_payload_all(fz, payload) end\n\t\tmenu.choice \"Insert Into All Files In Same OOXML File\" do add_payload_of(fz, payload,\"\") end\n\t\tmenu.choice \"Create Entity Canary\" do entity_canary(fz, payload) end\n\t\tmenu.choice \"Create XXE 'Content Types' Canary\" do entity_canary(fz, payload) end\n\t\tfz.each do |name|\n\t\t\tmenu.choice name do add_payload(name, payload) end\n\t\tend\n\tend\nend",
"def content\n\t\tif(File.file? filename)\n\t\t\tIO.readlines(filename).join ''\n\t\telse\n\t\t\t\"\"\n\t\tend\n\tend",
"def unzip_docx\n\t\t#Ruby sometimes corrupts the document when manipulating inside a compressed document, so we extract it with Zip::ZipFile\n\t\tvprint_status(\"Extracting #{datastore['SOURCE']} into memory.\")\n\t\t#we read it all into memory\n\t\tzip_data = Hash.new\n\t\tbegin\n\t\t\tZip::ZipFile.open(datastore['SOURCE']) do |filezip|\n\t\t\t\tfilezip.each do |entry|\n\t\t\t\t\tzip_data[entry.name] = filezip.read(entry)\n\t\t\t\tend\n\t\t\tend\n\t\trescue Zip::ZipError => e\n\t\t\tprint_error(\"Error extracting #{datastore['SOURCE']} please verify it is a valid .docx document.\")\n\t\t\treturn nil\n\t\tend\n\t\treturn zip_data\n\tend",
"def render_document(input, outdir, outname, format, vars)\r\n \r\n \r\n #TODO: Clarify the following\r\n # on Windows, Tempdir contains a drive letter. But drive letter\r\n # seems not to work in pandoc -> pdf if the path separator ist forward\r\n # slash. There are two options to overcome this\r\n #\r\n # 1. set tempdir such that it does not contain a drive letter\r\n # 2. use Dir.mktempdir but ensure that all provided file names\r\n # use the platform specific SEPARATOR\r\n #\r\n # for whatever Reason, I decided for 2.\r\n \r\n tempfile = input\r\n tempfilePdf = \"#{@tempdir}/x.TeX.md\".to_osPath\r\n tempfileHtml = \"#{@tempdir}/x.html.md\".to_osPath\r\n outfilePdf = \"#{outdir}/#{outname}.pdf\".to_osPath\r\n outfileDocx = \"#{outdir}/#{outname}.docx\".to_osPath\r\n outfileHtml = \"#{outdir}/#{outname}.html\".to_osPath\r\n outfileRtf = \"#{outdir}/#{outname}.rtf\".to_osPath\r\n outfileLatex = \"#{outdir}/#{outname}.latex\".to_osPath\r\n outfileText = \"#{outdir}/#{outname}.txt\".to_osPath\r\n outfileSlide = \"#{outdir}/#{outname}.slide.html\".to_osPath \r\n \r\n #todo: handle latexStyleFile by configuration\r\n latexStyleFile = File.dirname(File.expand_path(__FILE__))+\"/../../ZSUPP_Styles/default.latex\"\r\n latexStyleFile = File.expand_path(latexStyleFile).to_osPath\r\n\r\n vars_string=vars.map.map{|key, value| \"-V #{key}=#{value.esc}\"}.join(\" \")\r\n \r\n @log.info(\"rendering #{outname} as [#{format.join(', ')}]\")\r\n \r\n if $?.success? then\r\n \r\n if format.include?(\"pdf\") then\r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfilePdf)\r\n \r\n cmd=\"pandoc -S #{tempfilePdf.esc} --toc --standalone --latex-engine xelatex --number-sections #{vars_string}\" +\r\n \" --template #{latexStyleFile.esc} --ascii -o #{outfilePdf.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"latex\") then\r\n \r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfilePdf)\r\n \r\n cmd=\"pandoc -S #{tempfilePdf.esc} --toc --standalone --latex-engine xelatex --number-sections #{vars_string}\" +\r\n \" --template #{latexStyleFile.esc} --ascii -o #{outfileLatex.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"html\") then\r\n \r\n ReferenceTweaker.new(\"html\").prepareFile(tempfile, tempfileHtml)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileHtml.esc}\"\r\n \r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"docx\") then\r\n \r\n ReferenceTweaker.new(\"html\").prepareFile(tempfile, tempfileHtml)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileDocx.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"rtf\") then\r\n \r\n ReferenceTweaker.new(\"html\").prepareFile(tempfile, tempfileHtml)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileRtf.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"txt\") then\r\n \r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfileHtml)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -t plain -o #{outfileText.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"slide\") then\r\n \r\n ReferenceTweaker.new(\"slide\").prepareFile(tempfile, tempfilePdf)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --number #{vars_string}\" +\r\n \" --ascii -t dzslides --slide-level 2 -o #{outfileSlide.esc}\"\r\n `#{cmd}`\r\n end\r\n else\r\n \r\n @log.error \"failed to perform #{cmd}\"\r\n #TODO make a try catch block kere\r\n \r\n end\r\n \r\n end",
"def convert_document_docx_to_rtf_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_docx_to_rtf ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_docx_to_rtf\"\n end\n # resource path\n local_var_path = '/convert/docx/to/rtf'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_docx_to_rtf\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def convert_document_docx_to_html(input_file, opts = {})\n data, _status_code, _headers = convert_document_docx_to_html_with_http_info(input_file, opts)\n data\n end",
"def convert_document_xlsx_to_txt_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_xlsx_to_txt ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_xlsx_to_txt\"\n end\n # resource path\n local_var_path = '/convert/xlsx/to/txt'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TextConversionResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_xlsx_to_txt\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_template(file) #this is our template, defined as a single string\n s = \"\"\n File.open(file) do |f|\n f.each_line do |line|\n s.concat(line)\n end\n end\n s\nend",
"def doc(path, options = {})\n require 'nokogiri'\n\n File.open(path) do |f|\n yield Nokogiri::XML(f)\n end\n end",
"def get_content_string(options = nil)\n xml_str = ''\n get_content(options).each do |element|\n xml_str << element.to_s\n end\n xml_str\n end",
"def support_rdoc_document_file!(file = '.document')\n return [] unless use_document_file\n File.read(file).gsub(/^[ \\t]*#.+/m, '').split(/\\s+/)\n rescue Errno::ENOENT\n []\n end",
"def get_ms_office_documents(course_id)\r\n get(PATH_COURSES_MSOFFICEDOCUMENTS % [course_id])\r\n end",
"def generateDocument(input, outdir, outname, format, vars, editions=nil, snippetfiles=nil) \r\n \r\n \r\n # combine the input files\r\n \r\n temp_filename = \"#{@tempdir}/x.md\".to_osPath\r\n collect_document(input, temp_filename)\r\n \r\n # process the snippets\r\n \r\n if not snippetfiles.nil?\r\n snippets={}\r\n snippetfiles.each{|f|\r\n if File.exists?(f)\r\n type=File.extname(f)\r\n case type\r\n when \".yaml\" \r\n x=YAML.load(File.new(f))\r\n when \".xlsx\"\r\n x=load_snippets_from_xlsx(f)\r\n else\r\n @log.error(\"Unsupported File format for snipptets: #{type}\")\r\n x={}\r\n end\r\n snippets.merge!(x)\r\n else\r\n @log.error(\"Snippet file not found: #{f}\")\r\n end\r\n }\r\n \r\n replace_snippets_in_file(temp_filename, snippets) \r\n end\r\n \r\n \r\n if editions.nil?\r\n # there are no editions\r\n render_document(temp_filename, outdir, outname, format, vars)\r\n else\r\n # process the editions\r\n editions.each{|edition_name, properties|\r\n edition_out_filename = \"#{outname}_#{properties[:filepart]}\"\r\n edition_temp_filename = \"#{@tempdir}/#{edition_out_filename}.md\"\r\n vars[:title] = properties[:title]\r\n\r\n if properties[:debug]\r\n process_debug_info(temp_filename, edition_temp_filename, edition_name.to_s)\r\n lvars=vars.clone \r\n lvars[:linenumbers] = \"true\"\r\n render_document(edition_temp_filename, outdir, edition_out_filename, [\"pdf\", \"latex\"], lvars) \r\n else \r\n filter_document_variant(temp_filename, edition_temp_filename, edition_name.to_s) \r\n render_document(edition_temp_filename, outdir, edition_out_filename, format, vars) \r\n end\r\n }\r\n end\r\n end",
"def to_s\r\n\t\tbuffer_as_applesoft_file(@contents)\r\n\tend",
"def content\n PlainTextExtractor.extract_content_from(complete_path)\n end",
"def path\n http_url @store.rdoc.generator.file_dir\n end",
"def generatedDoc() \n asciidocCode = self.generateColumnDef\n #asciidocCode = asciidocCode + self.generateStoredProcDef\n return asciidocCode\n end",
"def get_doc \n @doc\n end",
"def path\n http_url RDoc::RDoc.current.generator.file_dir\n end",
"def extract_file_rdoc(file)\n source, doc, started = File.read(file), \"\", false\n source.each_line{|line|\n if /^\\s*[#]/ =~ line\n doc << line\n started = true\n elsif started\n break\n end \n }\n doc.gsub(/^\\s*[#] ?/, \"\")\n end",
"def get_ms_office_document_content(course_id, ms_office_document_id, content_path = nil)\r\n if content_path.nil?\r\n response = get_ms_office_document(course_id, ms_office_document_id)\r\n return response if response.error?\r\n\r\n json_data = JSON.parse(response.content)\r\n json_data = json_data['msOfficeDocuments'][0]\r\n contentUrl = json_data['contentUrl']\r\n relative_url = get_relative_path(contentUrl)\r\n else\r\n relative_url = PATH_COURSES_MSOFFICEDOCUMENTS_CONTENT_ % [course_id,\r\n ms_office_document_id,\r\n content_path]\r\n end\r\n get(relative_url)\r\n end"
] |
[
"0.7650872",
"0.68179494",
"0.68123615",
"0.6739059",
"0.64994353",
"0.6498318",
"0.627216",
"0.6231102",
"0.61472917",
"0.6146519",
"0.61385334",
"0.6130964",
"0.6102305",
"0.61016965",
"0.6033875",
"0.60258317",
"0.5973944",
"0.5947558",
"0.5947025",
"0.5945146",
"0.5897873",
"0.5891984",
"0.58878744",
"0.58698344",
"0.584765",
"0.5840797",
"0.5821513",
"0.5812922",
"0.57913816",
"0.5785065",
"0.574764",
"0.5717134",
"0.5715458",
"0.56748706",
"0.5662501",
"0.56591195",
"0.5632144",
"0.5630634",
"0.5629501",
"0.5627791",
"0.562143",
"0.56166035",
"0.5614129",
"0.5606102",
"0.55913657",
"0.5578661",
"0.5555466",
"0.55416685",
"0.5522934",
"0.5504254",
"0.55031705",
"0.55013067",
"0.5500683",
"0.5491797",
"0.54493254",
"0.5448432",
"0.5440532",
"0.54337966",
"0.543184",
"0.54309",
"0.54263335",
"0.54248416",
"0.54220253",
"0.5420081",
"0.5420081",
"0.5404409",
"0.54014367",
"0.538931",
"0.538931",
"0.5381597",
"0.53690076",
"0.5364487",
"0.5364487",
"0.53627783",
"0.5351886",
"0.5351436",
"0.53497684",
"0.53479075",
"0.53304267",
"0.532697",
"0.5323877",
"0.53220296",
"0.53122866",
"0.53115624",
"0.53114647",
"0.530857",
"0.52897835",
"0.5281717",
"0.52790743",
"0.52741736",
"0.52730894",
"0.5266909",
"0.5259601",
"0.52496624",
"0.52411073",
"0.5241104",
"0.5231145",
"0.52240604",
"0.5217506",
"0.52104217",
"0.52069205"
] |
0.0
|
-1
|
Called when you want to add a gem to the opal load path so it can be required on the client side.
|
def opal_gem(gem_name)
Opal.use_gem(gem_name)
Opal.paths.uniq!
# require(gem_name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_gem_paths; end",
"def add_hardcoded_gem(path)\n # make sure gem dir has a gemspec\n gemspec = File.join path, File.basename(path) + '.gemspec'\n return unless File.exists? gemspec\n # make sure gem dir has a lib dir\n libpath = File.join path, 'lib'\n return unless File.exists? libpath\n # all is ok, so add to loadpath\n @paths << libpath\n end",
"def add_self_to_load_path\n return if default_gem?\n\n paths = full_require_paths\n\n Gem.add_to_load_path(*paths)\n end",
"def require_gems; end",
"def install_gem; end",
"def add_load_path(path)\n full_path = \"#{ENV['HOME']}/.gem/#{path}\"\n\n if File.exists?(full_path)\n $: << full_path\n else\n raise(\"load path missing: #{full_path} (maybe you forgot to bundle?)\")\n end\nend",
"def add *requires\n\n # Must insert in the correct place. Activated gems should come\n # after -I and ENV[\"RUBYLIB\"]. If we can't determine the proper\n # place to insert them, just tack 'em on the end.\n\n index = paths.index(Gem::ConfigMap[:sitelibdir]) || -1\n\n paths.each_with_index do |path, i|\n if path.instance_variables.include?(:@gem_prelude_index) or\n path.instance_variables.include?('@gem_prelude_index') then\n index = i\n break\n end\n end\n\n paths.insert index, *requires\n end",
"def load_minimal_gems\r\n end",
"def require!\n super do\n gem @gem_name, @version if @version\n end\n end",
"def add_to_load_path\n Gem.source_index.load_gems_in(*Gem::SourceIndex.installed_spec_directories | [ruby_spec_path, arch_spec_path])\n end",
"def add_lib(path)\n\n\t\t\t\traise \"lib path #{path} didn't exist\" unless path.exist?\n\n\t\t\t\tui.log \"adding load path #{path}\"\n\t\t\t\t$LOAD_PATH << path\n\t\t\tend",
"def install\r\n super\r\n automated_install {\r\n @local_gems.flush_gem_cache\r\n gem_name = @override_gem_name.nil? ? installed_as_name_for( self.gem_short_name ) : @override_gem_name\r\n installed_gem = @local_gems.find( gem_name )\r\n fails_to_load gem_name if installed_gem.nil?\r\n installed_gem.activate\r\n }\r\n end",
"def add_dependency(path, dependency); end",
"def add_spec(gem_spec)\n @gems[gem_spec.full_name] = gem_spec\n end",
"def dependency(dep, ver = nil)\n @dep_loader.add_dependency dep, ver\n end",
"def add_lib_to_load_path! # :nodoc:\n [root.join('lib'), root.join('vendor', 'lib'), root.join('app', 'lib')].each do |path|\n $LOAD_PATH.unshift(path.to_s) if File.exist?(path) && !$LOAD_PATH.include?(path.to_s)\n end\n end",
"def load_gem_plugins; end",
"def do_requires()\n require 'rack'\n require './lib/my_thin.rb'\n require './android_translation_helper.rb'\nend",
"def update_load_path\n require 'bundler'\n Bundler.setup\n end",
"def add(gemspec)\n @specs << gemspec\n end",
"def require_gem(gem)\n dep = fetch(:required_gems)\n dep ||= []\n if gem.respond_to?(:each)\n dep += gem\n else\n dep << gem\n end\n set(:required_gems, dep)\n end",
"def add_gemfile\n copy_file 'static/dry/Gemfile.default', \"#{name}/Gemfile\"\n say 'Add Gemfile', :green\n end",
"def add_to_load_path #:nodoc:\n $LOAD_PATH.insert($LOAD_PATH.index(\"#{RAILS_ROOT}/lib\") + 1, *load_paths)\n end",
"def add_require(required)\n add_to(@requires, required)\n end",
"def add_plugin_path(path)\n $LOAD_PATH << path\n end",
"def install_gem\n Juwelier::Commands::InstallGem.build_for(self).run\n end",
"def do_bundler_extending\n vputs \"[**:#{@name}] #do_bundler_extending: #{@libraries}\"\n\n if defined?(::Bundler)\n vputs \"[**:#{@name}] #do_bundler_extending: Libraries: #{@libraries}\"\n\n all_global_gem_paths = Dir.glob(\"#{Gem.dir}/gems/*\")\n\n all_global_gem_paths.each do |p|\n next unless @libraries.any? { |l| p.include?(l) }\n gem_path = \"#{p}/lib\"\n # rubocop:disable Metrics/LineLength\n vputs \"[**:#{@name}] #do_bundler_extending: Adding to $LOAD_PATH: #{gem_path}\"\n # rubocop:enable\n $LOAD_PATH.unshift(gem_path)\n end\n else\n vputs %([**:#{@name}] #do_bundler_extending: Bundler not defined. Skipping.)\n end\n end",
"def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end",
"def add_gem_facts\n unless @path.directory?\n @result.is_gem = false\n return\n end\n \n path = gemspec_path\n \n if path.nil?\n @result.is_gem = false\n return\n end\n \n @result.is_gem = true\n @result.package.types << 'gem'\n \n gem = @result.gem = Result.new\n \n gem.gemspec_path = gemspec_path.to_s\n \n spec = Gem::Specification::load(gemspec_path.to_s)\n gem.name = spec.name\n gem.version = QB::Package::Version.from_gem_version spec.version\n end",
"def require( gem_name_or_path ) \n \n did_load = ::Development.require( gem_name_or_path )\n\n if did_load.nil?\n did_load = super\n end\n\n if gem_name_or_path == 'bundler'\n ::Development::Require::BundlerSupport.call\n end\n \n return did_load\n \n end",
"def pre_install; end",
"def hook_require!\n @hooking_require = true\n\n # There are two independent require methods. Joy!\n ::Kernel.module_eval do\n class << self\n orig_public_require = Kernel.public_method(:require)\n define_method(:require) do |path, *args|\n ::Bumbler::Hooks.handle_require(path) do\n orig_public_require.call(path, *args)\n end\n end\n end\n\n orig_instance_require = self.instance_method(:require)\n define_method(:require) do |path, *args|\n ::Bumbler::Hooks.handle_require(path) do\n orig_instance_require.bind(self).call(path, *args)\n end\n end\n end\n\n @hooking_require = nil\n end",
"def setup_gem(name, options)\n version = [options[:version]].compact\n lib_name = options[:lib] || name\n\n log \"activating #{name}\"\n\n Gem.activate(name, *version)\n require(lib_name)\n\n rescue LoadError\n\n install_gem(name, options)\n Gem.activate(name, *version)\n require(lib_name)\n end",
"def add_load_path(path)\n\t\t\t# Allow loading library code from lib directory:\n\t\t\t$LOAD_PATH << File.expand_path(path, site_root)\n\t\tend",
"def add_to_load_path(event) #:nodoc:\n paths = load_paths\n \n # If the load path already includes this plugin's lib path, then this plugin\n # has already been loaded (via the Rails::Initializer), so we can figure out\n # where the app paths are going\n if $LOAD_PATH.include?(lib_path)\n index = $LOAD_PATH.index(lib_path)\n \n # If we couldn't find a load path, but this isn't the last plugin that was\n # loaded, then it means that this plugin has already been loaded (via the\n # Rails::Initializer) and doesn't have a lib path. \n elsif event == :after_initialize\n plugins_after_paths = plugins_after.map(&:root)\n nearest_load_path = $LOAD_PATH.reverse.find {|path| plugins_after_paths.detect {|plugin_path| path.include?(plugin_path)}}\n \n index = ($LOAD_PATH.index(nearest_load_path || Rails.lib_path) || 0) + 1\n else\n index = ($LOAD_PATH.index(Rails.lib_path) || 0) + 1\n paths += [lib_path] if lib_path?\n end\n \n $LOAD_PATH.insert(index, *paths)\n end",
"def require(path)\n require__ path\n rescue LoadError => load_error\n begin\n @gempath_searcher ||= Gem::GemPathSearcher.new\n if spec = @gempath_searcher.find(path)\n Gem.activate(spec.name, true, \"= #{spec.version}\")\n require__ path\n else\n\traise load_error\n end\n end\n end",
"def add_gem(gem)\n @gems << gem\n @gems = @gems.uniq\n true\n end",
"def local_requires\n require \"talia_cl\"\nend",
"def watch_require!\n ::Kernel.module_eval do\n # It isn't previously defined in Kernel. This could be a bit dangerous, though.\n def self.method_added(method_name, *args)\n if method_name == :require && !::Bumbler::Hooks.hooking_require?\n # Fix those hooks.\n ::Bumbler::Hooks.hook_require!\n end\n end\n end\n end",
"def add_to_dependency_load_paths #:nodoc:\n Dependencies.load_paths.concat(load_paths)\n end",
"def gem(name, *requirements)\n self.class.gems.activate(name, *requirements)\n end",
"def watch_require!\n ::Kernel.module_eval do\n # It isn't previously defined in Kernel. This could be a bit dangerous, though.\n def self.method_added(method_name, *_args)\n if method_name == :require && !::Bumbler::Hooks.hooking_require?\n # Fix those hooks.\n ::Bumbler::Hooks.hook_require!\n end\n end\n end\n end",
"def add_gems\n Bundler.with_clean_env do\n run 'bundle install'\n end\n end",
"def register_dependency(dep, version)\n GemDependency.create!(\n laser_gem: self,\n dependency: dep,\n version: version,\n )\n self.reload\n end",
"def after_install(path, options = T.unsafe(nil)); end",
"def gem(name, requirement = nil)\n gems << Gem.new(name, requirement)\n end",
"def install(local: false)\n\tpath = self.build\n\t\n\t@helper.install_gem(path, local)\nend",
"def post_install; end",
"def add_to_dependency_load_paths(event) #:nodoc:\n if index = Dependencies.load_paths.index(lib_path)\n Dependencies.load_paths.insert(index, *load_paths)\n elsif event == :after_initialize\n plugins_before_paths = plugins_before.map(&:root)\n plugin_before_load_paths = Dependencies.load_paths.find_all {|path| plugins_before_paths.detect {|plugin_path| path.include?(plugin_path)}}\n index = (Dependencies.load_paths.index(plugin_before_load_paths.last) || -1) + 1\n \n Dependencies.load_paths.insert(index, *load_paths)\n else\n Dependencies.load_paths.concat(load_paths)\n end\n end",
"def add_spec(gem_spec, name = T.unsafe(nil)); end",
"def require_faux_gem\n rel_main = \"./#{real_main_file_name}\"\n Dir.chdir( folder_lib ){\n require \"./#{real_main_file_name}\"\n }\n end",
"def add_specs(*gem_specs); end",
"def add\n op.banner = \"Usage: realm add [PATH ...]\"\n op.separator \"Add library path(s) into locked load environment.\"\n\n parse\n\n if argv.empty?\n paths = [Dir.pwd]\n else\n paths = argv\n end\n\n if !Utils.locked?\n $LOAD_MANAGER = Manager.new\n end\n\n paths.each do |path|\n puts path\n $LOAD_MANAGER.add(path)\n end\n Utils.lock(:active=>true)\n puts \" '-> #{Utils.lock_file}\"\n end",
"def generate_require_paths; end",
"def require_gem gem, name = nil\n name = gem if name.nil?\n if !BBLib.gem_installed? name\n return false unless Gem.install gem\n end\n require name\n end",
"def add_view_language_gem\n return if view_language == \"erb\"\n add_gems %(gem \"#{view_language}\")\n end",
"def add\n configure_addon('Adding') do |addon, config|\n heroku.install_addon(app, addon, config)\n end\n end",
"def add\n configure_addon('Adding') do |addon, config|\n heroku.install_addon(app, addon, config)\n end\n end",
"def post_install\n end",
"def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end",
"def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end",
"def local_require(lib)\n load_local_gem(lib)\n require(lib)\n end",
"def inject_gem(name, version = nil)\n gemfile = facts['app_code'] + '/Gemfile'\n if File.exists?(gemfile)\n return if File.read(gemfile)[/^gem ('|\")#{name}('|\")/]\n File.open(gemfile, \"a\") do |f|\n f.puts ''\n if version\n f.puts \"gem '#{name}', '#{version}' # injected by platform\"\n else\n f.puts \"gem '#{name}' # injected by platform\"\n end\n end\n else\n @injected_gems ||= []\n @injected_gems << [name, version]\n end\n end",
"def install_gem(nr, checkout_path)\n gemspec_file = ::File.join(\n checkout_path, \"#{nr.gem_name}.gemspec\"\n )\n at_compile_time do\n ruby_block \"install vault plugin #{nr.gem_name}\" do\n block do\n require 'rubygems/dependency_installer'\n require 'rubygems/specification'\n\n ::Dir.chdir(checkout_path)\n gemspec = ::Gem::Specification.load(gemspec_file)\n gem = if Gem::Package.respond_to?(:build)\n Gem::Package.build(gemspec)\n else\n require 'rubygems/builder'\n Gem::Builder.new(gemspec).build\n end\n inst = ::Gem::DependencyInstaller.new\n inst.install gem\n Gem.clear_paths\n end\n end\n end\n end",
"def add_gems\n gem 'sorbet-rails', path: '../../../.'\n\n sorbet_version = ENV[\"SORBET_VERSION\"]\n if sorbet_version\n # mostly used to test against a stable version of Sorbet in Travis.\n gem 'sorbet', sorbet_version\n gem 'sorbet-runtime', sorbet_version\n else\n # prefer to test against latest version because sorbet is updated frequently\n gem 'sorbet'\n gem 'sorbet-runtime'\n end\nend",
"def setup_gem(name, options)\n version = [options[:version]].compact\n lib_name = options[:lib] || name\n\n log \"activating #{name}\"\n\n Gem.activate(name, *version)\n rescue Gem::LoadError\n log \"activating #{name} failed, try to install\"\n\n install_gem(name, version, options)\n end",
"def install_gem(gemname)\n if !Gem::Specification::find_all_by_name(gemname).any?\n gemfile(true) do\n source 'https://rubygems.org'\n gem gemname\n end\n end\n require gemname\nend",
"def add_gem(gem_name, gem_options={}, generator_command=nil, &block)\n message = \"Installed\"\n gem gem_name, gem_options\n\n run_install\n\n if generator_command || block_given?\n message += ' and configured.'\n end\n\n if generator_command\n message += \"\\n\\n- #{generator_command}\"\n generate generator_command\n end\n\n yield if block_given?\n\n git add: \".\"\n git commit: %Q{ -m \"#{gem_name}: #{message}\" }\n end",
"def opal_require name\n require_symbol{:name}\n (config.opal_dir + \"#{name}.rb\").read\n end",
"def install_gem(gem_name)\n if gem_name.match(/getopt/)\n install_name = \"getopt\"\n else\n install_name = gem_name.gsub(/\\//,\"-\")\n end\n puts \"Information:\\tInstalling #{install_name}\"\n %x[gem install #{install_name}]\n Gem.clear_paths\n require \"#{gem_name}\"\nend",
"def install\n \n end",
"def add_gem_with_query(gem_name, gem_options={}, generator_command=nil, &block)\n if yes?(\"Would you like to install #{gem_name}? (y/n)\")\n add_gem(gem_name, gem_options, generator_command, &block)\n end\n end",
"def inject_into_load_path\n \n # Add ALL paths under the engine root to the load path\n %w(app/controllers \n app/helpers \n app/models\n components\n lib).collect { |dir|\n File.join(root, dir)\n }.select { |dir| File.directory?(dir) }.each do |path|\n insert_into_load_path(path) \n end\n end",
"def carrega_gem(nome, versao = nil)\n begin\n gem nome, versao\n rescue LoadError\n puts \"Instalando gem '#{nome}'...\"\n versao = \"-- version '#{versao}'\" unless versao.nil?\n system \"gem install #{nome} #{versao}\"\n Gem.clear_paths\n retry\n end\n\n require nome\nend",
"def gem_path(name, options) # :nodoc:\n return unless directory = options.delete(:path)\n\n pin_gem_source name, :path, directory\n\n @vendor_set.add_vendor_gem name, directory\n\n true\n end",
"def require(path) # :nodoc:\n gem_original_require path\n rescue LoadError => load_error\n if File.basename(path).match(Gem::MiniGems::INLINE_REGEXP) && \n Object.const_defined?(:Inline)\n # RubyInline dynamically created .so/.bundle\n return gem_original_require(File.join(Inline.directory, path))\n elsif path == 'Win32API' && !Gem.win_platform?\n raise load_error\n elsif load_error.message =~ /#{Regexp.escape path}\\z/\n if !path.include?('/') && Gem.activate(path)\n return gem_original_require(path)\n elsif $MINIGEMS_SKIPPABLE.include?(path)\n raise load_error\n elsif spec = Gem.searcher.find(path)\n Gem.activate(spec.name, \"= #{spec.version}\")\n return gem_original_require(path)\n end\n end\n raise load_error\n end",
"def load_libs; end",
"def add_vendor_gem(name, directory) # :nodoc:\n gemspec = File.join directory, \"#{name}.gemspec\"\n\n spec = Gem::Specification.load gemspec\n\n raise Gem::GemNotFoundException,\n \"unable to find #{gemspec} for gem #{name}\" unless spec\n\n spec.full_gem_path = File.expand_path directory\n\n @specs[spec.name] = spec\n @directories[spec] = directory\n\n spec\n end",
"def hook_require!\n @hooking_require = true\n\n # There are two independent require methods. Joy!\n ::Kernel.prepend RequireLogger\n (class << ::Kernel; self; end).prepend RequireLogger\n\n @hooking_require = nil\n end",
"def inject_dependencies\n add_to_load_path\n add_to_dependency_load_paths\n add_to_dependency_load_once_paths\n add_to_mixable_app_types\n end",
"def append_from_gems\n\t\t\t::Gem.loaded_specs.each do |name, spec|\n\t\t\t\tConsole.logger.debug(self) {\"Checking gem #{name}: #{spec.full_gem_path}...\"}\n\t\t\t\t\n\t\t\t\tif path = spec.full_gem_path and File.directory?(path)\n\t\t\t\t\tappend_path(path, name: spec.full_name)\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def add(*gemspecs)\n @specs.push(*gemspecs)\n end",
"def install\r\n automated_install {\r\n installer = Gem::Installer.new( @gem_path,\r\n :domain => :both,\r\n :generate_rdoc => true,\r\n :generate_ri => true,\r\n :force => true,\r\n :test => false,\r\n :wrappers => true,\r\n :install_dir => Gem.dir,\r\n :security_policy => nil\r\n )\r\n installer.install\r\n }\r\n end",
"def install\n install_gems(dependencies)\n end",
"def add(paths = '.', **options)\n self.lib.add(paths, options)\n end",
"def add(plugin); end",
"def install\n end",
"def install\n end",
"def AddModuleToLoad(name)\n Builtins.y2milestone(\"Adding module to be loaded at boot: %1\", name)\n @kernel_modules_to_load = Builtins.add(\n @kernel_modules_to_load,\n { \"operation\" => \"add\", \"name\" => name }\n )\n\n nil\n end",
"def watch_require!\n ::Kernel.module_eval do\n # It isn't previously defined in Kernel. This could be a bit dangerous, though.\n def self.method_added(method_name, *_args) # rubocop:disable Lint/MissingSuper\n if method_name == :require && !Bumbler::Hooks.hooking_instance_require?\n ::Bumbler::Hooks.hook_instance_require!\n end\n end\n\n def self.singleton_method_added(method_name, *_args) # rubocop:disable Lint/MissingSuper\n if method_name == :require && !Bumbler::Hooks.hooking_singleton_require?\n ::Bumbler::Hooks.hook_singleton_require!\n end\n end\n end\n end",
"def install_gem(name, version, options)\n installer = Gem::DependencyInstaller.new(options)\n\n temp_argv(options[:extconf]) do\n log \"installing #{name}\"\n installer.install(name, *version)\n end\n\n Gem.activate(name, *version)\n\n log \"install and final activation successful\"\n rescue Gem::GemNotFoundException => ex\n log \"installation failed: #{ex}, use normal require\"\n\n require(options[:lib] || name)\n\n log \"require successful, cannot verify version though\"\n end",
"def _add(plugin); end",
"def install\n end",
"def install\n bin.install \"iloops\"\n end",
"def add_require(require)\n if RDoc::TopLevel === self then\n add_to @requires, require\n else\n parent.add_require require\n end\n end",
"def local_gem(*args)\n load_local_gem(args[0]) || gem(*args)\n end",
"def required_gems\n relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))\n [\n \"gem 'react_on_rails', path: '#{relative_gem_root}'\",\n \"gem 'shakapacker'\"\n ]\n end",
"def activate_gem(gem_name, library_name = nil)\n if !defined?(::Gem)\n begin\n require 'rubygems'\n rescue LoadError\n end\n end\n if Kernel.respond_to?(:gem, true)\n begin\n gem(gem_name)\n rescue Gem::LoadError\n end\n end\n require(library_name || gem_name)\n end",
"def require_file(path)\n eval \"opal.require('#{path}');\", \"(opal)\"\n end",
"def util_bake_gem(name = \"a\", *extra, &block)\n files = [\"lib/#{name}.rb\"].concat(extra)\n\n spec = new_spec name, \"1\", nil, files, &block\n\n File.join @tempdir, \"gems\", \"#{spec.full_name}.gem\"\n end"
] |
[
"0.73553574",
"0.71299034",
"0.704712",
"0.6884728",
"0.6685489",
"0.6639203",
"0.65313286",
"0.65016234",
"0.64808214",
"0.63119656",
"0.6248685",
"0.6235593",
"0.6219434",
"0.61811787",
"0.6128633",
"0.6127178",
"0.6085901",
"0.60708785",
"0.60696965",
"0.60397494",
"0.60249025",
"0.60227036",
"0.6021366",
"0.59811074",
"0.59351045",
"0.5922076",
"0.59200704",
"0.59065074",
"0.58923864",
"0.58904624",
"0.5879181",
"0.5849196",
"0.5835063",
"0.5833905",
"0.5827256",
"0.58241826",
"0.5820377",
"0.5806759",
"0.57995015",
"0.5795121",
"0.5791358",
"0.57912666",
"0.5783519",
"0.5773389",
"0.57555676",
"0.57541406",
"0.575342",
"0.57479274",
"0.5746247",
"0.57454133",
"0.5732221",
"0.5724756",
"0.5721492",
"0.57186276",
"0.57169324",
"0.571623",
"0.57157797",
"0.57157797",
"0.5694556",
"0.56943",
"0.56943",
"0.5688363",
"0.56785667",
"0.5660524",
"0.56409323",
"0.5634942",
"0.5630051",
"0.5612651",
"0.55879307",
"0.5574948",
"0.5571784",
"0.5556101",
"0.55557203",
"0.55422103",
"0.5537199",
"0.5535855",
"0.55346966",
"0.55325884",
"0.5517225",
"0.55126244",
"0.5509107",
"0.55043375",
"0.55021286",
"0.54905504",
"0.5483168",
"0.54656744",
"0.5452164",
"0.5452164",
"0.54497474",
"0.5445428",
"0.54267603",
"0.5421319",
"0.54211223",
"0.54163253",
"0.54154974",
"0.5410299",
"0.5405448",
"0.5404134",
"0.5403782",
"0.5400776"
] |
0.66216385
|
6
|
Returns script tags that should be included
|
def javascript_tags(volt_app)
@opal_tag_generator ||= Opal::Server::Index.new(nil, volt_app.opal_files.server)
javascript_files = []
@assets.each do |type, path|
case type
when :folder
# for a folder, we search for all .js files and return a tag for them
javascript_files += Dir["#{path}/**/*.js"].sort.map { |folder| '/assets' + folder[path.size..-1] }
when :javascript_file
# javascript_file is a cdn path to a JS file
javascript_files << path
end
end
javascript_files = javascript_files.uniq
scripts = javascript_files.map {|url| "<script src=\"#{url}\"></script>" }
# Include volt itself. Unless we are running with MAPS=all, just include
# the main file without sourcemaps.
volt_path = 'volt/volt/app'
if ENV['MAPS'] == 'all'
scripts << @opal_tag_generator.javascript_include_tag(volt_path)
else
scripts << "<script src=\"/assets/#{volt_path}.js\"></script>"
scripts << "<script>#{Opal::Processor.load_asset_code(volt_app.sprockets, volt_path)}</script>"
end
scripts << @opal_tag_generator.javascript_include_tag('components/main')
scripts.join("\n")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scripts\n script_tag(fancyviews.included_scripts.map do |name, js|\n \"\\n/* -- #{name} -- */\\n\" + js\n end.join)\n end",
"def render_js_includes\n return \"\".html_safe unless respond_to?(:javascript_includes) \n \n javascript_includes.uniq.collect do |args|\n javascript_include_tag(*args)\n end.join(\"\\n\").html_safe\n end",
"def controller_javascript_tags\n \n lo_files = []\n \n required_cc_files.each do |f|\n fn = [f,\"js\"].join(\".\")\n unless Rails.application.assets.find_asset(fn).nil?\n lo_files << javascript_include_tag(fn)\n end\n end\n\n lo_files.join.html_safe\n\n end",
"def js_includes\n end",
"def javascript_include_tag(*sources)\n options = sources.extract_options!.stringify_keys\n debug = options.key?(:debug) ? options.delete(:debug) : debug_assets?\n\n sources.map do |source|\n if debug && !(digest_available?(source, 'js')) && (asset = asset_for(source, 'js'))\n asset.to_a.map { |dep| javascript_src_tag(dep.logical_path, { :body => true }.merge(options)) }\n else\n sources.map { |source| javascript_src_tag(source.to_s, options) }\n end\n end.uniq.join(\"\\n\").html_safe\n end",
"def javascript_include_tag(*sources)\n options = sources.extract_options!.stringify_keys\n sources.dup.map { |source|\n tag_options = {\n \"src\" => path_to_javascript(source)\n }.merge(options)\n content_tag(:script, \"\", tag_options)\n }.join(\"\\n\").html_safe\n end",
"def include_default_scripts\n includes = []\n\n includes << javascript_include_tag(:application) if assets_exists? \"application.js\"\n\n default_asset_paths.each do |path|\n if assets_exists? \"#{path}.js\"\n includes << javascript_include_tag(path)\n end\n end\n \n includes << content_for(:scripts)\n includes.join(\"\\n\").html_safe\n end",
"def javascripts_from_plugins\n Dir.glob(\"vendor/plugins/*/assets/javascripts/*.js\").select{|s| !s.include? \"vendor/plugins/alchemy\"}.inject(\"\") do |acc, s|\n filename = File.basename(s)\n plugin = s.split(\"/\")[2]\n acc << javascript_include_tag(filename, :plugin => plugin)\n end\n end",
"def scripts\n @parts.values.map(&:script).compact\n end",
"def g_apply_includes\n g = Guilded::Guilder.instance\n g.generate_asset_lists\n\n # JavaScript\n if g.production? && g.use_remote_jquery\n js_groups = g.combined_js_srcs.partition { |src| src == g.jquery_js }\n output = javascript_include_tag( g.jquery_remote_url )\n output << javascript_include_tag( js_groups[1], :cache => \"cache/#{g.js_cache_name}\" ) unless js_groups[1].nil?\n else\n output = javascript_include_tag( g.combined_js_srcs, :cache => \"cache/#{g.js_cache_name}\" )\n end\n output\n end",
"def scripts\n SCRIPTS\n end",
"def ubiquo_javascript_include_tags(files=['ubiquo', 'lightwindow'])\n files.delete 'lightwindow' unless File.exists?(Rails.root.join('public', 'javascripts', 'ubiquo', 'lightwindow.js'))\n files.collect do |js|\n javascript_include_tag \"ubiquo/#{js}\"\n end.join \"\\n\"\n end",
"def include_individual_javascripts(bundles=[])\n tags = []\n bundles.each do |bundle| \n tags.concat bundle.files.map { |js| javascript_include_tag(js.path) }\n end\n tags.join(\"\\n\")\n end",
"def scripts\n #Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline\n script(:src => '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js')\n script do\n rawtext(%{window.jQuery || document.write('<script src=\"#{js_urls(:lib).first}\"><\\\\/script>')})\n end\n #TODO should just be \"defer\" without attribute, but erector doesn't really do that\n js_urls(:app).each do |url|\n script(:defer => 'defer', :src => url) \n end\n \n #removed google analytics tag\n \n #Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6. \n # chromium.org/developers/how-tos/chrome-frame-getting-started\n comment('[if IE 7 ]') do\n script(:src => '//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js')\n script do\n rawtext(%{window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})})\n end\n end\n \n yield if block_given?\n end",
"def scripts\n @content_for_scripts.to_s\n end",
"def javascript_include_tag(*sources)\n html = []\n sources.each do |javascript|\n if is_uri?(javascript)\n path = javascript\n else\n path = url(\"/js/#{javascript}.js\")\n end\n html << \"<script type=\\\"text/javascript\\\" src=\\\"#{path}\\\"></script>\"\n end\n return html.join(\"\\n\")\n end",
"def javascript_include_tag(*sources)\n options = sources.extract_options!.stringify_keys\n\n if options[\"debug\"] != false && request_debug_assets?\n sources.map { |source|\n check_errors_for(source, :type => :javascript)\n if asset = lookup_asset_for_path(source, :type => :javascript)\n asset.to_a.map do |a|\n super(path_to_javascript(a.logical_path, :debug => true), options)\n end\n else\n super(source, options)\n end\n }.flatten.uniq.join(\"\\n\").html_safe\n else\n sources.push(options)\n super(*sources)\n end\n end",
"def script\n @elements.map { |e|\n (e && !e.hidden? && !e.readonly? && e.respond_to?(:script))? e.script : ''\n }.join(\"\")\n end",
"def javascript_include_tag(*sources)\n if sources.delete :jsmask\n sources = sources.concat(\n ['lowpro', 'jsmask']\n ).uniq\n end\n rails_javascript_include_tag(*sources)\n end",
"def add_scripts(scripts, chart_scripts)\n s = ''\n scripts.map do |script|\n s += %(\n <script src=\"assets/#{script}\"></script>)\n end\n chart_scripts.map do |script|\n s += %(\n <script src=\"#{script}\"></script>)\n end\n s\nend",
"def report_js_includes\n javascript_include_tag(\"https://www.google.com/jsapi\") +\n javascript_tag('if (typeof(google) != \"undefined\")\n google.load(\"visualization\", \"1\", {packages:[\"corechart\"]});')\n end",
"def g_javascript_include_tag( *sources )\n g = Guilded::Guilder.instance\n defaults = nil\n if sources.include?( :defaults )\n defaults = ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES\n sources.delete( :defaults )\n end\n if sources.include?( :jquery )\n sources.insert( 0, g.jquery_js ) unless sources.include?( g.jquery_js )\n sources.delete( :jquery )\n end\n if sources.include?( :mootools )\n unless sources.include?( g.mootools_js )\n insert_at = 0\n insert_at = 1 if( sources.include?( g.jquery_js ) )\n sources.insert( insert_at, g.mootools_js )\n end\n sources.delete( :mootools )\n end\n if defaults\n g.add_js_sources( *(sources << defaults) )\n else\n g.add_js_sources( *sources )\n end\n ''\n end",
"def appoxy_javascripts\n '<script type=\"text/javascript\" src=\"http://www.google.com/jsapi?key=ABQIAAAAhes0f80sBcwL-h5xCNkkgxQBmiBpQeSpIciQPfZ5Ss-a60KXIRQOVvqzsNpqzhmG9tjky_5rOuaeow\"></script>\n <script type=\"text/javascript\">\n google.load(\"jquery\", \"1\");\n google.load(\"jqueryui\", \"1\");\n </script>\n '.html_safe\n end",
"def included_tag_names\n parsed_included_tags[:missing]\n end",
"def javascript_include_tag(*sources); end",
"def javascript_include_tag(*sources); end",
"def javascript_include_tag(*sources); end",
"def get_vendor_scripts\n case map_provider\n when \"yandex\" then @js_array << YANDEX\n when \"openlayers\" then @js_array << OPENLAYERS\n when \"mapquest\" then @js_array << \"#{MAPQUEST}?key=#{provider_key}\"\n when \"bing\" then @js_array << BING\n else #case googlemaps which is the default\n @js_array << \"#{GOOGLE}&sensor=false&client=#{client}&key=#{provider_key}&libraries=geometry#{google_libraries}&#{google_map_i18n}\"\n @js_array << \"#{GOOGLE_EXT}tags/infobox/1.1.9/src/infobox_packed.js\" if custom_infowindow_class\n @js_array << \"#{GOOGLE_EXT}tags/markerclustererplus/2.0.14/src/markerclusterer_packed.js\" if do_clustering\n @js_array << \"#{GOOGLE_EXT}trunk/richmarker/src/richmarker-compiled.js\" if rich_marker\n end\n end",
"def page_javascripts(options={})\n \n # initialize collection\n javascripts = []\n conditional_scripts = []\n @javascripts_add ||= []\n @javascripts_ignore ||= []\n \n # Additional scripts (if requested)\n if options[:include]\n @javascripts_add = [options[:include]].flatten + @javascripts_add\n end\n \n # Exclude scripts (if requested)\n if options[:exclude]\n @javascripts_ignore = [options[:exclude]].flatten + @javascripts_ignore\n end\n\n # Add more scripts\n @javascripts_add.each do |javascript|\n javascripts << javascript\n end\n \n # Ignore scripts\n @javascripts_ignore.each do |javascript|\n javascripts.delete(javascript)\n end\n \n # dedup javascript array\n javascripts.uniq!\n \n # Build Output\n html_output = javascript_include_tag(*javascripts)\n \n # Controller/action scripts\n conditional_scripts << \"#{controller.controller_name}\"\n conditional_scripts << \"#{controller.controller_name}/#{controller.action_name}\"\n \n # only add conditional scripts if they exist on disk\n conditional_scripts.each do |javascript|\n if File.exist?(\"#{RAILS_ROOT}/public/javascripts/#{javascript}.js\")\n html_output << \"\\n\"\n html_output << javascript_include_tag(javascript)\n end\n end\n \n # return output\n return html_output\n end",
"def javascript_include_tag_with_engine_additions(*sources)\r\n javascript_include_tag_without_engine_additions(*Engines::RailsExtensions::AssetHelpers.pluginify_sources(\"javascripts\", *sources))\r\n end",
"def javascript (*files)\n content_for(:head) { javascript_include_tag(*files) }\n end",
"def javascripts(*filters)\n query(\"script\", \"src\", *filters)\n end",
"def load_javascript(*files)\n content_for(:head) { javascript_include_tag(*files) }\n end",
"def javascript_include_tag(file_name)\n path_prefix = development? ? '/assets/' : '/js/'\n suffix = development? ? '' : \"-#{Heliom::Labs::VERSION}.min\"\n %(<script src=\"#{path_prefix}#{file_name}#{suffix}.js\"></script>)\nend",
"def render_inline_on_load_javascripts\n return '' if @content_for_jquery_onload.blank? && @content_for_javascript_files_onload.blank?\n js_code = \"\\n<!-- DEFFERRED On page load Javascripts -->\\n\"\n on_load_scripts = [ ]\n #write the onload inline javascripts\n on_load_scripts << @content_for_jquery_onload if @content_for_jquery_onload\n #write the javascript files which are jammed into the document head\n on_load_scripts << @content_for_javascript_files_onload if @content_for_javascript_files_onload\n js_code << javascript_tag(j_query_on_load_tag(on_load_scripts)) unless on_load_scripts.blank?\n js_code\n end",
"def javascript_include_tag(*sources)\n options = extract_options!(sources)\n\n base_folder = if defined? Compass\n Compass.configuration.javascripts_dir\n else\n 'javascripts'\n end\n sources.map do |source|\n\n content_tag('script', '', {\n 'type' => 'text/javascript',\n 'src' => ensure_path(ensure_extension(source, 'js'), base_folder)\n }.with_indifferent_access.merge(options))\n end.join(\"\\n\")\n end",
"def javascript_bundles_with_chunks_tag(*names, manifest: nil, **options)\n sources_from_manifest_entrypoints(names, 'js', key: manifest).map { |entry|\n javascript_include_tag(entry.path, **minipack_options_for(entry, options))\n }.join(\"\\n\").html_safe\n end",
"def array_to_js_include_tags arr\n return '' if arr.blank?\n s = ''\n arr.each{ |line| s<< javascript_include_tag(line) }\n s\n end",
"def page_script(context={}, page)\n \n scripts = []\n\n # Front-end custom resources\n unless page.admin_page\n if template=ContentManagerSystem::Template.find_by_name('javascript_resources') && \n !template.text.empty?\n scripts.concat(template.text.split(','))\n end \n if template=ContentManagerSystem::Template.find_by_name('javascript_app') && \n !template.text.empty?\n scripts << '/js/app.js'\n end\n end\n \n return scripts\n\n end",
"def include_templates(*bundles)\n tags = bundles.map { |bundle| javascript_include_tag(\"/assets/#{bundle}.jst\") }\n tags.join(\"\\n\")\n end",
"def strip_script_tags!(content)\n content.gsub!(/(^|\\s*)<script[^>]*>(\\s*\\n)?(\\/\\/<\\!\\[CDATA\\[\\n)?/, '')\n content.gsub!(/(\\n\\/\\/\\]\\]>)?\\s*<\\/script>\\s*(\\n|$)/, '')\n content\n end",
"def javascript_include_tag_with_defer_options(*sources)\n options = sources.last.is_a?(Hash) ? sources.pop : {}\n javascript_include_tag(sources, options.reverse_merge(:defer => true))\n end",
"def javascript_include_tag(*sources)\n options = sources.extract_options!.stringify_keys\n concat = options.delete(\"concat\")\n cache = concat || options.delete(\"cache\")\n recursive = options.delete(\"recursive\")\n\n if concat || (ActionController::Base.perform_caching && cache)\n joined_javascript_name = (cache == true ? \"all\" : cache) + \".js\"\n joined_javascript_path = File.join(joined_javascript_name[/^#{File::SEPARATOR}/] ? ASSETS_DIR : JAVASCRIPTS_DIR, joined_javascript_name)\n\n unless ActionController::Base.perform_caching && File.exist?(joined_javascript_path)\n write_asset_file_contents(joined_javascript_path, compute_javascript_paths(sources, recursive))\n end\n javascript_src_tag(joined_javascript_name, options)\n else\n expand_javascript_sources(sources, recursive).collect { |source| javascript_src_tag(source, options) }.join(\"\\n\").html_safe\n end\n end",
"def javascript_include_tag(name, options = {})\n sprockets = options.fetch(:sprockets)\n prefix = options.fetch(:prefix)\n debug = options.fetch(:debug)\n\n # Avoid double slashes\n prefix = prefix.chop if prefix.end_with? '/'\n\n asset = sprockets[name, accept: \"application/javascript\", pipeline: debug ? :debug : nil]\n raise \"Cannot find asset: #{name}\" if asset.nil?\n scripts = []\n\n if debug\n scripts << %{<script src=\"#{prefix}/#{asset.digest_path}\"></script>}\n else\n scripts << %{<script src=\"#{prefix}/#{name}.js\"></script>}\n end\n\n scripts << %{<script>#{load_asset('opal', name)}</script>}\n\n scripts.join \"\\n\"\n end",
"def imported_scripts\r\n @imported_scripts ||= []\r\n end",
"def script_tag( filename, options = {} )\n\n # blah\n filename = filename.to_s\n\n # add the extension, if not already present\n filename += '.js' unless filename.end_with?( '.js' )\n\n # set defer + async\n options[:src] = asset_url_for( filename )\n options[:defer] = :defer unless options.key?( :defer )\n options[:async] = :async unless options.key?( :async )\n\n # return\n ( tag( :script, options, true ).gsub( /(?<attr>[a-z]+)=\\\"\\k<attr>\\\"/, '\\k<attr>' ) + '</script>' ).html_safe\n\n end",
"def has_js(*args)\n content_for :extra_head, javascript_include_tag(*args)\n end",
"def injected_javascripts\n @javascript_codes || []\n end",
"def casein_config_javascript_includes\n\t \t['/casein/javascripts/custom.js', '/casein/javascripts/casein.js', '/javascripts/prototype.js']\n\tend",
"def scripts\n @scripts\n end",
"def parsed_included_tags\n @parsed_included_tags ||= parse_named_tags(\n %i[fandom_names character_names relationship_names freeform_names\n other_tag_names]\n )\n end",
"def insert_script_tags(fileContent)\n\n @doc = Nokogiri::HTML(fileContent)\n\n hasChanges = false\n\n headScript = @doc.at_css \"head script\"\n #check if head section already contains script\n if headScript == nil\n script = Nokogiri::HTML::DocumentFragment.parse '<script src=\"https://www.powr.io/powr.js\"></script>'\n\n head = @doc.at_css \"head\"\n head << script\n\n hasChanges = true\n end\n\n bodyScript = @doc.at_css \"body script\"\n #check if body section already contains script\n if bodyScript == nil\n script = Nokogiri::HTML::DocumentFragment.parse '<script src=\"https://www.powr.io/powr.js\"></script>'\n\n body = @doc.at_css \"body\"\n body << script\n\n hasChanges = true\n end\n\n return { 'success' => hasChanges, 'content' => @doc.to_html }\n\n end",
"def javascripts(options={})\n [\n # include the default sources (minus application.js)\n javascript(ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES),\n\n # include the dynamic page javascripts\n page_javascripts(options),\n\n # application.js always needs to be at the end\n javascript(\"application\")\n ].join(\"\\n\")\n end",
"def process_scripts(body, directory)\n to_inline = []\n\n body.scan(SCRIPT_PATTERN) do |script_tag|\n if path = script_tag[SRC_PATH_PATTERN, :path]\n\n indent = script_tag[INDENT_PATTERN, :indent] || \"\"\n\n absolute_path = File.absolute_path(path, directory)\n script_contents = read_file(absolute_path)\n\n to_inline << [script_tag, \"#{indent}<script>#{script_contents}\\n#{indent}</script>\"]\n end\n end\n\n to_inline.reduce(body) do |output, (tag, contents)|\n output.gsub(tag, contents)\n end\n end",
"def make_tag_pattern(b)\n\t# remove stuff between script and /script\n\t# don't bother with !--, --> or noscript and /noscript\n\tinscript = false;\n\n\tb.scan(/<([^\\s>]*)/).flatten.map {|x| \n\t\t\tx.downcase!\n\t\t\tr = nil\n\t\t\tr = x if inscript == false\n\t\t\tinscript = true if x == \"script\"\n\t\t\t(inscript = false; r = x) if x == \"/script\"\n\t\t\tr\n\t\t}.compact.join(\",\")\nend",
"def javascript_include_tag(*sources)\n behaviours = ''\n if sources.delete :acts_as_node\n #graph drawing\n root_dir = 'jsviz/0.3.3/'\n sources = sources.concat(\n ['physics/ParticleModel', 'physics/Magnet', 'physics/Spring', 'physics/Particle', 'physics/RungeKuttaIntegrator', 'geometry/SnowflakeGraphModel', 'layout/graph/ForceDirectedLayout', 'layout/graph/SnowflakeLayout', 'layout/view/HTMLGraphView', 'layout/view/SVGGraphView', 'util/Timer', 'util/EventHandler', 'io/DataGraph', 'io/JSVIZHTTP', 'io/XMLTreeLoader']\n ).uniq.map { |js_file| root_dir + js_file }\r\n sources = sources.concat(['tooltip/boxover'])\r\n end\n rails_javascript_include_tag(*sources)\n end",
"def include_javascript\n @outfile.puts <<'EOF'\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.js\"></script>\n <link rel=\"stylesheet\" href=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css\" />\n <script src=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js\"></script> \nEOF\n Pathname.new(JavascriptDir).find do |path|\n next unless path.file?\n if @one_file\n @outfile.puts \" <script>\"\n @outfile.puts path.read\n @outfile.puts \" </script>\"\n else\n @outfile.puts \"<script src=\\\"lib/javascript/#{path.basename}\\\"></script>\"\n end\n end\n end",
"def google_ajax_api_scripts\n return '' if defined?(@google_ajax_api_scripts_included)\n script = '<script type=\"text/javascript\" src=\"http://www.google.com/jsapi'\n script << \"?key=#{Overlord.configuration.google_ajax_api_key}\" if Overlord.configuration.google_ajax_api_key\n script << '\"></script>'\n @google_ajax_api_scripts_included = true\n script.html_safe\n end",
"def js_files\n [\n vue_lib_js, mixins_js, filters_js, components_js,\n pages_js, config_js\n ].flatten!\n end",
"def javascript(*files)\n content_for(:javascript) { javascript_include_tag(*files) }\n end",
"def jquery_include_tag\n buf = []\n if AppConfig.privacy.jquery_cdn?\n version = Jquery::Rails::JQUERY_VERSION\n buf << [ javascript_include_tag(\"//ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js\") ]\n buf << [ javascript_tag(\"!window.jQuery && document.write(unescape('#{j javascript_include_tag(\"jquery\")}'));\") ]\n else\n buf << [ javascript_include_tag('jquery') ]\n end\n buf << [ javascript_include_tag('jquery_ujs') ]\n buf << [ javascript_tag(\"jQuery.ajaxSetup({'cache': false});\") ]\n buf << [ javascript_tag(\"$.fx.off = true;\") ] if Rails.env.test?\n buf.join(\"\\n\").html_safe\n end",
"def pre_scripts\n @pre_scripts ||= user_data_as_array('pre_script')\n @pre_scripts\n end",
"def include_calendar_headers_tags\n unless @calendar_headers_tags_included\n @calendar_headers_tags_included = true\n content_for :additional_javascript do\n javascript_include_tag('calendar/calendar') +\n javascript_include_tag(\"calendar/lang/calendar-#{I18n.locale.to_s.downcase}.js\") +\n javascript_include_tag('calendar/calendar-setup') +\n stylesheet_link_tag('calendar')\n end\n end\n end",
"def javascript_file(*files)\n content_for(:javascript) { javascript_include_tag(*files) }\n end",
"def javascript_include(*args)\n if args.reject { |arg| arg.instance_of?(String) } != []\n raise(\n ArgumentError.new(\n \"javascript_include doesn't take symbols like :default, etc.\"\n )\n )\n end\n\n @javascript_files ||= []\n @javascript_files += args\n end",
"def build_all_external_scripts\n html = \"\"\n result = Mokio::ExternalScript.all\n unless result.blank?\n result.each do |position|\n html = build_common(position)\n end\n end\n html.html_safe\n end",
"def script(src)\n if src =~ /\\s/\n %(<script type='text/javascript'>#{src}</script>)\n else\n src = \"/js/#{src}.js\" unless src =~ /\\.js$/\n %(<script type='text/javascript' src='#{src}'></script>)\n end\n end",
"def javascript_include_tag(*sources)\n super *sources_with_path('javascripts', sources)\n end",
"def visit_tag_script(node, line_index:, indent:)\n return if node.script.nil? || node.script.empty?\n # We ignore scripts which are just a comment\n return if node.script[/\\S/] == '#'\n\n first_line_offset, script_lines = extract_raw_ruby_lines(node.script, line_index)\n\n if script_lines.nil?\n # This is a string with interpolation after a tag\n # ex: %tag hello #{world}\n # Sadly, the text with interpolation is escaped from the original, but this code\n # needs the original.\n\n interpolation_original = @document.unescape_interpolation_to_original_cache[node.script]\n line_start_index = @original_haml_lines[node.line - 1].rindex(interpolation_original)\n if line_start_index.nil?\n raw_lines = extract_piped_plain_multilines(node.line - 1)\n equivalent_haml_code = \"#{raw_lines.first} #{raw_lines[1..].map(&:lstrip).join(' ')}\"\n line_start_index = equivalent_haml_code.rindex(interpolation_original)\n\n interpolation_original = raw_lines.join(\"\\n\")\n end\n add_interpolation_chunks(node, interpolation_original, node.line - 1,\n line_start_index: line_start_index, indent: indent)\n else\n script_lines[0] = \"#{' ' * indent}#{script_output_prefix}#{script_lines[0]}\"\n indent_delta = script_output_prefix.size - first_line_offset + indent\n HamlLint::Utils.map_after_first!(script_lines) do |line|\n HamlLint::Utils.indent(line, indent_delta)\n end\n\n @ruby_chunks << TagScriptChunk.new(node, script_lines,\n haml_line_index: line_index,\n end_marker_indent: indent)\n end\n end",
"def nonced_javascript_include_tag(*args, &block)\n opts = extract_options(args).merge(nonce: _content_security_policy_nonce(:script))\n\n javascript_include_tag(*args, **opts, &block)\n end",
"def javascript_include(*args)\n if args.select {|arg| arg.class != String} != []\n raise(ArgumentError, \"javascript_include doesn't take symbols like :default, etc.\")\n end\n @javascripts = [] if !@javascripts\n @javascripts += args\n end",
"def script(src)\n if src =~ /\\s/\n %(<script type='text/javascript'>#{src}</script>)\n else\n src = \"/js/#{src}.js\" unless src =~ /\\.js$/\n timestamp! src\n %(<script type='text/javascript' src='#{src}'></script>)\n end\n end",
"def tenant_javascript_include_tag(*sources)\n new_sources = append_tenant_theme_to_assets(*sources)\n javascript_include_tag(*new_sources)\n end",
"def javascript_compile_list\n\t[\t\n\t\t# Wordpress distributed JS (not monitored for changes...)\n\t\t#\"../../../wp-includes/js/jquery/jquery-migrate.min.js\",\n\t\t#\"../../../wp-includes/js/jquery/jquery.masonry.min.js\",\n\n\t\t# Theme JS\n\t\t\"js/jquery-1.11.0.js\",\n\t\t\"js/jquery-ui-1.10.4.datepicker.js\",\n\t\t\"js/jquery.cookie.js\",\n\t\t\"js/functions.js\",\n\t\t\"js/imagelightbox.js\",\n\t\t\"js/lightboxinit.js\",\n\t\t\"js/jflickrfeed.js\",\n\t\t\"js/flickrsetup.js\",\n\t\t\"js/vender.js\", \n\t\t\"js/scrollTo.js\",\n\t\t\"js/placeholder.js\",\n\t\t\"js/default.js\",\n\t\t\"js/campus-libraries.js\",\n\t\t\"js/find-a-library.js\",\n\t\t\"js/datepicker.js\",\n\t\t\"js/library.js\",\n\t\t\"js/directory.js\",\n\t\t\"js/liaison.js\",\n\t\t\"js/locations.js\",\n\t\t\"js/ask.js\",\n\t\t\"js/alerts.js\",\n\t\t\"js/google-support.js\",\n\t\t\"js/locate.js\"\n\t]\nend",
"def javascript_include_tag(*sources)\n default_options =\n if Wallaby.configuration.features.turbolinks_enabled\n { 'data-turbolinks-track' => true, 'data-turbolinks-eval' => false }\n else\n {}\n end\n options = default_options.merge!(sources.extract_options!.stringify_keys)\n super(*sources, options)\n end",
"def webpack_assets_tag\n capture do\n concat javascript_pack_tag('manifest')\n concat javascript_pack_tag('lib')\n concat javascript_pack_tag('vendor')\n concat javascript_pack_tag('coursemology')\n end\n end",
"def progress_bar_includes\n return '<!-- jsProgressBarHandler core -->'+javascript_include_tag(\"progress_bar/jsProgressBarHandler.js\")\n end",
"def google_ajax_slideshow_scripts\n return '' if defined?(@google_ajax_slideshow_scripts_included)\n @google_ajax_slideshow_scripts_included = true\n '<script src=\"http://www.google.com/uds/solutions/slideshow/gfslideshow.js\" type=\"text/javascript\"></script>'.html_safe\n end",
"def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_SKOBEE_COMMENTS]\r\n end",
"def casein_config_javascript_includes\n %w[casein/custom casein/casein]\n end",
"def scripts\n @scripts ||= @options[:scripts].try(:to_sym)\n end",
"def to_development_html\n hrefs.map { |href| \"<script type='text/javascript' src='#{href}'></script>\" }.join(\"\\n\")\n end",
"def render_deferred_javascript_tags\n # First write the onload inline javascripts\n js_code = ''\n js_code << render_deferred_javascript_files\n js_code << render_inline_javascripts\n js_code << render_inline_on_load_javascripts\n js_code\n end",
"def javascript_omit\n %w()\nend",
"def script_tag(url)\n \"<script src=\\\"#{url.to_s}\\\" type=\\\"text/javascript\\\"></script>\".html_safe # FIXME style\n end",
"def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_SKOBEE_PLANS, JS_DATEPICKER, JS_JSON]\r\n end",
"def find_admin_js\n layout = \"#{TRUSTY_CMS_ROOT}/app/views/layouts/application.html.haml\"\n js_regexp = /javascript_include_tag %w\\((.*)\\), :cache => 'admin\\/all/\n files = File.open(layout) { |f| f.read.match(js_regexp)[1].split }\n files.collect { |f| f.split('/').last + '.js' }\n end",
"def script_list\n Dir['script/*'].map{|f| File.basename(f, '.*')}\nend",
"def all_javascripts\n Dir.entries('public/js').inject(\"\") do |all_js, js|\n if js =~ /\\.js$/\n all_js << \"<script src='/js/#{js}' type='text/javascript'></script>\"\n end\n all_js\n end\n end",
"def scripts\n Dir.glob(File.join(script_dir, \"*.rb\")).inject([]) do |a, e|\n Kernel.load(e)\n a + [initialize_script(e)]\n end\n end",
"def prepend_javascripts(*scripts, &block)\n # Handle multiple script args or single Array of script names\n scripts = (scripts.any? and scripts[0].is_a? Array) ? scripts[0] : scripts\n add_javascripts_to_page(scripts + CORE_JAVASCRIPTS, &block)\n end",
"def included_head_content\n included_widgets = [self.class] + output.widgets.to_a + extra_widgets\n Html5ExternalRenderer.new(:classes => included_widgets).to_html\n end",
"def amp_libraries\n return @amp_libraries if defined? @amp_libraries\n @amp_libraries =\n CustomElementLibraryResolver.new(custom_element_tags).script_tags\n end",
"def filters_js\n Dir[src_path.join('filters', '**', '*.js').to_s]\n end",
"def mergeScripts\n result = Builtins.maplist(@pre) do |p|\n p = Builtins.add(p, \"type\", \"pre-scripts\")\n deep_copy(p)\n end\n result = Convert.convert(\n Builtins.union(result, Builtins.maplist(@post) do |p|\n p = Builtins.add(p, \"type\", \"post-scripts\")\n deep_copy(p)\n end),\n :from => \"list\",\n :to => \"list <map>\"\n )\n result = Convert.convert(\n Builtins.union(result, Builtins.maplist(@chroot) do |p|\n p = Builtins.add(p, \"type\", \"chroot-scripts\")\n deep_copy(p)\n end),\n :from => \"list\",\n :to => \"list <map>\"\n )\n result = Convert.convert(\n Builtins.union(result, Builtins.maplist(@init) do |p|\n p = Builtins.add(p, \"type\", \"init-scripts\")\n deep_copy(p)\n end),\n :from => \"list\",\n :to => \"list <map>\"\n )\n result = Convert.convert(\n Builtins.union(result, Builtins.maplist(@postpart) do |p|\n p = Builtins.add(p, \"type\", \"postpartitioning-scripts\")\n deep_copy(p)\n end),\n :from => \"list\",\n :to => \"list <map>\"\n )\n deep_copy(result)\n end",
"def includes() return @includes end",
"def page_script(context={})\n \n [\"/htmleditor/js/jquery.wysiwyg.js\",\n \"/htmleditor/js/ysd.editor.js\",\n \"/htmleditor/js/controls/wysiwyg.colorpicker.js\",\n \"/htmleditor/js/controls/wysiwyg.cssWrap.js\",\n \"/htmleditor/js/controls/wysiwyg.image.js\",\n \"/htmleditor/js/controls/wysiwyg.link.js\",\n \"/htmleditor/js/controls/wysiwyg.table.js\",\n ] \n \n end",
"def included_files; end",
"def included_in\n @included_in ||= []\n end",
"def available_includes\n []\n end"
] |
[
"0.77285165",
"0.6945368",
"0.6812882",
"0.6719892",
"0.6632145",
"0.66007644",
"0.6586229",
"0.65364593",
"0.6530072",
"0.65291584",
"0.6470059",
"0.6440482",
"0.6410502",
"0.63929796",
"0.6372538",
"0.6367777",
"0.6362191",
"0.63539284",
"0.6326827",
"0.6306213",
"0.626241",
"0.62522364",
"0.62334406",
"0.6218931",
"0.621086",
"0.621086",
"0.621086",
"0.61721855",
"0.6170071",
"0.61472726",
"0.61417264",
"0.61191577",
"0.6098191",
"0.6078775",
"0.6077502",
"0.60721934",
"0.606176",
"0.6041985",
"0.6033913",
"0.60294527",
"0.6019594",
"0.6017069",
"0.60091895",
"0.60010564",
"0.5987158",
"0.59556913",
"0.59419036",
"0.59326357",
"0.5907089",
"0.5904877",
"0.58941656",
"0.5892379",
"0.5892256",
"0.58815426",
"0.5870437",
"0.58529526",
"0.5841593",
"0.58349365",
"0.5829464",
"0.58252245",
"0.58161855",
"0.58139426",
"0.58113605",
"0.5804806",
"0.57811105",
"0.5741796",
"0.57397264",
"0.57331246",
"0.57174426",
"0.57144606",
"0.5713143",
"0.5705968",
"0.57018054",
"0.56907046",
"0.5669559",
"0.5637698",
"0.56320494",
"0.56319803",
"0.5630309",
"0.56099963",
"0.56014544",
"0.55831003",
"0.5580082",
"0.55679053",
"0.5565019",
"0.5558344",
"0.5557151",
"0.55474705",
"0.553969",
"0.5530488",
"0.5526033",
"0.55260324",
"0.5512918",
"0.5492411",
"0.54821295",
"0.5468573",
"0.54646665",
"0.54629815",
"0.5453312",
"0.544413"
] |
0.6701303
|
4
|
Returns the link tags for the css
|
def css_tags
css.map do |url|
"<link href=\"#{url}\" media=\"all\" rel=\"stylesheet\" type=\"text/css\" />"
end.join("\n")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def stylesheet_link_tag(*sources)\n html = []\n sources.each do |stylesheet|\n if is_uri?(stylesheet)\n path = stylesheet\n else\n path = url(\"/css/#{stylesheet}.css\")\n end\n html << \"<link href=\\\"#{path}\\\" type=\\\"text/css\\\" rel=\\\"stylesheet\\\" />\"\n end\n return html.join(\"\\n\")\n end",
"def stylesheet_link_tag(*sources); end",
"def stylesheet_link_tag(*sources); end",
"def stylesheet_link_tag(*sources); end",
"def stylesheet_link_tag(*sources)\n options = sources.extract_options!.stringify_keys\n debug = options.key?(:debug) ? options.delete(:debug) : debug_assets?\n\n sources.map do |source|\n if debug && !(digest_available?(source, 'css')) && (asset = asset_for(source, 'css'))\n asset.to_a.map { |dep| stylesheet_tag(dep.logical_path, { :body => true }.merge(options)) }\n else\n sources.map { |source| stylesheet_tag(source, options) }\n end\n end.uniq.join(\"\\n\").html_safe\n end",
"def css_includes *ss\n\t\t\tss.each { |s|\n\t\t\t\tlink :rel => 'stylesheet', :media => 'all', :href => s\n\t\t\t}\n\t\tend",
"def controller_stylesheet_tags\n\n lo_files = []\n \n required_cc_files.each do |f|\n fn = [f,\"css\"].join(\".\")\n unless Rails.application.assets.find_asset(fn).nil?\n lo_files << stylesheet_link_tag(fn)\n end\n end\n\n lo_files.join.html_safe\n\n end",
"def css(href)\n link :rel => 'stylesheet', :type => 'text/css', :href => href\n end",
"def css(href)\n link :rel => 'stylesheet', :type => 'text/css', :href => href\n end",
"def to_html\n %(<link href=\"#{href}\" rel=\"stylesheet\">)\n end",
"def extra_asset_links\n lines = []\n if item.attributes.has_key?(:css)\n for stylesheet in item.attributes[:css]\n lines.push(\"<link href='/assets/css/#{stylesheet}.css'\"+\n \" type='text/css' rel='stylesheet'>\")\n end\n end\n if item.attributes.has_key?(:js)\n for script in item.attributes[:js]\n lines.push(\"<script type='text/javascript'\" +\n \" src='/assets/js/#{script}.js'></script>\")\n end\n end\n lines.join(\"\\n\")\nend",
"def extra_asset_links\n lines = []\n if item.attributes.has_key?(:css)\n for stylesheet in item.attributes[:css]\n lines.push(\"<link href='/assets/css/#{stylesheet}.css'\"+\n \" type='text/css' rel='stylesheet'>\")\n end\n end\n if item.attributes.has_key?(:js)\n for script in item.attributes[:js]\n lines.push(\"<script type='text/javascript'\" +\n \" src='/assets/js/#{script}.js'></script>\")\n end\n end\n lines.join(\"\\n\")\nend",
"def links\n @links ||= begin\n if doc\n # get a list of distinct links on the page, in absolute url form\n links = doc.css('a[href]').inject([]) do |list, link|\n href = link.attributes['href'].content\n href.strip! if href\n \n unless skip_link?(href)\n begin\n url = to_absolute(href)\n rescue URI::InvalidURIError\n $stderr.puts \"ERROR: bad URI #{href.inspect} on page #{self.url.to_s.inspect}\"\n else\n list << url if url.scheme =~ /^https?$/\n end\n end\n list\n end\n \n links.uniq!\n links\n else\n []\n end\n end\n end",
"def asset_links(lab)\n \"#{github_css_link(lab)} · #{github_html_link(lab)}\"\nend",
"def g_stylesheet_link_tag( *sources )\n options = sources.extract_options! || {}\n options[:position] ||= :post\n sources.each { |src| Guilded::Guilder.instance.add_css_source( src, options[:position] ) }\n ''\n end",
"def stylesheet_link_tag(*sources)\n options = sources.extract_options!.stringify_keys\n if options[\"debug\"] != false && request_debug_assets?\n sources.map { |source|\n check_errors_for(source, :type => :stylesheet)\n if asset = lookup_asset_for_path(source, :type => :stylesheet)\n asset.to_a.map do |a|\n super(path_to_stylesheet(a.logical_path, :debug => true), options)\n end\n else\n super(source, options)\n end\n }.flatten.uniq.join(\"\\n\").html_safe\n else\n sources.push(options)\n super(*sources)\n end\n end",
"def links\n @doc.css('a[href]').map do |a|\n parse_element_attribute_uri(a, 'href')\n end.compact.uniq\n end",
"def stylesheet_link_tag(*sources)\n options = sources.extract_options!.symbolize_keys\n sources.collect { |sheet| stylesheet_tag(sheet, options) }.join(\"\\n\")\n end",
"def link_css(srcs,options={})\n srcs_length = srcs.split(\",\").length\n options[:media] ||= \"screen\"\n options[:type] ||= \"text/css\"\n options[:rel] ||= \"stylesheet\"\n content = \"\"\n if srcs_length == 1\n options[:href] = \"/css/#{srcs}.css\"\n content = single_tag(:link, options)\n else\n srcs.split(\",\").each do |src|\n options[:href] = \"/css/#{src.strip}.css\"\n content << single_tag(:link, options)\n content << \"\\n\"\n end\n end\n content\n end",
"def css_for_doc(doc)\n css_urls_in_doc(doc).map { |url| css_for_url(url) }.join(\"\\n\")\n end",
"def stylesheet_link_tag(*sources)\n options = sources.extract_options!.stringify_keys\n sources.uniq.map { |source|\n tag_options = {\n \"rel\" => \"stylesheet\",\n \"media\" => \"screen\",\n \"href\" => path_to_stylesheet(source)\n }.merge(options)\n tag(:link, tag_options)\n }.join(\"\\n\").html_safe\n end",
"def css_render\n css_list.join(\"\\n\")\n end",
"def links\n @links ||= %w{ a area }.map do |tag|\n search(tag).map do |node|\n Link.new(node, @mech, self)\n end\n end.flatten\n end",
"def links\n @links ||= %w{ a area }.map do |tag|\n search(tag).map do |node|\n Link.new(node, @mech, self)\n end\n end.flatten\n end",
"def css(page_css) \n page_css.split(' ').each do |item|\n content_for(:css) do\n \"<link href=\\\"/stylesheets/#{page_css}.css\\\" rel='stylesheet' type='text/css'/>\\n\" \n end \n end\n end",
"def css\n @css ||= assemble_css\n end",
"def stylesheets\n sheets = []\n sheets << settings.stylesheets.keys if settings.respond_to?('stylesheets')\n sheets << @styles if @styles\n sheets.flatten.uniq.map do |css|\n \"<link href='#{path_to_styles css }' rel='stylesheet' type='text/css'>\"\n end.join\n end",
"def links\n each_link.to_set\n end",
"def stylesheet_link_tag(*sources)\n options = sources.extract_options!.stringify_keys\n concat = options.delete(\"concat\")\n cache = concat || options.delete(\"cache\")\n recursive = options.delete(\"recursive\")\n\n if concat || (ActionController::Base.perform_caching && cache)\n joined_stylesheet_name = (cache == true ? \"all\" : cache) + \".css\"\n joined_stylesheet_path = File.join(joined_stylesheet_name[/^#{File::SEPARATOR}/] ? ASSETS_DIR : STYLESHEETS_DIR, joined_stylesheet_name)\n\n unless ActionController::Base.perform_caching && File.exist?(joined_stylesheet_path)\n write_asset_file_contents(joined_stylesheet_path, compute_stylesheet_paths(sources, recursive))\n end\n stylesheet_tag(joined_stylesheet_name, options)\n else\n expand_stylesheet_sources(sources, recursive).collect { |source| stylesheet_tag(source, options) }.join(\"\\n\").html_safe\n end\n end",
"def reader_css_paths\n @css ||= []\n @css.uniq\n end",
"def links\n return @links if @links\n return false unless @source\n @links = @source.scan(HREF_CONTENTS_RE).map do |match|\n # filter some malformed URLS that come in\n # meant to be a loose filter to catch all reasonable HREF attributes.\n link = match[0]\n Link.new(@t.scheme, @t.host, link).path\n end.uniq\n end",
"def links\n if @links.blank?\n @links = []\n link_nodes =\n FeedTools::XmlHelper.combine_xpaths_all(self.channel_node, [\n \"atom10:link\",\n \"atom03:link\",\n \"atom:link\",\n \"link\",\n \"channelLink\",\n \"a\",\n \"url\",\n \"href\"\n ])\n for link_node in link_nodes\n link_object = FeedTools::Link.new\n link_object.href = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:href\",\n \"@atom03:href\",\n \"@atom:href\",\n \"@href\",\n \"text()\"\n ], :select_result_value => true)\n if link_object.href == \"atom10:\" ||\n link_object.href == \"atom03:\" ||\n link_object.href == \"atom:\"\n link_object.href = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@href\"\n ], :select_result_value => true)\n end\n if link_object.href.nil? && link_node.base_uri != nil\n link_object.href = \"\"\n end\n begin\n if !(link_object.href =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(link_object.href)\n link_object.href = FeedTools::UriHelper.resolve_relative_uri(\n link_object.href,\n [link_node.base_uri, self.base_uri])\n end\n rescue\n end\n if self.configurations[:url_normalization_enabled]\n link_object.href =\n FeedTools::UriHelper.normalize_url(link_object.href)\n end\n link_object.href.strip! unless link_object.href.nil?\n next if link_object.href.blank?\n link_object.hreflang = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:hreflang\",\n \"@atom03:hreflang\",\n \"@atom:hreflang\",\n \"@hreflang\"\n ], :select_result_value => true)\n if link_object.hreflang == \"atom10:\" ||\n link_object.hreflang == \"atom03:\" ||\n link_object.hreflang == \"atom:\"\n link_object.hreflang = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@hreflang\"\n ], :select_result_value => true)\n end\n unless link_object.hreflang.nil?\n link_object.hreflang = link_object.hreflang.downcase\n end\n link_object.rel = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:rel\",\n \"@atom03:rel\",\n \"@atom:rel\",\n \"@rel\"\n ], :select_result_value => true)\n if link_object.rel == \"atom10:\" ||\n link_object.rel == \"atom03:\" ||\n link_object.rel == \"atom:\"\n link_object.rel = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@rel\"\n ], :select_result_value => true)\n end\n unless link_object.rel.nil?\n link_object.rel = link_object.rel.downcase\n end\n if link_object.rel.nil? && self.feed_type == \"atom\"\n link_object.rel = \"alternate\"\n end\n link_object.type = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:type\",\n \"@atom03:type\",\n \"@atom:type\",\n \"@type\"\n ], :select_result_value => true)\n if link_object.type == \"atom10:\" ||\n link_object.type == \"atom03:\" ||\n link_object.type == \"atom:\"\n link_object.type = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@type\"\n ], :select_result_value => true)\n end\n unless link_object.type.nil?\n link_object.type = link_object.type.downcase\n end\n link_object.title = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:title\",\n \"@atom03:title\",\n \"@atom:title\",\n \"@title\",\n \"text()\"\n ], :select_result_value => true)\n if link_object.title == \"atom10:\" ||\n link_object.title == \"atom03:\" ||\n link_object.title == \"atom:\"\n link_object.title = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@title\"\n ], :select_result_value => true)\n end\n # This catches the ambiguities between atom, rss, and cdf\n if link_object.title == link_object.href\n link_object.title = nil\n end\n link_object.length = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:length\",\n \"@atom03:length\",\n \"@atom:length\",\n \"@length\"\n ], :select_result_value => true)\n if link_object.length == \"atom10:\" ||\n link_object.length == \"atom03:\" ||\n link_object.length == \"atom:\"\n link_object.length = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@length\"\n ], :select_result_value => true)\n end\n if !link_object.length.nil?\n link_object.length = link_object.length.to_i\n else\n if !link_object.type.nil? && link_object.type[0..4] != \"text\" &&\n link_object.type[-3..-1] != \"xml\" &&\n link_object.href =~ /^http:\\/\\//\n # Retrieve the length with an http HEAD request\n else\n link_object.length = nil\n end\n end\n @links = [] if @links.nil?\n @links << link_object\n end\n end\n return @links\n end",
"def links; end",
"def links; end",
"def links\n return unless success? and body\n\n doc = Nokogiri::HTML(@body)\n \n links = []\n\n doc.css('div.list-lbc a').each do |a|\n link = {\n :url => a['href'],\n :title => a.css('div.title').first.content.strip\n }\n\n link[:ad_id] = link[:url][/^http:\\/\\/www.leboncoin.fr\\/locations\\/(\\d+).*/,1]\n links << link\n yield link if block_given?\n end\n\n links\n end",
"def links\n @data.links ||= parsed_document.search(\"//a\") \\\n .map {|link| link.attributes[\"href\"] \\\n .to_s.strip}.uniq rescue nil\n end",
"def css_styles\n end",
"def link_css(path, media = \"screen\")\n path = \"/#{path}\" unless path =~ %r{^/}\n path = \"#{path}.css\" unless path =~ %r{\\.css$}\n %{<link href=\"#{timestamp_asset(path)}\" media=\"#{media}\" rel=\"Stylesheet\" type=\"text/css\" />}\n end",
"def stylesheet_link_tag(*sources)\n options = extract_options!(sources)\n\n base_folder = if defined? Compass\n Compass.configuration.css_dir\n else\n 'stylesheets'\n end\n sources.map do |source|\n tag('link', {\n 'rel' => 'stylesheet',\n 'type' => 'text/css',\n 'media' => 'screen',\n 'href' => ensure_path(ensure_extension(source, 'css'), base_folder)\n }.with_indifferent_access.merge(options))\n end.join(\"\\n\")\n end",
"def attributes_for_stylesheet_link(file)\n {:href => file.path, :media => 'screen', :rel => 'stylesheet', :type => 'text/css'}\n end",
"def rss_links \n\t\tdoc.xpath(\"//link[@type=\\\"application/rss+xml\\\"]\").map do |link|\n\t\t\tif link['href'] =~ /^http:\\/\\//\n\t\t\t\tlink['href']\n\t\t\telse\n\t\t\t\t\"#{@url}#{link['href']}\"\n\t\t\tend\n\t\tend\n\tend",
"def links\n self[\"link\"].map { |l| l.href }\n end",
"def links\n self[\"link\"].map { |l| l.href }\n end",
"def css; end",
"def css; end",
"def css; end",
"def render_stylesheet_includes\n return \"\".html_safe unless respond_to?(:stylesheet_links)\n \n stylesheet_links.uniq.collect do |args|\n stylesheet_link_tag(*args)\n end.join(\"\\n\").html_safe\n end",
"def css_path; end",
"def css_path; end",
"def css_styles\n @css_styles ||= []\n end",
"def linked_hrefs(css_selector, strip_spaces = true)\n lnks = css(css_selector)\n ret = []\n for l in lnks\n if l['href']\n url = l['href']\n if strip_spaces\n url.gsub!(/\\s/,'')\n end\n ret << normalize_url(url)\n end\n end\n return ret\n end",
"def links()\n links = Nokogiri::HTML(RedCloth.new(self.body).to_html).css(\"a\").map do |link|\n if (href = link.attr(\"href\")) && href.match(/^https?:/)\n href\n end\n end.compact\n uris = []\n links.each do |link|\n puts link\n uris.push(URI.parse(link))\n end\n return uris\n end",
"def css(file)\n\t\t\t\"<link rel='stylesheet' type='text/css' href='#{file}'>\"\n\t\tend",
"def links\n @links ||= []\n @links\n end",
"def links\n return @links if (defined?(@links) && !@links.nil?)\n @links = Nokogiri::HTML.parse(@html).css('a')\n @links = @links.map {|link| link.attribute('href').to_s}\n @links = @links.delete_if{ |link| (link.nil? || link.to_s == '') }\n\n # remove non-HTTP links\n @links = @links.delete_if{|x| x if !x.match(\"http\")}\n\n # handle HTTP redirect links\n # i.e. 'http://www.google.com/?=http://www.cats.com'\n @links = @links.map{|x| \"http\" + x.split(\"http\").last}.compact\n\n # Remove URL params from links\n @links = @links.map{|x| x.split(/\\?|\\&/).first}.compact\n\n # Sanitize links\n @links = @links.map{|x| URI.decode(x).downcase.strip}.compact\n\n # Remove link proxies(i.e. from Google) & decode URI again\n if url.match(/google\\.com/i)\n @links = @links.map{|x| x.split(\"%2b\").first}.compact\n @links = @links.map{|x| URI.decode(x).downcase.strip}.compact\n end\n\n return @links.uniq\n end",
"def to_css chain = :desc, css = []\n self.traverse :branch do |path, node|\n properties = node.inject(\"\") do |s, (k, v)| \n v.is_a?(String) ? (s + \"#{k}: #{CGI.unescape(v)}; \") : s # Add the property to the list\n end\n css << path * ( chain == :desc ? ' ' : ' > ') + \" { \" + properties + \"}\" # Add the rule-set to the CSS\n end\n css.join \"\\n\"\n end",
"def stylesheet_link_tag(*styles)\n if (@cached_stylesheets )\n\n @cached_stylesheets = @cached_stylesheets.concat(styles)\n \"<!-- #{super(*styles)} -->\"\n else\n super(*styles)\n end\n end",
"def parse_content\n doc = Nokogiri::HTML(open(url.source))\n doc.css('a', 'h1', 'h2', 'h3').map do |link|\n UrlContent.new do |urlc|\n content = link.content.strip.force_encoding(\"utf-8\")\n if link.node_name == 'a'\n content = link.get_attribute(\"href\")\n if not (content.present? and (content.starts_with?(\"http\") or content.starts_with?(\"www\")))\n content = url.source+content.to_s\n end\n end\n urlc.content = content\n urlc.content_type = link.node_name\n urlc.url = self.url\n end\n end\n end",
"def stylesheet_link_tag(string_or_array, *args)\n files = string_or_array.is_a?(Array) ? string_or_array : [string_or_array]\n options = {\n :charset => \"utf-8\",\n :media => \"screen, projection\",\n :rel => \"stylesheet\",\n :type => \"text/css\",\n }.merge(args.last.is_a?(::Hash) ? pop : {})\n\n files.map do |file|\n path = \"assets/stylesheets/#{file}.css\"\n options[:href] = path\n tag(:link, options)\n end.join(\"\\n\")\n\nend",
"def list\n extract_names_and_urls = lambda do |doc|\n [extact_url(@url, document), extract_titles(document)]\n end\n \n html.css('a').map(&extract_names_and_urls)\n end",
"def links()\n return @links\n end",
"def get_astronomy_pages()\n\treturn @archive_doc.css('body b a').map { |page| @base_url + page[\"href\"] }\nend",
"def links\n return @links unless @links.nil?\n @links = []\n return @links if !doc\n\n doc.search(\"//a[@href]\").each do |a|\n next if a['data-method'] && a['data-method'] != 'get'\n u = a['href']\n next if u.nil? or u.empty?\n abs = to_absolute(u) rescue next\n @links << abs if in_domain?(abs)\n end\n @links.uniq!\n @links\n end",
"def extract_links\n content.css('a').map { |a| a['href'] unless a['href'] == '#' }.compact.uniq\n end",
"def links\n return @links\n end",
"def links\n return @links\n end",
"def links\n return @links\n end",
"def inline_styles\n parser.css(\"style\").to_a\n end",
"def load_css(*files)\n content_for(:head) { stylesheet_link_tag(*files) }\n end",
"def styles_and_scripts\n scripts = []\n styles = []\n categories = []\n\n stylesheet = attr :stylesheet\n stylesdir = attr :stylesdir, ''\n default_style = ::Asciidoctor::DEFAULT_STYLESHEET_KEYS.include? stylesheet\n linkcss = (attr? :linkcss) || safe >= ::Asciidoctor::SafeMode::SECURE\n ss = ::Asciidoctor::Stylesheets.instance\n\n if linkcss\n path = default_style ? ::Asciidoctor::DEFAULT_STYLESHEET_NAME : stylesheet\n styles << { href: [stylesdir, path] }\n elsif default_style\n styles << { text: ss.primary_stylesheet_data }\n else\n styles << { text: read_asset(normalize_system_path(stylesheet, stylesdir), true) }\n end\n\n if attr? :icons, 'font'\n if attr? 'iconfont-remote'\n styles << { href: (attr 'iconfont-cdn', FONT_AWESOME_URI) }\n else\n styles << { href: [stylesdir, %(#{attr 'iconfont-name', 'font-awesome'}.css)] }\n end\n end\n\n if attr? 'stem'\n scripts << { src: MATHJAX_JS_URI }\n scripts << { type: 'text/x-mathjax-config', text: %(MathJax.Hub.Config(#{MATHJAX_CONFIG});) }\n end\n\n case attr 'source-highlighter'\n when 'coderay'\n if (attr 'coderay-css', 'class') == 'class'\n if linkcss\n styles << { href: [stylesdir, ss.coderay_stylesheet_name] }\n else\n styles << { text: ss.coderay_stylesheet_data }\n end\n end\n\n when 'pygments'\n if (attr 'pygments-css', 'class') == 'class'\n if linkcss\n styles << { href: [stylesdir, ss.pygments_stylesheet_name(attr 'pygments-style')] }\n else\n styles << { text: ss.pygments_stylesheet_data(attr 'pygments-style') }\n end\n end\n\n when 'highlightjs'\n hjs_base = attr :highlightjsdir, HIGHLIGHTJS_BASE_URI\n hjs_theme = attr 'highlightjs-theme', DEFAULT_HIGHLIGHTJS_THEME\n\n scripts << { src: [hjs_base, 'highlight.min.js'] }\n scripts << { src: [hjs_base, 'lang/common.min.js'] }\n scripts << { text: 'hljs.initHighlightingOnLoad()' }\n styles << { href: [hjs_base, %(styles/#{hjs_theme}.min.css)] }\n\n when 'prettify'\n prettify_base = attr :prettifydir, PRETTIFY_BASE_URI\n prettify_theme = attr 'prettify-theme', DEFAULT_PRETTIFY_THEME\n\n scripts << { src: [prettify_base, 'prettify.min.js'] }\n scripts << { text: 'document.addEventListener(\"DOMContentLoaded\", prettyPrint)' }\n styles << { href: [prettify_base, %(#{prettify_theme}.min.css)] }\n end\n\n styles.each do |item|\n if item.key?(:text)\n categories << html_tag(:style, {}, item[:text])\n else\n categories << html_tag(:link, rel: 'stylesheet', href: urlize(*item[:href]))\n end\n end\n\n scripts.each do |item|\n if item.key? :text\n categories << html_tag(:script, {type: item[:type]}, item[:text])\n else\n categories << html_tag(:script, type: item[:type], src: urlize(*item[:src]))\n end\n end\n\n categories.join \"\\n\"\n end",
"def stylesheets\n @parts.values.map(&:stylesheet).compact\n end",
"def array_to_css_include_tags arr\n return '' if arr.blank?\n s = ''\n arr.each{ |line| s<< stylesheet_link_tag(line, :media=>:screen) }\n s\n end",
"def stylesheets_from_plugins\n Dir.glob(\"vendor/plugins/*/assets/stylesheets/*.css\").select{|s| !s.include? \"vendor/plugins/alchemy\"}.inject(\"\") do |acc, s|\n filename = File.basename(s)\n plugin = s.split(\"/\")[2]\n acc << stylesheet_link_tag(filename, :plugin => plugin)\n end\n end",
"def get_existing_css_classes(link)\n link[\"class\"].to_s\n end",
"def links\n @source._links\n end",
"def include_individual_stylesheets(bundles=[])\n tags = []\n bundles.each do |bundle| \n tags.concat bundle.files.map { |css| stylesheet_link_tag(css.path) }\n end\n tags.join(\"\\n\")\n end",
"def links\n response = Clever.request :get, url\n response[:links]\n end",
"def links\n\t\t( 0...self.link_count ).collect do |i|\n\t\t\tself.link( i )\n\t\tend\n\tend",
"def tags_and_categories_list\n list =[]\n self.div(:id=>\"contentmetadata_tags_container\").links.each do |link|\n list << link.text\n end\n return list\n end",
"def return_links_array(doc)\n links = doc.css(\".search-content .teaser-item__title a\")\n recipe_links = []\n links.each do |element|\n recipe_links << \"https://www.bbcgoodfood.com\" + element.attribute('href').value\n end\n return recipe_links\n end",
"def stylesheet_link_tag(*sources)\n default_options =\n if Wallaby.configuration.features.turbolinks_enabled\n { 'data-turbolinks-track' => true }\n else\n {}\n end\n options = default_options.merge!(sources.extract_options!.stringify_keys)\n super(*sources, options)\n end",
"def css_files\n files = [\"#{url_location}/codemirror.css\", \"#{url_location}/application.css\"]\n\n if Raddocs.configuration.include_bootstrap\n files << \"#{url_location}/bootstrap.min.css\"\n end\n\n Dir.glob(File.join(docs_dir, \"styles\", \"*.css\")).each do |css_file|\n basename = Pathname.new(css_file).basename\n files << \"#{url_location}/custom-css/#{basename}\"\n end\n\n files.concat Array(Raddocs.configuration.external_css)\n\n files\n end",
"def stylesheet src, attributes = {}\n link({:rel => \"stylesheet\", :href => src}.merge(attributes))\n end",
"def get_links(url)\n # catch 404 error from host\n\n doc = Nokogiri::HTML(open(url))\n # find internal links on page\n doc.css('#tagCloud a').each do |link|\n link = link.attr('href')\n # If link correspond to a recipe we add it to recipe to scraw\n if link.include?(ALLOWED_URLS[@host]) && !@crawled_urls.include?(url)\n @to_crawl_urls << link\n end\n end\n @to_crawl_urls.delete url\n @crawled_urls << url\n @to_crawl_urls.uniq!\n rescue OpenURI::HTTPError\n @to_crawl_urls.delete url\n warn \"#{url} cannot be reached\"\n end",
"def links\n nodes = @node.xpath(\"atom:link\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomLink.new(node) }\n end",
"def links\n nodes = @doc.xpath(\"atom:feed/atom:link\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomLink.new(node) }\n end",
"def each_hyperlink # :yields: text\n links = []\n each_hyperlink_attribute {|elem, attr, hyperlink|\n yield hyperlink\n }\n end",
"def blueprint_css\n stylesheet_link_tag( 'screen', :media => 'screen,projection') +\n stylesheet_link_tag( 'print', :media => 'print') +\n '<!--[if IE]>'.html_safe +\n stylesheet_link_tag( 'ie', :media => 'screen,projection') +\n '<![endif]-->'.html_safe\n end",
"def css(href, options = {})\n link({:rel => 'stylesheet', :type => 'text/css', :href => href}.merge(options))\n end",
"def linked\n ret = []\n self.links.inject(ret){|arr , link| arr << link.target}\n self.incomming_links.inject(ret){|arr , link| arr << link.source}\n ret\n end",
"def get_items_links(uri_arr)\n\t\tlinks = []\n\t\t(1..get_max_page(uri_arr) ).each do |x|\n\t\t links.concat P.get_css_list P.build_uri(uri_arr), '.isolux-thumbnail-name a' \n\t\tend\n\t\t\n\t\tlinks\n\tend",
"def stylesheets(*filters)\n query(\"link[rel='stylesheet']\", \"href\", *filters)\n end",
"def links\n construct_html(self.items)\n end",
"def styles\n mentos(:get_all_styles)\n end",
"def find_css\n @dom.css(STYLE_ELEMENT_QUERY).map { |element| read_stylesheet(element) }.compact\n end",
"def links(doc)\n links = []\n doc.search(\"//a[@href]\").each do |a|\n u = a['href']\n next if u.nil? or u.empty?\n links << u\n end\n links.uniq!\n links\n end",
"def css_mapping\n @@css_mapping ||= Hash[Danbooru.config.full_tag_config_info.map { |k, v| [v[\"category\"], v[\"css\"]] }]\n end",
"def collect_links(html)\n Hash[Nokogiri::HTML(html).css('a').collect {|node| [node.text.strip, node.attributes['href'].to_s]}]\n end",
"def links\n @links.values\n end",
"def gets_urls\n page = Nokogiri::HTML(URI.open('http://www2.assemblee-nationale.fr/deputes/liste/alphabetique'))\n urls = []\n\n page.css('div.col-container > ul > li > a').each do |fetch|\n urls.push('http://www2.assemblee-nationale.fr' + fetch['href'])\n end\n\n urls\nend"
] |
[
"0.6864819",
"0.6677279",
"0.66765517",
"0.66765517",
"0.66089404",
"0.6608529",
"0.65576434",
"0.6450691",
"0.6450691",
"0.64465535",
"0.64293253",
"0.6426241",
"0.6404482",
"0.63617927",
"0.6314443",
"0.6308768",
"0.6300712",
"0.6297919",
"0.62951744",
"0.6294637",
"0.62919813",
"0.6275444",
"0.62745804",
"0.62745804",
"0.62325937",
"0.62310463",
"0.61736745",
"0.6162757",
"0.6126701",
"0.61211",
"0.6119861",
"0.6106299",
"0.6104024",
"0.6104024",
"0.6097536",
"0.60913897",
"0.60782045",
"0.60767096",
"0.6076326",
"0.6061041",
"0.6038642",
"0.6021287",
"0.6021287",
"0.600831",
"0.600831",
"0.600831",
"0.5973189",
"0.59720707",
"0.59720707",
"0.59588766",
"0.5956672",
"0.59460235",
"0.5920282",
"0.5876812",
"0.58571196",
"0.5847972",
"0.58465666",
"0.58401227",
"0.58394516",
"0.5823211",
"0.5817611",
"0.58154655",
"0.579312",
"0.5791699",
"0.5788217",
"0.5788217",
"0.5788217",
"0.57739097",
"0.5772692",
"0.57690006",
"0.57543737",
"0.575437",
"0.57490486",
"0.574414",
"0.5744127",
"0.57162356",
"0.5715953",
"0.5706393",
"0.5696407",
"0.5695747",
"0.5688172",
"0.56858194",
"0.5675456",
"0.5650786",
"0.56298536",
"0.5629441",
"0.5624176",
"0.5622283",
"0.561809",
"0.5616046",
"0.5615498",
"0.5613211",
"0.561189",
"0.5604832",
"0.5600245",
"0.55900663",
"0.5589137",
"0.55793035",
"0.55782914",
"0.5574512"
] |
0.8004113
|
0
|
Returns an array of all css files that should be included.
|
def css
css_files = []
@assets.each do |type, path|
case type
when :folder
# Don't import any css/scss files that start with an underscore, so scss partials
# aren't imported by default:
# http://sass-lang.com/guide
css_files += Dir["#{path}/**/[^_]*.{css,scss}"].sort.map do |folder|
'/assets' + folder[path.size..-1].gsub(/[.]scss$/, '')
end
when :css_file
css_files << path
end
end
css_files.uniq
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def stylesheets\n Dir[Dir.pwd + '/*.css'].map { |path| File.read(path) }\n end",
"def stylesheets\n Dir[Dir.pwd + '/*.css'].map { |path| File.read(path) }\n end",
"def all_stylesheet_paths\n all_paths = []\n all_paths += @stylesheets\n all_paths += @content_scripts.map { |cs| cs.stylesheets }.compact\n all_paths.flatten.uniq\n end",
"def css_files\n files = [\"#{url_location}/codemirror.css\", \"#{url_location}/application.css\"]\n\n if Raddocs.configuration.include_bootstrap\n files << \"#{url_location}/bootstrap.min.css\"\n end\n\n Dir.glob(File.join(docs_dir, \"styles\", \"*.css\")).each do |css_file|\n basename = Pathname.new(css_file).basename\n files << \"#{url_location}/custom-css/#{basename}\"\n end\n\n files.concat Array(Raddocs.configuration.external_css)\n\n files\n end",
"def include_css(path)\n if !AppConfig.force_all_css and (use_cache? or browser_is? :ie)\n \"min/#{path}.css\"\n else\n result = []\n Dir[\"#{RAILS_ROOT}/public/stylesheets/#{path}/**/*.css\"].each do |css|\n result << css.gsub(\"#{RAILS_ROOT}/public/stylesheets/\", \"\")\n end\n return result\n end\n end",
"def reader_css_paths\n @css ||= []\n @css.uniq\n end",
"def controller_stylesheet_tags\n\n lo_files = []\n \n required_cc_files.each do |f|\n fn = [f,\"css\"].join(\".\")\n unless Rails.application.assets.find_asset(fn).nil?\n lo_files << stylesheet_link_tag(fn)\n end\n end\n\n lo_files.join.html_safe\n\n end",
"def style_files\n styles.map do |name|\n next name if name.include?('/')\n style_path\n .reject { |p| p.strip.empty? }\n .map { |p| File.join(p, \"#{name}.css\") }\n .detect { |file| File.exist?(file) }\n end\n end",
"def stylesheets\n sort(css.clone.concat(sass_without_partials), config['order_css'] || [])\n end",
"def asset_files\n asset_files = []\n Find.find(assets_path).each do |path|\n next if File.directory?(path)\n next if path.include?(stylesheets_path) || path.include?(images_path)\n asset_files << path.sub(assets_path, 'assets')\n end\n asset_files\n end",
"def sass_files\n [\n styles_scss, components_scss, pages_scss\n ].flatten!\n end",
"def file_paths\n src_file_mask = File.join(@folder_path, '**', '*.c')\n @file_paths = Dir.glob(src_file_mask)\n return @file_paths\n end",
"def included\n return [] if directory.empty? || directory == '*'\n @included ||= process_globs(@raw_data['include'])\n end",
"def casein_config_stylesheet_includes\n\t\t['/casein/stylesheets/custom.css', '/casein/stylesheets/screen.css', '/casein/stylesheets/elements.css']\n\tend",
"def stylesheets\n @parts.values.map(&:stylesheet).compact\n end",
"def stylesheets\n sheets = []\n sheets << settings.stylesheets.keys if settings.respond_to?('stylesheets')\n sheets << @styles if @styles\n sheets.flatten.uniq.map do |css|\n \"<link href='#{path_to_styles css }' rel='stylesheet' type='text/css'>\"\n end.join\n end",
"def files\n paths = %W{html/#{slug}.html html/*_fragment.html images/**/* config/*\n html/stylesheets/custom.css}\n Dir[*paths].map do |path|\n BookFile.new(path) unless File.directory?(path)\n end.compact\n end",
"def include_individual_stylesheets(bundles=[])\n tags = []\n bundles.each do |bundle| \n tags.concat bundle.files.map { |css| stylesheet_link_tag(css.path) }\n end\n tags.join(\"\\n\")\n end",
"def find_includes include_dirs, src\r\n includes = Rake::CParser.parse_file_includes src\r\n res = includes.collect { |inc|\r\n search_includes include_dirs, src, inc\r\n }\r\n res.compact\r\n end",
"def files\n FileUtils.cd(@ruhoh.paths.theme) {\n return Dir[\"**/*\"].select { |filepath|\n next unless self.is_valid_asset?(filepath)\n true\n }\n }\n end",
"def lib_files\n @files.select do |file|\n require_paths.any? do |path|\n file.start_with? path\n end\n end\n end",
"def load_css(*files)\n content_for(:head) { stylesheet_link_tag(*files) }\n end",
"def css_styles\n @css_styles ||= []\n end",
"def get_included(file)\n included = []\n\n @include_path.each do |dir|\n file_name = File.join dir, file\n\n if File.exist? file_name then\n included = IO.readlines file_name\n break\n end\n end\n\n included\nend",
"def files\n @files.map do |file|\n if File.directory?(file)\n Dir[File.join(file, '**', '*.rb')]\n else\n file\n end\n end.flatten\n end",
"def render_stylesheet_includes\n return \"\".html_safe unless respond_to?(:stylesheet_links)\n \n stylesheet_links.uniq.collect do |args|\n stylesheet_link_tag(*args)\n end.join(\"\\n\").html_safe\n end",
"def stylesheets_from_plugins\n Dir.glob(\"vendor/plugins/*/assets/stylesheets/*.css\").select{|s| !s.include? \"vendor/plugins/alchemy\"}.inject(\"\") do |acc, s|\n filename = File.basename(s)\n plugin = s.split(\"/\")[2]\n acc << stylesheet_link_tag(filename, :plugin => plugin)\n end\n end",
"def css\n project_file_read(\"all.css\")\nend",
"def array_to_css_include_tags arr\n return '' if arr.blank?\n s = ''\n arr.each{ |line| s<< stylesheet_link_tag(line, :media=>:screen) }\n s\n end",
"def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)",
"def include_stylesheets\n Pathname.new(StylesheetDir).find do |path|\n next unless path.file?\n if @one_file\n @outfile.puts \" <style>\"\n @outfile.puts path.read\n @outfile.puts \" </style>\"\n else\n @outfile.puts \"<link href=\\\"lib/stylesheets/#{path.basename}\\\" media=\\\"screen\\\" rel=\\\"stylesheet\\\" type=\\\"text/css\\\" />\"\n end\n end\n end",
"def css_includes *ss\n\t\t\tss.each { |s|\n\t\t\t\tlink :rel => 'stylesheet', :media => 'all', :href => s\n\t\t\t}\n\t\tend",
"def included_resources\n @included_resources ||= begin\n return [] if include_param.nil?\n\n include_param.split(RESOURCES_SEPARATOR_CHAR).uniq.reject { |resource| invalid_resource?(resource) }\n end\n end",
"def included_files; end",
"def ignore_includes\n ret = []\n ret << \"_includes/jekyll/**/*\"\n ret << [\"_includes/styleguide\", \"_includes/styleguide/**/*\"]\n ret << \"_includes/*.html\"\n ret << [\"_includes/atoms/figure\", \"_includes/atoms/figure/*\"]\n ret << [\"_includes/atoms/sanitize.html\", \"_includes/atoms/imagetitle.html\", \"_includes/atoms/classname.html\"]\n ret\n end",
"def project_assets\n assets = [\n ['style.css'],\n ['plugin.css'],\n ['admin.css'],\n ['javascripts', 'theme.js'],\n ['javascripts', 'plugin.js'],\n ['javascripts', 'admin.js']\n ]\n\n if project_config[:additional_assets]\n assets = assets | project_config[:additional_assets]\n end\n\n return assets\n end",
"def stylesheet\n @stylesheet ||= Dir.glob(root+'/**/parts.*css').first\n end",
"def add_css(files)\n return add_data(files, :stylesheets, '.css')\n end",
"def _include_file(file)\n return if not file =~ /\\.css$/\n\n file = Chance.get_file(file)\n\n return if file.nil?\n return if file[:included] === @@round\n\n requires = file[:requires]\n requires.each {|r| _include_file(@files[r]) } unless requires.nil?\n\n file[:included] = @@round\n\n @file_list.push(file)\n end",
"def paths\n @paths ||= [\"#{Rails.root}/public/stylesheets\"]\n end",
"def assets_to_compile \n return @assets_to_compile if @assets_to_compile \n files = Dir.glob(prefix + \"**/*\").select {|f| File.file?(f)}\n files.collect! { |f| f.gsub(/^#{prefix}\\//, \"\") }\n end",
"def files\n directory.files\n\n #@files ||= (\n # files = []\n # Dir.recurse(directory.to_s) do |path|\n # next if IGNORE_FILES.include?(File.basename(path))\n # files << path.sub(directory.to_s+'/','')\n # end\n # files.reject{ |f| File.match?(CONFIG_FILE) }\n #)\n end",
"def all_themes\n Dir.chdir(wasko_directory) do |path|\n Dir[\"*.color\"].map do |filename|\n filename.gsub(/\\.color$/, \"\")\n end\n end\n end",
"def ignore_assets\n ret = []\n ret << [\"assets/styles/atoms/flex\", \"assets/styles/atoms/flex/*\"]\n ret << [\"assets/styles/styleguide\", \"assets/styles/styleguide/**/*\"]\n ret << \"assets/styles/**/*.liquid\"\n ret << \"assets/styles/**/*.css\"\n ret << \"assets/styles/*.scss\"\n ret\n end",
"def all_config_files\n #files = Dir[File.join(path, \"_config.yml\")]\n files = Dir[File.join(path, \"_*.yml\")]\n return files\n end",
"def assets\n unless IO.read(\"app/assets/stylesheets/application.css\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/stylesheets/application.css\", :after => \"/*\" do\n %q{\n * Required by SULChrome:\n *= require sul_chrome/sul_chrome_base\n *}\n end\n end\n unless IO.read(\"app/assets/javascripts/application.js\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/javascripts/application.js\", :before => \"//= require_tree .\" do\n%q{// Required by SULChrome:\n//= require sul_chrome/sul_chrome_base\n}\n end\n end\n end",
"def build_imported_files(imported_file_paths) \n imported_file_paths.inject([]) do |files, path|\n files << WebResourceBundler::ResourceFile.new_css_file(path, @file_manager.get_content(path))\n files\n end\n end",
"def all_files\n return manifest_entry.files\n end",
"def stylesheets(*args)\n\t\t@stylesheets ||= []\n\t\targs.each do |stylesheet|\n\t\t\tunless @stylesheets.include?(stylesheet.to_s)\n\t\t\t\t@stylesheets.push(stylesheet.to_s)\n\t\t\t\tcontent_for(:head,stylesheet_link_tag(stylesheet.to_s))\n\t\t\tend\n\t\tend\n\tend",
"def stylesheets(*args)\n\t\t@stylesheets ||= []\n\t\targs.each do |stylesheet|\n\t\t\tunless @stylesheets.include?(stylesheet.to_s)\n\t\t\t\t@stylesheets.push(stylesheet.to_s)\n\t\t\t\tcontent_for(:head,stylesheet_link_tag(stylesheet.to_s))\n\t\t\tend\n\t\tend\n\tend",
"def files()\n\t\t\t\tlist = []\n\t\t\t\tdir = Dir.new( path() )\n\t\t\t\t\n\t\t\t\tdir.each do |f|\n\t\t\t\t\tnext if File.directory?( path() + \"/\" + f )\n\t\t\t\t\tnext unless ( f[/^([A-Z][A-Za-z]*)+\\.class\\.rb$/] == nil )\n\t\t\t\t\tlist << file( f )\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn list\n\t\t\tend",
"def _include_file(file)\n return if not file =~ /\\.css$/\n\n file = Chance.get_file(file)\n\n return if file.nil?\n return if file[:included] === @@generation\n\n requires = file[:requires]\n requires.each {|r| _include_file(@files[r]) } unless requires.nil?\n\n file[:included] = @@generation\n\n @file_list.push(file)\n end",
"def required_files(root = nil)\n sort!\n files = sources.map {|s| s.required_files }.flatten\n if root\n root = Pathname.new(File.expand_path(root))\n files = files.map {|f| Pathname.new(File.expand_path(f)).relative_path_from(root).to_s }\n end\n files\n end",
"def excluded_files() = []",
"def extract_imported_files!(content, base_file_path)\n paths = []\n content.gsub!(IMPORT_PTR) do |result|\n path = $1 \n paths << File.join(File.dirname(base_file_path), path) if path && File.extname(path) == '.css'\n \"\"\n end\n paths\n end",
"def process_stylesheets(body, directory)\n to_inline = []\n\n body.scan(STYLESHEET_PATTERN) do |stylesheet_tag|\n if path = stylesheet_tag[HREF_PATH_PATTERN, :path]\n\n indent = stylesheet_tag[INDENT_PATTERN, :indent] || \"\"\n\n absolute_path = File.absolute_path(path, directory)\n stylesheet_contents = read_file(absolute_path)\n\n to_inline << [stylesheet_tag, \"#{indent}<style>#{stylesheet_contents}\\n#{indent}</style>\"]\n end\n end\n\n to_inline.reduce(body) do |output, (tag, contents)|\n output.gsub(tag, contents)\n end\n end",
"def all_files(options=nil)\n temp_options(options) if options\n files = []\n files << dependencies if @options[:dependencies]\n files << Dir.glob(File.join(@options[:paths], '**/*')) if @options[:paths]\n reset_options if options\n files.flatten.uniq\n end",
"def available_includes\n []\n end",
"def all_entries\n entries = []\n Dir.chdir(@input_dir) do\n entries = Dir.glob(File.join('**', '**')) - %w[mimetype]\n end\n\n entries\n end",
"def monitored_paths\n paths = Dir['**/*'].select do |path|\n @script.patterns.any? {|p| path.match(p) }\n end\n paths.push(@script.path).compact!\n paths.map {|path| Pathname(path).expand_path }\n end",
"def all_files\n Dir.glob(\"#{template_path}/**/*\", File::FNM_DOTMATCH).reject{|path| File.directory?(path) }.sort\n end",
"def find_css\n @dom.css(STYLE_ELEMENT_QUERY).map { |element| read_stylesheet(element) }.compact\n end",
"def stylesheets\n styles.zip(style_files).map do |name, path|\n base = File.basename(path, '.css')\n raise \"style not found: #{style.inspect}\" if path.nil?\n {\n name: name,\n path: path,\n base: File.basename(path, '.css'),\n media: base =~ /(print|screen)$/ ? $1 : 'all'\n }\n end\n end",
"def dependent_files\n processed.map(&:abs_path).compact.select { |fn| File.exist?(fn) }\n end",
"def all_files\n loc_pat = File.join(@base, '**/*')\n Dir.glob(loc_pat, File::FNM_DOTMATCH)\n .select { |e| File.file?(e) }\n .map { |f| f[@base.size + 1..-1] }\n end",
"def files\n @@files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n end",
"def included_sources\n return @included_sources\n end",
"def widget_stylesheets\n Dir[Sonia.root + \"/widgets/*/*.css\"].map do |file|\n widget_name = File.basename(file, \".css\")\n file.gsub(File.join(Sonia.root, \"widgets\"), \"/stylesheets\")\n end\n end",
"def build_css\n Dir[\"#{@src_dir}/stylesheets/**/*.{sass,scss}\"].each do |path|\n file_dir, template = source_template_from_path(path.sub(/^#{@src_dir}\\/stylesheets/, ''))\n\n if !template.match(/(^|\\/)\\_/)\n save_stylesheet(File.join(file_dir, template), generate_css(template, file_dir))\n end\n end\n end",
"def files\n @files = Dir[File.join(root(:site), '**', '*')].inject([]) do |a, match|\n # Make sure its the canonical name\n path = File.expand_path(match)\n file = path.gsub /^#{Regexp.escape root(:site)}\\/?/, ''\n ext = File.extname(file)[1..-1]\n \n if ignored_files.include?(path) or File.directory?(match)\n # pass\n elsif not get_renderer(ext).nil? # Has a renderer associated\n fname = file.chomp(\".#{ext}\")\n fname += get_renderer(ext).default_ext unless File.basename(fname).include?('.')\n a << fname\n else\n a << file\n end\n a\n end\n end",
"def all_javascript_paths\n all_paths = []\n all_paths += @javascripts\n all_paths += @background_scripts\n all_paths += @content_scripts.map { |cs| cs.javascripts }.compact\n all_paths.flatten.uniq\n end",
"def common_src_dirs\n\tsrc_dirs_matches = common_src_dir_list.split(\":\")\n\tsrc_dirs_matches\nend",
"def referenced_files\r\n\t\t(\r\n\t\t\t[file] +\r\n\t\t\t%w[sourcepath importfile].flat_map do |att|\r\n\t\t\t\tfind(att=>/./).flat_map do |asset|\r\n\t\t\t\t\tasset[att].values.compact.map do |path|\r\n\t\t\t\t\t\tpath.sub!(/#.+/,'')\r\n\t\t\t\t\t\tabsolute_path(path) unless path.empty?\r\n\t\t\t\t\tend.compact\r\n\t\t\t\tend\r\n\t\t\tend +\r\n\t\t\tfind.flat_map do |asset|\r\n\t\t\t\tasset.properties.select{ |name,prop| prop.type=='Texture' }.flat_map do |name,prop|\r\n\t\t\t\t\tasset[name].values.compact.uniq.map{ |path| absolute_path(path) }\r\n\t\t\t\tend\r\n\t\t\tend +\r\n\t\t\tfind(_type:'Text').flat_map do |asset|\r\n\t\t\t\tasset['font'].values.compact.map{ |font| absolute_path(font) }\r\n\t\t\tend +\r\n\t\t\t@doc.xpath('/UIP/Project/Classes/*/@sourcepath').map{ |att| absolute_path att.value }\r\n\t\t).uniq\r\n\tend",
"def files\n @files ||= Dir.glob(File.join(@root, '**/*'), GLOB_FLAGS).select do |path|\n File.file?(path) && path !~ IGNORE_REGEX\n end\n end",
"def all_unique_imports\n files.map(&:all_imports).flatten.uniq\n end",
"def manifest_files\n files = []\n exclude = Regexp.new(PROJ.exclude.join('|'))\n Find.find '.' do |path|\n path.sub! %r/^(\\.\\/|\\/)/o, ''\n next unless test ?f, path\n next if path =~ exclude\n files << path\n end\n files.sort!\nend",
"def visible_files\n result = []\n for dir in @dirs\n result += visible_files_under(dir)\n end\n return result\n end",
"def all_paths\n paths = Dir[\"#{@path}/*\"]\n paths = paths.select(&matcher(options[:accept])) if options[:accept]\n paths = paths.reject(&matcher(options[:reject])) if options[:reject]\n paths\n end",
"def all_files_in_dir(p_dir)\n [File.join(p_dir, \"**\", \"*\"), File.join(p_dir, \"**\", \".*\")]\n end",
"def source_files\n @source_files ||= find_files( @source_search_paths, @source_file_extension ).uniq\n @source_files\n end",
"def paths\n unless @paths\n @paths = []\n @paths << project._(:source, :main, :assets) if File.exist?(project._(:source, :main, :assets))\n end\n @paths\n end",
"def list_files(path)\n return Sass::Script::List.new(\n Dir.glob(path.value).map! { |x| Sass::Script::String.new(x) },\n :comma\n )\n end",
"def list_files(path)\n return Sass::Script::List.new(\n Dir.glob(path.value).map! { |x| Sass::Script::String.new(x) },\n :comma\n )\n end",
"def required_assets\n @required_assets ||= []\n end",
"def includedirs\n res = []\n @flags.each { |f| res.push f if f =~ /^-I/ }\n res.join \" \"\n end",
"def files\n @files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n # This returns:\n # [\"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Thundercat - For Love I Come - dance.mp3\"]\n end",
"def css_tags\n css.map do |url|\n \"<link href=\\\"#{url}\\\" media=\\\"all\\\" rel=\\\"stylesheet\\\" type=\\\"text/css\\\" />\"\n end.join(\"\\n\")\n end",
"def file_paths\n Dir.glob(@filepath_pattern).sort\n end",
"def asset_paths\n paths = @parts.values.map(&:asset_path)\n paths << File.dirname(script) if script\n paths << File.dirname(stylesheet) if stylesheet\n paths.compact.uniq\n end",
"def source_paths\n paths = raw_require_paths.dup\n\n if have_extensions?\n ext_dirs = extensions.map do |extension|\n extension.split(File::SEPARATOR, 2).first\n end.uniq\n\n paths.concat ext_dirs\n end\n\n paths.uniq\n end",
"def css_class_names\n @css_class_names ||= []\n end",
"def all_files\n @all_files ||= load_files\n end",
"def all_files\n Dir[@test_pattern].sort\n end",
"def file_list(path, ext = 'scss', remover = '')\n # Necessary so that directories aren't counted\n collect_path = path.include?(\"*\") ? path : \"#{path}/**/*.#{ext}\"\n # Remove first slash from path if present. probably a better way to do this.\n Dir[collect_path].collect { |file| file.gsub(remover, '').gsub(/^\\/app\\//, 'app/') if File.file?(file) }\n end",
"def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end",
"def files\n file_sets.map{|fs| fs.files }.flatten\n end",
"def file_patterns\n [@file_patterns].flatten.compact.uniq\n end",
"def included_resources\n @include_param ? @include_param.split(\",\").reject{ |r| r.include?(\"*\") } : Array.new\n end",
"def get_themes\n themes_dir = File.join(File.dirname(__FILE__), '/public/themes')\n\n themes = []\n Dir.entries(themes_dir).sort.each do |dir|\n themes.push dir if ((dir != 'fonts') and (dir[0] != '.'))\n end\n themes\n end",
"def all_cache_files\n cache_incompletes + cache_completes\n end"
] |
[
"0.7286023",
"0.7286023",
"0.7279719",
"0.7190145",
"0.7125807",
"0.68153167",
"0.68043405",
"0.66962385",
"0.64743495",
"0.6439536",
"0.63381994",
"0.6333574",
"0.63240546",
"0.6251412",
"0.62375724",
"0.6231865",
"0.61180663",
"0.6083035",
"0.60699725",
"0.60644925",
"0.6047104",
"0.6007288",
"0.59865445",
"0.59840167",
"0.59806746",
"0.5971054",
"0.59694463",
"0.5949827",
"0.5946093",
"0.59451145",
"0.5942884",
"0.5939297",
"0.5927356",
"0.5902278",
"0.58780915",
"0.5833636",
"0.58218443",
"0.5812867",
"0.5772634",
"0.5766793",
"0.5755401",
"0.57355773",
"0.5718688",
"0.5702155",
"0.5695711",
"0.569241",
"0.56917864",
"0.5690189",
"0.56870973",
"0.56870973",
"0.56865597",
"0.5680474",
"0.56735986",
"0.5673325",
"0.5673069",
"0.5644419",
"0.56292886",
"0.5624847",
"0.5621919",
"0.5619855",
"0.561389",
"0.56138474",
"0.5605234",
"0.560039",
"0.55999786",
"0.55922127",
"0.5583915",
"0.55714023",
"0.5567065",
"0.55623406",
"0.5549846",
"0.5547724",
"0.5535013",
"0.55328435",
"0.5532094",
"0.55124915",
"0.550276",
"0.5500435",
"0.54941565",
"0.54922354",
"0.54901963",
"0.54876643",
"0.54876643",
"0.5486657",
"0.5486383",
"0.5472336",
"0.5470436",
"0.54676616",
"0.5463688",
"0.54483426",
"0.54478383",
"0.54465926",
"0.5446318",
"0.54455495",
"0.5428231",
"0.5422671",
"0.54173094",
"0.5413112",
"0.5412379",
"0.5397827"
] |
0.7496662
|
0
|
Returns the root path of the app. Similar to Rails.root but does not depend on Rails being defined.
|
def root
@root ||= Pathname.new("#{__dir__}/../../../..").cleanpath
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def app_root\n if defined?(Rails)\n ::Rails.root\n else\n Dir.pwd\n end\n end",
"def root_path\n defined?(Rails) && Rails.root ||\n defined?(Sinatra::Application) && Pathname.new(Sinatra::Application.root) ||\n defined?(ROOT_DIR) && Pathname.new(ROOT_DIR)\n end",
"def root\n Pathname.new(ENV[\"RAILS_ROOT\"] || Dir.pwd)\n end",
"def root\n Rails.root || Pathname.new(ENV[\"RAILS_ROOT\"] || Dir.pwd)\n end",
"def root\n Rails.root || Pathname.new(ENV[\"RAILS_ROOT\"] || Dir.pwd)\n end",
"def root_dir\n is_rails? ? Rails.root.to_s : Dir.pwd.to_s\n end",
"def root\n find_single_directory || @app_dir\n end",
"def root\n return \".\".expand_path unless app_file?\n return @root if @root\n @guessed_root ||= begin\n dir = app_file.expand_path.dirname\n if dir.basename == \"lib\" and not (dir / \"lib\").directory?\n dir.dirname\n else\n dir\n end\n end\n end",
"def root\n application && application.config.root\n end",
"def get_root\n return File.join('/root/path', SETTINGS[:project])\n end",
"def root_path\n @root_path ||= File.expand_path(File.join('.', '../..'))\n end",
"def root(path = nil)\n base = File.expand_path(File.dirname(__FILE__))\n path ? File.join(base, path) : base\n end",
"def root\n root = ENV['JETS_ROOT'].to_s\n root = '.' if root == ''\n root = \"#{root}/\" unless root.ends_with?('/')\n Pathname.new(root)\n end",
"def root_path\n environment.paths.detect { |path| pathname.to_s[path] }\n end",
"def root\n @root ||= Pathname.new(__FILE__).dirname.dirname.expand_path.to_s\n end",
"def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end",
"def rails_root\n @path\n end",
"def root\n File.expand_path(File.dirname(File.dirname(File.dirname(__dir__))))\n end",
"def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end",
"def root\n Pathname.new(File.dirname(__dir__))\n end",
"def root\n @root ||= Pathname.new(File.expand_path('../../../', __FILE__))\n end",
"def root\n @root ||= Pathname.new(File.expand_path('../../../../', __FILE__))\n end",
"def get_root_directory\n return @@root_directory\n end",
"def get_root_directory\n return @@root_directory\n end",
"def root\n Pathname.new File.expand_path('../../', File.dirname(__FILE__))\n end",
"def root_path\n path = File.join(File.dirname(__FILE__), '../')\n Pathname.new(path).realpath\nend",
"def root\n @root ||= Pathname.new(File.expand_path(\"..\", __dir__))\n end",
"def root_path\n @root_path ||= `git rev-parse --show-toplevel`.chomp\n end",
"def set_root_path!\n raise 'APP_ROOT is not set' unless defined?(::APP_ROOT)\n raise 'APP_ROOT is not a directory' unless File.directory?(::APP_ROOT)\n\n @root_path =\n # Pathname is incompatible with Windows, but Windows doesn't have\n # real symlinks so File.expand_path is safe.\n if RUBY_PLATFORM =~ /(:?mswin|mingw)/\n File.expand_path(::APP_ROOT)\n\n # Otherwise use Pathname#realpath which respects symlinks.\n else\n Pathname.new(::APP_ROOT).realpath.to_s\n end\n\n Object.const_set(:RELATIVE_APP_ROOT, ::APP_ROOT.dup) unless defined?(::RELATIVE_APP_ROOT)\n ::APP_ROOT.replace @root_path\n end",
"def root(config = Pantry.config)\n Pathname.new(config.root_dir)\n end",
"def app_path\n \"#{root}/app\"\n end",
"def app_path\n \"#{root}/app\"\n end",
"def root_path(full = true)\n\n if full\n path = Rails.root.join ProgramsDir\n else\n path = Pathname.new ProgramsDir\n end\n\n path.join self.name\n end",
"def root\n File.dirname __dir__\n end",
"def root\n File.dirname __dir__\n end",
"def root\n Dir.pwd\n end",
"def root\n @root ||= Pathname.new(File.expand_path('../../', __FILE__))\n end",
"def root\n @root ||= Pathname.new(File.expand_path(\"../../\", __FILE__))\n end",
"def root; Pathname(__dir__).parent; end",
"def rails_root\n `pwd`.gsub(\"\\n\", \"\")\n end",
"def rails_root\n `pwd`.gsub(\"\\n\", \"\")\n end",
"def root\n File.expand_path(File.dirname(__dir__))\n end",
"def sys_root\n '/'\n end",
"def rails_root\n if defined?(::Rails.root)\n return ::Rails.root.to_s if ::Rails.root\n raise \"ERROR: Rails.root is nil!\"\n end\n return RAILS_ROOT.to_s if defined?(RAILS_ROOT)\n nil\n end",
"def application_root; end",
"def root_path\n Pathname.new(File.expand_path(File.join(__dir__, '..', '..')))\nend",
"def root\n File.dirname(__FILE__)\n end",
"def root_path\n RUBYCOCOA_ROOT.to_s\n end",
"def project_root\n if server_environment\n server_environment['project-root'] || ''\n end\n end",
"def root_path\n ENV['TM_PROJECT_DIRECTORY'] || File.join(ENV['TM_DIRECTORY'], \"..\")\n end",
"def app_root; end",
"def path_to_root\n path_to_script = Pathname.new(File.expand_path $PROGRAM_NAME)\n path_to_parent = path_to_script.parent\n\n if path_to_parent.basename.to_s == 'bin'\n path_to_parent = path_to_parent.parent\n end\n path_to_parent\n end",
"def rails_root\n File.expand_path('../../..', __dir__)\n end",
"def app_uri\n @app_uri ||=\n @rack_context.getInitParameter('app.root') ||\n @rack_context.getInitParameter('rails.root') ||\n '/WEB-INF'\n end",
"def root path = nil\n if path && configurable?\n @root = normalize_path(path)\n # resetting path to an empty string cause root should be an absolute path to templates.\n @path, @setup[:path] = nil\n path ''\n end\n @setup[:root] ||= @root ||\n (@controller.ctrl.slice.view.root if @controller) ||\n Presto::App.root\n end",
"def root\n File.expand_path '../../..', __FILE__\n end",
"def root_path \n @root_path\n end",
"def root\n File.dirname __dir__\n end",
"def root\n File.expand_path(options[:root] || Dir.pwd)\n end",
"def root_path(path) File.join(root, path) end",
"def root_path(basename = nil)\n join(root, basename)\n end",
"def project_root()\n return @project_root_path if @project_root_path\n \n @project_root_path = Common::find_root_of(\"tiapp.xml\", Common::project_path)\n end",
"def path\n application? ? application_path : local_path\n end",
"def root(value = nil)\n if value\n @root = value\n else\n Utils::Kernel.Pathname(@root || Dir.pwd).realpath\n end\n end",
"def app_root_for app, version\n\t\t\t\"#{Nacreon::Config.deploy_root}/#{app.name}/#{version.name}\"\n\t\tend",
"def application_path\n if environment.container?\n applications_path.join(application_name_as_snake_case)\n else\n Pathname.new('app')\n end\n end",
"def root\n @root ||= Pathname.new('.')\nend",
"def path_root\n base_uri ? base_uri : path_to( '/' )\n end",
"def server_root\n return @server_root\n end",
"def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end",
"def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end",
"def conf_root(root = nil)\n Pathname(File.expand_path(root || Environment::CONFROOT || ENV['MIKUTTER_CONFROOT'] || '~/.mikutter'))\n rescue\n Pathname(File.expand_path(ENV['MIKUTTER_CONFROOT'] || '~/.mikutter'))\n end",
"def root path\n File.dirname(find_dotjam(path))\n end",
"def root\n # Provide a best guess for a root when it is not yet configured.\n #\n # This is particularly useful for user-defined slice classes that access `settings` inside\n # the class body (since the root needed to find the settings file). In this case,\n # `configuration.root` may be nil when `settings` is called, since the root is configured by\n # `SliceRegistrar#configure_slice` _after_ the class is loaded.\n #\n # In common cases, this best guess will be correct since most Hanami slices will be expected\n # to live in the app SLICES_DIR. For advanced cases, the correct slice root should be\n # explicitly configured at the beginning of the slice class body, before any calls to\n # `settings`.\n config.root || app.root.join(SLICES_DIR, slice_name.to_s)\n end",
"def root\n @site.root\n end",
"def app_root_url\n root_url(host: Rails.configuration.x.app_host)\n end",
"def root\n \"#{File.dirname(__FILE__)}/..\"\nend",
"def root_url\n \"#{@env['rack.url_scheme']}://#{@env['HTTP_HOST']}\"\n end",
"def rootDir\n if @workflow[:root_dir]\n OpenStudio.toPath(@workflow[:root_dir])\n else\n OpenStudio.toPath(@osw_dir)\n end\n end",
"def rails_root(_attachment, _style_name)\n Rails.root\n end",
"def root *folders\n File.expand_path(File.join(*([app_root, folders].flatten.uniq.tap{|path| path.delete(nil) })))\n end",
"def script_root\n @script_root ||= File.dirname(__FILE__)\n end",
"def base_path\n @base_path ||= server_path(File.expand_path(Dir.pwd))\n end",
"def plugin_app_root\n \"#{plugin_test_root}/app_root\"\n end",
"def lookup_root\n root = nil\n Dir.ascend(Dir.pwd) do |path|\n check = Dir[ROOT_GLOB].first\n if check\n root = path \n break\n end\n end\n root || Dir.pwd\n end",
"def relativize_root_path(path)\n path.to_s.sub(/^#{Regexp.escape(@root)}/, '$root')\n end",
"def root_folder\n load unless loaded?\n @root_folder\n end",
"def server_root\r\n File.expand_path(\"#{rails_root}/public/\")\r\n end",
"def root\n settings[:basedir]\n end",
"def app_path(path)\n File.expand_path(path, Dir.pwd)\n end",
"def root\n @root || Merb::Config[:merb_root] || File.expand_path(Dir.pwd)\n end",
"def root_path; end",
"def root_path; end",
"def root_path; end",
"def app_dir_pathname\n @app_dir_pathname ||= Pathname.new(app_name)\n end",
"def npm_root_path\n @npm_root_path ||= npm_path_for(\"root\")\n end",
"def root_uri_path\n @options[:root_uri_path]\n end",
"def root_dir\n self.class.plays_dir.join script_name\n end",
"def construct_document_root\n return Dir.pwd + \"/public\"\n end",
"def root_path(*args)\n File.join(ROOT_DIR, *args)\nend"
] |
[
"0.86103046",
"0.8584908",
"0.8458264",
"0.82643515",
"0.82643515",
"0.8241175",
"0.8216867",
"0.81254",
"0.800226",
"0.7990894",
"0.7980168",
"0.793658",
"0.78503126",
"0.78305733",
"0.78168565",
"0.7776903",
"0.77692354",
"0.77244896",
"0.77091056",
"0.76808685",
"0.7663625",
"0.76626277",
"0.76557297",
"0.76557297",
"0.76291114",
"0.75928956",
"0.75494444",
"0.75345886",
"0.75324655",
"0.75164646",
"0.75075114",
"0.75075114",
"0.74940664",
"0.74342465",
"0.74342465",
"0.7424125",
"0.7418369",
"0.74172956",
"0.74008864",
"0.7397364",
"0.7397364",
"0.7377572",
"0.7371023",
"0.73687947",
"0.7315966",
"0.7304218",
"0.730246",
"0.726762",
"0.7266812",
"0.7263796",
"0.7258965",
"0.72398",
"0.7232828",
"0.7210255",
"0.7208891",
"0.72030634",
"0.71965384",
"0.7174336",
"0.7172293",
"0.71307063",
"0.70955914",
"0.70451474",
"0.7040123",
"0.7034995",
"0.7034378",
"0.7029392",
"0.7018481",
"0.70140404",
"0.6999026",
"0.6976685",
"0.6976685",
"0.6957255",
"0.69420296",
"0.690369",
"0.6897621",
"0.6888084",
"0.68779457",
"0.6874088",
"0.6865665",
"0.68639696",
"0.68586564",
"0.68413204",
"0.6834835",
"0.68340707",
"0.6828121",
"0.6827187",
"0.6824873",
"0.6823121",
"0.68135333",
"0.6805167",
"0.6775118",
"0.67659414",
"0.67659414",
"0.67659414",
"0.67648506",
"0.6754704",
"0.67476517",
"0.6745393",
"0.67396075",
"0.67371225"
] |
0.744482
|
33
|
Returns the path to the tmp directory.
|
def tmp_dir
@tmp_dir ||= root / 'tmp'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tmp_dir\n return Dir.tmpdir if path_of('tmp_dir').nil?\n return path_of('tmp_dir')\n end",
"def tmp_path\n File.join gem_root, 'tmp'\n end",
"def tmp_dir\n File.expand_path(self.relative_tmp_dir, @options[:root_dir])\n end",
"def get_tmp_dir\n return \"#{Dir.tmpdir}/FilesRebuilder\"\n end",
"def temp_dir\n name = 'tmp_' + rand.to_s.gsub(/\\D/, '')\n File.join(@temp_root, name)\n end",
"def get_temp_directory\n defined?(Rails) ? \"#{Rails.root}/tmp\" : \"/tmp\"\n end",
"def relative_tmp_dir\n parse_dir_options(:tmp_dir)\n end",
"def tmp_path\n File.expand_path(@dirs.first.to_s)\nend",
"def tmp_path(path)\n return File.expand_path(File.join(@@config['tmpPath'], path))\n end",
"def get_tmp_path(temp_path)\n if not temp_path\n temp_path = Dir.tmpdir\n end\n\n Mongolicious.logger.info(\"Using #{temp_path} as root for our temp backup.\")\n return \"#{temp_path}/#{Time.now.to_i}\"\n end",
"def get_tmp_path\n \"#{Dir.tmpdir}/#{Time.now.to_i * rand}\"\n end",
"def lock_dir\n File.join(Dir.home, \"tmp\")\n end",
"def tmp_root_path\n @tmp_root_path ||= File.realpath(Dir.mktmpdir)\n end",
"def tmp_path\n root_path.join('tmp')\nend",
"def tmp_path\n Berkshelf.root.join(\"spec/tmp\")\n end",
"def tempdir #:doc:\n Dir.tmpdir\n end",
"def tempdir_name\n dir = File.join(Dir.tmpdir, SecureRandom.uuid)\n refute(Dir.exists?(dir))\n dir\n end",
"def publish_tmp_dir_path()\n user_tmp_dir_container = ENV['DOCS_TMP_DIR_CONTAINER']\n if (not user_tmp_dir_container.nil?) && user_tmp_dir_container.length > 0\n subdir = File.join(\n user_tmp_dir_container,\n SecureRandom.uuid\n )\n else\n subdir = SecureRandom.uuid\n end\n\n return File.join(\n Dir.tmpdir(),\n subdir\n )\n end",
"def remote_tmp_path\n '/tmp'\n end",
"def tmp_path\n return @tmp_path if @tmp_path\n\n raise NotImplementedError.new (\"implement this before running on the cluster!\")\n\n end",
"def local_path\n TMP_PATH\n end",
"def app_tmp_dir\n base_dir = app_sandbox_dir\n if base_dir.nil?\n nil\n else\n File.join(base_dir, 'tmp')\n end\n end",
"def tmp_path(*dirs)\n File.join(File.dirname(__FILE__), '..', 'tmp', 'spec', *dirs)\n end",
"def path\n Path.new(@tmpname)\n end",
"def path\n \"#{Dir.tmpdir}/#{name}\"\n end",
"def temp_dir\n if @temp_dir.nil?\n @@get_temp_dir_api = Win32::API.new('GetTempPath', 'LP', 'L') unless @@get_temp_dir_api\n buffer = 0.chr * MAX_PATH\n @@get_temp_dir_api.call(buffer.length, buffer)\n @temp_dir = pretty_path(buffer.unpack('A*').first.chomp('\\\\'))\n end\n rescue\n @temp_dir = File.join(Dir::WINDOWS, \"temp\")\n ensure\n return @temp_dir\n end",
"def tmp_resource_dir(path)\n @tmp_resource_dir = \"#{tmp_dir}/#{path}\" unless path.blank?\n end",
"def temporary_directory\n \"#{ROOT}/spec/tmp\"\n end",
"def path\n @tmpname\n end",
"def lotemix_tempdir\n if File.exist?('/dev/null') #si es linux\n tf = \"/tmp/lotfiles/\"\n else\n tf = 'c:\\\\temp\\\\'\n end\n\tif not File.exist?(tf)\n FileUtils.mkdir(tf)\n end\n\n return tf \n end",
"def mk_tmp_dir\n Dir.mktmpdir('janna-tmp-download-', '/tmp')\n end",
"def dir_path\n RAILS_ROOT + '/temp_files/' + Digest::MD5.hexdigest(self.id.to_s)[0..1] + '/'\n end",
"def tmp_path\n File.join(TMP_PATH, TRIGGER)\n end",
"def tmpdir\n used? ? File.join(DOCKER_MACHINE_DOCKER_HOME, 'tmp', Dir.tmpdir) : Dir.tmpdir\n end",
"def temporary_output_path\n Gym.cache[:temporary_output_path] ||= File.join(\"/tmp\", Time.now.to_i.to_s)\n end",
"def home_path\n result = tmp_path.join(\"home\")\n FileUtils.mkdir_p(result)\n result\n end",
"def temp_mounted_path\n mounted_path.sub(\"#{archive_file_name}#{ArchiveMountSuffix}\", \".tmp-#{archive_file_name}#{ArchiveMountSuffix}\")\n end",
"def tmpdir; end",
"def make_tmp_dir\n if(!File.directory? @temp_dir)\n Dir.mkdir(@temp_dir)\n end\n end",
"def temporary_path(filename)\n Global.temporary_directory + filename\n end",
"def temp_dir\n dir = make_temp_dir\n chown(dir, user)\n dir\n end",
"def scratch_folder()\n return File.expand_path(File.join(File.dirname(__dir__), \"tmp\", \"scratch-folder-for-testing\"))\nend",
"def generate_temp_path\n path = Tempfile.new($$).path\n rm_f path\n path\n end",
"def temp (extension)\n path = \"#{FileUtils::Config.tmp_dir}/tmp.#{extension}\"\n id = 1\n while File.exists?(path)\n path = \"#{FileUtils::Config.tmp_dir}/tmp.#{id}.#{extension}\"\n id += 1\n end\n\n path\n end",
"def tmpfile_path(filename)\n # Ensure that the ?dl=1 parameter is removed\n Pathname.new(Dir.tmpdir).join(\n filename.sub(DOWNLOAD_PARAMETER_REGEX, \"\")\n )\n end",
"def tmpdir\n File.join(Dir.tmpdir, 'ruby')\n end",
"def __path__\n File.join(root, 'tmp', 'build')\n end",
"def path\n tempfile.path\n end",
"def generate_temp_dir\n empty_directory File.join(Rails.root, \"tmp\", \"fusioncharts\")\n end",
"def tmp &block\n tmp_dir = \"/tmp_#{rand(10**6)}\"\n if block\n begin\n create_dir tmp_dir\n block.call tmp_dir\n ensure\n delete_dir tmp_dir\n end\n else\n create_dir tmp_dir\n tmp_dir\n end\n end",
"def work_path\n @work_path ||= tmp_path.join(name)\n end",
"def tmpdir\n @tmpdir ||= begin\n Dir.mktmpdir\n end\n end",
"def tmpdir\n @tmpdir ||= configuration[:copy_dir] || Dir.tmpdir\n end",
"def tmpdir\n @tmpdir ||= configuration[:copy_dir] || Dir.tmpdir\n end",
"def elasticsearch_hdfs_tmp_dir io\n cleaner = %r{[^\\w/\\.\\-\\+]+}\n io_part = [io.index, io.mapping].compact.map { |s| s.gsub(cleaner, '') }.join('/')\n File.join(settings[:es_tmp_dir] || '/', io_part || '', Time.now.strftime(\"%Y-%m-%d-%H-%M-%S\"))\n end",
"def pid_path\n File.join(\"tmp\", \"fuseki.pid\")\n end",
"def tmp_file\n counter = 1\n path = nil\n dir = Rails.root + \"/tmp/pdfs\"\n FileUtils.mkdir_p(dir)\n dir = Pathname.new(dir).realpath\n while path.nil? || File.file?(path)\n path = \"#{dir}/pdf-#{counter}\"\n counter += 1\n end\n path\n end",
"def create_tmp_folder\n %x{ mkdir -p #{tmp_path} }\n end",
"def mountpoint\n \"#{spec[:temp_dir]}\"\n end",
"def temporary_output_path\n Gym.cache[:temporary_output_path] ||= Dir.mktmpdir('gym_output')\n end",
"def tempdir\n @tmpdir ||= Dir.mktmpdir(\"dockerfile\")\n File.realpath(@tmpdir)\nend",
"def tmpdir\n @tmpdir ||= File.join(Dir.tmpdir, 'sample_file', 'image')\n end",
"def tmp_filename(user = current_user)\n \"#{ENCLOSURE_PATH}tmp_#{user.login}\"\n end",
"def get_free_file_path\n tempfile = Tempfile.new('foo', \"#{Rails.root}/test/fixtures/data/upload\")\n res = tempfile.path\n tempfile.close\n tempfile.unlink\n res\n end",
"def pid_dir\n File.join(::Rails.root, 'tmp', 'pids')\n end",
"def getOtherLocation\n return \"#{Dir.tmpdir}/RDITest\"\n end",
"def container_tmpdir\n dimg.container_dapp_path(\"ansible-tmpdir\")\n end",
"def gen_tmp_filename\n Dir::Tmpname.make_tmpname ['/tmp/ruby-sox', \".#{MEDIATE_TYPE}\"], nil\n end",
"def cache_dir\n Padrino.root(\"tmp\")\n end",
"def cache_dir\n Padrino.root(\"tmp\")\n end",
"def file_cache_dir\n @file_cache_dir || FileHelper.tmpdir\n end",
"def tmpdir\n @tmpdir = (\n dir = ENV['XDG_CACHE_HOME'] || '~/.cache'\n dir = File.expand_path(File.join(dir, 'ruby'))\n ensure_directory(dir) # TODO: do this here?\n )\n end",
"def make_tmp_dir dir\n tmp_dir = File.join dir, \"lsa_cluster_tmp.#{rand}\"\n\n # Make sure tmp_dir doesn't already exist\n while Dir.exist? tmp_dir\n tmp_dir = File.join dir, \"lsa_cluster_tmp.#{rand}\"\n end\n\n FileUtils.mkdir_p tmp_dir\n\n tmp_dir\nend",
"def temp_path\n @temp_path ||= generate_temp_path\n FileUtils.cp(polei.path, @temp_path) unless File.exist?(@temp_path)\n @temp_path\n end",
"def tempfile_dirnames\n # in why-run mode we need to create a Tempfile to compare against, which we will never\n # wind up deploying, but our enclosing directory for the destdir may not exist yet, so\n # instead we can reliably always create a Tempfile to compare against in Dir::tmpdir\n if Chef::Config[:why_run]\n [ Dir.tmpdir ]\n else\n case Chef::Config[:file_staging_uses_destdir]\n when :auto\n # In auto mode we try the destination directory first and fallback to ENV['TMP'] if\n # that doesn't work.\n [ ::File.dirname(@new_resource.path), Dir.tmpdir ]\n when true\n [ ::File.dirname(@new_resource.path) ]\n when false\n [ Dir.tmpdir ]\n else\n raise Chef::Exceptions::ConfigurationError, \"Unknown setting '#{Chef::Config[:file_staging_uses_destdir]}' for Chef::Config[:file_staging_uses_destdir]. Possible values are :auto, true or false.\"\n end\n end\n end",
"def librarian_set_tmp_directory(tmp_path)\n command = ['librarian-puppet', 'config', 'tmp', tmp_path, '--global']\n command << '--verbose' unless ENV['LIBRARIAN_VERBOSE'].nil?\n sh *command\nend",
"def tmpdir(base=nil)\n if base\n ::File.join(Dir.tmpdir, 'smeagol', base)\n else\n ::File.join(Dir.tmpdir, 'smeagol', Time.now.year.to_s)\n end\n end",
"def tmp &block\n tmp_dir = \"/tmp/vfs_#{rand(10**3)}\" \n if block\n begin\n create_dir tmp_dir\n block.call tmp_dir\n ensure\n delete_dir tmp_dir\n end\n else\n create_dir tmp_dir\n tmp_dir\n end\n end",
"def pathname(prefix=DEFAULT_PREFIX)\n\n root = ENV[\"TMP\"] || ENV[\"TMPDIR\"] || ENV[\"TEMP\"] || \"/tmp\"\n return File.join(root, \"#{prefix}-#{SecureRandom.hex(30)}\")\n end",
"def tmp_folder\n \"tmp/github/#{delivery_id}\"\n end",
"def tmp_path\n options[:iso_upload_path] || \"#{tmp_dir}\\\\VBoxGuestAdditions.iso\"\n end",
"def get_pid_path\n pids_path = File.join(\"tmp\", \"pids\")\n FileUtils.mkdir_p(pids_path) unless File.directory?(pids_path)\n Rails.root.join(pids_path, \"fuseki.pid\")\n end",
"def prepare_cache_path\n cache = Tempfile.new(\"\", Global.file_cache_directory)\n path = cache.path\n cache.close(true)\n return path\n end",
"def remove_tmp_dir\n if Dir.exist?(File.expand_path('../tmp/', File.dirname(__FILE__)))\n FileUtils.rm_rf(File.expand_path('../tmp/', File.dirname(__FILE__)))\n end \n end",
"def store_dir\n\t\t\"magic_beans/upload/tmp/#{model.id}\"\n\tend",
"def container_tmpdir\n '/tmp'\n end",
"def make_tmp_dir\n FileUtils.mkdir_p @log_dir\n Dir[\"#{@log_dir}/*\"].each do |file|\n FileUtils.rm_rf file\n end\n end",
"def tmp_filepath(filepath)\n # Note : This a md5 hash of the file in the same directory\n filepath = File.expand_path(filepath)\n extname = File.extname(filepath)\n dirname = File.dirname(filepath)\n md5 = Digest::MD5.hexdigest(filepath)\n File.join(dirname, '__html2pdf_tmp__' + md5 + extname)\n end",
"def tmpdir=(_arg0); end",
"def cache_directory\n Rails.root.join('tmp', 'export')\n end",
"def pid_dir\n File.expand_path(File.join(@base_path,'tmp','pids'))\n end",
"def tmpdir(id=:default)\n @tmpdirs[id] ||= Dir.mktmpdir\n end",
"def gen_tempfile_path\n tf = Tempfile.new('filechanges.tgz')\n tf_path = tf.path\n tf.close\n tf.unlink\n tf_path\n end",
"def _prepare_dir(project)\n tmp_path = Rails.root.join(\"tmp/git_checkout/#{Rails.env}/#{project.id}/#{project.path_with_namespace}\")\n tmp_path.mkpath unless tmp_path.exist?\n\n return tmp_path\n end",
"def path()\n file = File.join(Eddy.config.tmp_dir, \"eddy_persistent_data.json\")\n # FileUtils.mkdir_p(File.dirname(file))\n return Pathname.new(file)\n end",
"def within_tmp(&block) \n FileUtils.mkdir(dirname = File.join(File.dirname(__FILE__), 'tmp'))\n yield(File.expand_path(dirname))\n ensure\n FileUtils.rm_rf(dirname)\n end",
"def make_tmpdir_name(base)\n Dir::Tmpname.make_tmpname(File.join(Dir.tmpdir, base), nil)\n end",
"def temp_bags_directory\n ENV.fetch('RAILS_TMP', 'tmp')\n end",
"def store_dir\n Rails.root + \"app/assets/tmp/#{model.id}\"\n end",
"def package_tmp\n config.package_tmp\n end"
] |
[
"0.91156316",
"0.87035847",
"0.86786705",
"0.8584702",
"0.85378194",
"0.8458781",
"0.82125074",
"0.81841594",
"0.81374884",
"0.80592227",
"0.80571204",
"0.80511886",
"0.80427134",
"0.8013715",
"0.8009329",
"0.79961544",
"0.79811615",
"0.7972046",
"0.79370505",
"0.78426313",
"0.777857",
"0.77623516",
"0.77404135",
"0.77320576",
"0.7675511",
"0.761557",
"0.7574558",
"0.7510675",
"0.7496471",
"0.74507546",
"0.73980206",
"0.7301965",
"0.72963077",
"0.7269409",
"0.72567147",
"0.71920335",
"0.71681255",
"0.71434516",
"0.713757",
"0.71234775",
"0.70386654",
"0.6938311",
"0.69280463",
"0.6915814",
"0.6915525",
"0.69079006",
"0.69059706",
"0.69009256",
"0.68974805",
"0.6871281",
"0.6834937",
"0.6828447",
"0.6819337",
"0.6819337",
"0.68155295",
"0.6804037",
"0.6800803",
"0.67908275",
"0.67896813",
"0.67829645",
"0.67656696",
"0.6754991",
"0.6742031",
"0.67006105",
"0.6699754",
"0.6694191",
"0.667118",
"0.667097",
"0.6654758",
"0.6654758",
"0.66537863",
"0.66521317",
"0.66393095",
"0.6615627",
"0.66096",
"0.6607233",
"0.65540385",
"0.65527654",
"0.6548835",
"0.6548402",
"0.6534375",
"0.649756",
"0.6496136",
"0.6480478",
"0.6473183",
"0.6472442",
"0.6462808",
"0.6457683",
"0.64522004",
"0.64511347",
"0.64472455",
"0.6442007",
"0.64346254",
"0.6433001",
"0.64185876",
"0.63973606",
"0.6396711",
"0.6367142",
"0.6363819",
"0.6336566"
] |
0.85568225
|
4
|
Get the config folder path.
|
def config_root
@config_root ||= root / 'config'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cfg_dir\n File.join(@full_path, CONFIG_DIR)\n end",
"def conf_folder\n conf['conf_folder'] || '.'\n end",
"def get_config_directory()\n\t\t\tconfig_directory= File.join(@base_directory, \"config\")\n\t\t\treturn config_directory\n\t\tend",
"def getConfigPath\n if @conf[:config_name].index('/')\n return @conf[:config_name] if File.file?(@conf[:config_name])\n else \n @conf[:config_dirs].each {|i|\n r = Pathname.new(i) + @conf[:config_name]\n return r if File.file?(r)\n }\n end\n\n CliUtils.warnx \"no config file '#{@conf[:config_name]}' found\" if @conf[:verbose] >= 2\n return nil\n end",
"def config_dir\n dir = options[:config] ? File.dirname(options[:config]) : './config'\n File.expand_path(dir)\n end",
"def get_uplift_config_folder\n path = File.expand_path(@@config_file_path)\n FileUtils.mkdir_p path\n\n return path\n end",
"def app_config_path\n Pathname.new('.').join('config')\n end",
"def config_path\n @config_path ||= local_config_path\n end",
"def config_path\n ::Rails.root.to_s + \"/config/#{self.name.split('::').last.underscore.pluralize}.yml\"\n end",
"def config_path\n if result = chef_api_config_path\n Pathname(result).expand_path\n else\n Pathname(\"\")\n end\n end",
"def path\n @path ||= File.dirname @config_file\n end",
"def base_config_path\n BASE_CONFIG_PATH\n end",
"def find_config_path\n path = Pathname(Pathname.pwd).ascend{|d| h=d+config_filename; break h if h.file?}\n end",
"def default_path\n Pathname.pwd.join(*base_config_path, self.class.config_folder)\n end",
"def config_dir\r\n unless @config_dir # first time? calculate config_dir value to \"cache\"\r\n \r\n if opts.config_path\r\n @config_dir = opts.config_path\r\n else\r\n @config_dir = cache_dir\r\n end\r\n \r\n # make sure path exists\r\n FileUtils.makedirs( @config_dir ) unless File.directory? @config_dir\r\n end\r\n \r\n @config_dir\r\n end",
"def config_dir\n Wonkavision::Sample::CONFIG_DIR\n end",
"def config_file\n File.join AppRoot, ConfigFile\n end",
"def config_path\n @config_path ||= 'config/spinach.yml'\n end",
"def config_path\n Gym.cache[:config_path] ||= \"#{Tempfile.new('gym_config').path}.plist\"\n return Gym.cache[:config_path]\n end",
"def path\n @configuration.path\n end",
"def path\n File.join(Settings.root, folder_name.to_path)\n end",
"def config_path\n File.join(solr_home, 'conf')\n end",
"def config_path\n Gym.cache[:config_path] ||= \"/tmp/gym_config_#{Time.now.to_i}.plist\"\n return Gym.cache[:config_path]\n end",
"def full_configuration_path\n @full_config_path ||= File.join(self.class.config_base_path, self.class.config_path)\n end",
"def config_dir\n \"#{gem_dir}/config\"\n end",
"def config_dir\n \"#{gem_dir}/config\"\n end",
"def config_file_path(full_directory_path)\r\n config_path = File.join(full_directory_path, @folder_config)\r\n logger.debug('config_file_path') { \"Config file path: #{config_path}\"}\r\n config_path\r\n end",
"def confdir\n cli_confdir = cli[:confdir]\n global = global_config_dir\n if !cli_confdir.nil?\n return cli_confdir\n elsif File.directory?(global)\n return global\n else\n return user_config_dir\n end\n end",
"def get_config_path()\n return ENV['DOCS_CONFIG_PATH'] || CONFIG_PATH_DEFAULT\n end",
"def config_directory\n return @dir if @dir\n\n path = @options[:directory] || default_config_dir\n @dir = File.expand_path(path)\n end",
"def config_dir\n runtime_config.generated_files_dir\n end",
"def folder_path\n File.expand_path @folder_path\n end",
"def relative_config_file\n File.join(@settings[:config_dir], @settings[:config_file])\n end",
"def global_config_path\n linux_cfg = '/etc/openshift/' + conf_name\n File.exists?(linux_cfg) ? linux_cfg : File.join(File.expand_path(File.dirname(__FILE__) + \"/../../conf\"), conf_name)\n end",
"def config_path=(value)\n @config_path = value\n end",
"def path\n @path || File.expand_path(ENV['NEXUS_CONFIG'] || DEFAULT_FILE)\n end",
"def config_directory\n \"C:\\\\chef\"\n end",
"def config_path\n etc+\"php/\"\n end",
"def config_path\n NginxStage.pun_config_path(user: user)\n end",
"def project_dir\n config.project_dir\n end",
"def dir\n ENV['XDG_CONFIG_HOME'] || File.join(home, '.config')\n end",
"def config_path(svc_name)\n # strip st2 prefix\n noprefix_name = svc_name.sub(/^st2/, '')\n config_name = ['logging', noprefix_name, 'conf'].compact.join('.')\n File.join([spec[:conf_dir], config_name])\n end",
"def configuration_file_path; end",
"def get_root\n return File.join('/root/path', SETTINGS[:project])\n end",
"def package_config\n File.join @proj_path_base, 'packages.config'\n end",
"def config_filename\n return @config_filename if @config_filename\n\n @config_filename = File.join(config_directory, \"config\")\n end",
"def test_folder\n config[:test_folder].nil? ? config[:test_base_path] : absolute_test_folder\n end",
"def core_cfg_path\n File.expand_path(ENV[\"DBS_CFGDIR\"].presence || \"~/.db_sucker\")\n end",
"def get_file_path(filename)\n # dir = File.realdirpath(File.join(File.dirname(__FILE__), '..', 'config'))\n File.join(@dir, filename)\n end",
"def config_file_path\n rails_root + \"/config/redis.conf\"\n end",
"def config_path\n test? ? \"config-test.yml\" : \"config.yml\"\n end",
"def folder\n if Rails.configuration.respond_to?(:echo_uploads) and Rails.configuration.echo_uploads.folder\n Rails.configuration.echo_uploads.folder\n else\n ::File.join Rails.root, 'echo_uploads', Rails.env\n end\n end",
"def config_dev_path\n File.join test_app_path, 'config', 'deploy', 'dev.rb'\n end",
"def plugin_config_file\n File.join(@dir, Config::FILE_NAME)\n end",
"def dir\n # config.repos_dir + @name\n end",
"def folder_path\n File.join(location.path, folder_name)\n end",
"def hiera_configpath(hiera)\n File.join('config', 'hieras', hiera, 'hiera.yaml')\nend",
"def conf_root(root = nil)\n Pathname(File.expand_path(root || Environment::CONFROOT || ENV['MIKUTTER_CONFROOT'] || '~/.mikutter'))\n rescue\n Pathname(File.expand_path(ENV['MIKUTTER_CONFROOT'] || '~/.mikutter'))\n end",
"def path_dir\n File.split(path).first\n end",
"def config_file\n @config_file ||= File.join( home_dir, TyrantManager.config_file_basename )\n end",
"def package_dir\n config.package_dir\n end",
"def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end",
"def active_configuration_path\n configuration_paths.find do |path|\n File.file? path\n end || theme_configuration_path\n end",
"def config_file\n File.join(@path, %w[ application config application.php ])\n end",
"def repo_path\n @config.get_value('GIT_REPO_ROOT')\n end",
"def folder\n @root_folder\n end",
"def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end",
"def right_agent_cfg_dir\n return pretty_path(File.join(Dir::COMMON_APPDATA, 'RightScale', 'right_agent'))\n end",
"def source_dir\n @config.source_dir\n end",
"def facebook_app_config_path\n case current_subdomain\n when 'vault'\n FacebookBackup::Vault.config_path\n else\n FacebookBackup.config_path\n end\n end",
"def root\n settings[:basedir]\n end",
"def directory\n File.dirname(@path) + '/'\n end",
"def config_path\n ENV.fetch(\"SIMPLE_SCHEDULER_CONFIG\", \"config/simple_scheduler.yml\")\n end",
"def paths\n Array(config.path).map(&:to_s)\n end",
"def get_config_file_for(name)\n if File.exists?(\"#{user_dir}/config/#{name}\")\n \"#{user_dir}/config/#{name}\"\n else\n \"#{root_dir}/config/#{name}\"\n end\n end",
"def config_path(arg = nil)\n set_or_return(:config_path,\n arg,\n kind_of: String,\n default: '/etc/hipache.json')\n end",
"def get_uplift_config_file \n config_dir_path = get_uplift_config_folder\n file_name = \".vagrant-network.yaml\"\n\n return File.join(config_dir_path, file_name) \n end",
"def configru_path\n @configru_path ||= if ::File.directory?(new_resource.path)\n ::File.join(new_resource.path, 'config.ru')\n else\n new_resource.path\n end\n end",
"def config_file\n CONFIG_FILE\n end",
"def resources_folder_url\n return @resources_folder_url\n end",
"def chef_config_path\n Berkshelf.root.join(\"spec/config/knife.rb\").to_s\n end",
"def config_path=(val)\n\t RequestStore.config_path = val\n\tend",
"def config_file_path(config_file_path=nil)\n @config_file_path ||= config_file_path || File.join(config_path, config_filename)\n end",
"def root_folder\n scheduler_service.GetFolder(\"\\\\\")\n end",
"def root(config = Pantry.config)\n Pathname.new(config.root_dir)\n end",
"def paths\n configuration.paths\n end",
"def dir_path\n File.expand_path(File.dirname(@path))\n end",
"def log_path\n case Merb::Config[:log_file]\n when String then File.dirname(Merb::Config[:log_file])\n else Merb.root_path(\"log\")\n end\n end",
"def log_path\n case Merb::Config[:log_file]\n when String then File.dirname(Merb::Config[:log_file])\n else Merb.root_path(\"log\")\n end\n end",
"def config_file_name\n @config_file_name || Pdm.config_file\n end",
"def cfg_dir\n warn \"cfg_dir is deprecated; please use right_agent_cfg_dir\"\n right_agent_cfg_dir\n end",
"def cfg_dir\n warn \"cfg_dir is deprecated; please use right_agent_cfg_dir\"\n right_agent_cfg_dir\n end",
"def cfg_dir\n warn \"cfg_dir is deprecated; please use right_agent_cfg_dir\"\n right_agent_cfg_dir\n end",
"def template_dir\n File.dirname(__FILE__) + '/../cfg'\n end",
"def yml_directory\n @data_magic_yml_directory ||= 'config'\n end",
"def fetch_path(start_path)\n ['', 'config'].each do |directory|\n ['', '.'].each do |prefix|\n path = File.join(start_path, directory, \"#{prefix}#{@file_name}\")\n return path if File.exist?(path)\n end\n end\n nil\n end",
"def config_file\n File.join(root, 'config.yml')\n end",
"def base_path\n Dir.pwd + \"/\"\n end",
"def directory\n File.dirname @path\n end",
"def paths\n self.config[:paths]\n end"
] |
[
"0.8326465",
"0.80605865",
"0.7996527",
"0.79837835",
"0.7954376",
"0.7934802",
"0.7907856",
"0.7813633",
"0.7610684",
"0.76068544",
"0.7586518",
"0.74842626",
"0.7460654",
"0.7445065",
"0.72790986",
"0.72439176",
"0.72393364",
"0.72353363",
"0.7234776",
"0.72232354",
"0.7202607",
"0.718574",
"0.7166647",
"0.71578884",
"0.7139757",
"0.7139757",
"0.70835507",
"0.70427096",
"0.7039807",
"0.698128",
"0.69064164",
"0.6861919",
"0.68597364",
"0.683631",
"0.6823108",
"0.68183166",
"0.6817577",
"0.6815106",
"0.67996955",
"0.679785",
"0.6792154",
"0.675946",
"0.6725848",
"0.67140824",
"0.67031246",
"0.6685343",
"0.6675027",
"0.66657937",
"0.6634448",
"0.6589335",
"0.65794814",
"0.65652746",
"0.6547559",
"0.6546176",
"0.6514673",
"0.651313",
"0.6507733",
"0.6489191",
"0.6475024",
"0.64724165",
"0.6467143",
"0.6465728",
"0.6464908",
"0.64589745",
"0.6447906",
"0.64176404",
"0.641656",
"0.63911283",
"0.6371868",
"0.63715357",
"0.63515365",
"0.63500464",
"0.63425547",
"0.63254935",
"0.63184386",
"0.6284745",
"0.62780243",
"0.6262358",
"0.6262313",
"0.6252233",
"0.62427133",
"0.6241521",
"0.62366825",
"0.6234693",
"0.62329817",
"0.6228837",
"0.6225927",
"0.6225593",
"0.6225593",
"0.62207216",
"0.6211144",
"0.6211144",
"0.6211144",
"0.6206455",
"0.62060374",
"0.61957526",
"0.6193649",
"0.61780894",
"0.61751866",
"0.6164123"
] |
0.68506384
|
33
|
Get the current application environment as defined by RAILS_ENV or RACK_ENV.
|
def env
return Rails.env if defined?(Rails) && defined?(Rails.env)
# https://github.com/rails/rails/blob/1ccc407e9dc95bda4d404c192bbb9ce2b8bb7424/railties/lib/rails.rb#L67
@env ||= ActiveSupport::StringInquirer.new(
ENV['RAILS_ENV'].presence || ENV['RACK_ENV'].presence || 'development'
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def current_environment\n ENV['RUBY_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'\n end",
"def environment\n if defined?(Rails) && Rails.respond_to?(:env)\n Rails.env.to_s\n else\n ENV['RAILS_ENV'] || ENV['RACK_ENV'] || ENV['ENV'] || 'development'\n end\n end",
"def env\n Thread.current[ENVIRONMENT] or raise(\"no env in scope\")\n end",
"def env\n @_env ||= ActiveSupport::EnvironmentInquirer.new(ENV[\"RAILS_ENV\"].presence || ENV[\"RACK_ENV\"].presence || \"development\")\n end",
"def environment\n @environment ||= ActiveSupport::StringInquirer.new(app.environment.to_s)\n end",
"def get_environment ()\n service_data = query_for_services()\n return service_data[\"environment\"]\n end",
"def env\n unless defined?(@environment)\n self.env = DEFAULT_ENVIRONMENT\n end\n\n @environment\n end",
"def env\n ENV[\"RACK_ENV\"] || ENV[\"RAILS_ENV\"] || \"development\"\n end",
"def env\n defined?(Rails) ? Rails.env.to_sym : @env\n end",
"def env\n @env ||= ENV['RACK_ENV'].present? ? ENV['RACK_ENV'].to_sym : :development\n end",
"def environment\n @environment || DEFAULT_ENVIRONMENT\n end",
"def current_env\n Rails.env\n end",
"def current_environment\n read_environment_from_cache\n end",
"def current_env\n @current_env\n end",
"def rails_env\n return ::Rails.env.to_s if defined?(::Rails.env)\n return RAILS_ENV.to_s if defined?(RAILS_ENV)\n nil\n end",
"def env\n config.env\n end",
"def env\n config.env\n end",
"def environment\n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env\n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\"\n end\nend",
"def environment\n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env\n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\"\n end\nend",
"def env\n return :development unless @env\n @env\n end",
"def environment(environment=nil)\n @environment ||= environment_from_app(environment) || 'development'\n end",
"def environment\n ENV['RACK_ENV'] || 'development'\n end",
"def env\n legacy_env || app_env\n end",
"def environment \n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env \n elsif(ENV['RAILS_ENV'])\n ENV['RAILS_ENV']\n else\n \"production\" \n end\nend",
"def app_env\n @_app_env ||= PlatformAPI.connect_oauth(heroku_api_key).config_var.info_for_app(app_name)\n end",
"def env\n if defined? @@env and @@env\n @@env\n elsif ENV['SASYNC_ENV']\n ENV['SASYNC_ENV']\n else\n if defined? Rails\n Rails.env\n else\n ENV['SASYNC_ENV'] || 'production'\n end\n end\n end",
"def env\n @env ||= ActiveSupport::StringInquirer.new(ENV[\"CASSANDRA_ENV\"] || ENV[\"RACK_ENV\"] || \"development\")\n end",
"def env\n if defined? @@env and @@env\n @@env\n elsif ENV['SASYNC_ENV']\n ENV['SASYNC_ENV']\n else\n if defined? Rails\n Rails.env\n else\n ENV['SASYNC_ENV'] || 'production'\n end\n end\n end",
"def env\n env = job[:env]\n env = env - (config[:env].is_a?(Hash) && config[:env][:global] || []) if env\n env = env - config[:global_env] if config[:global_env].is_a?(Array)\n env\n end",
"def environment\n ENV['CLOUDTASKER_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'\n end",
"def get_environment\n if @environment.empty?\n \":\"\n else\n env = @environment.map { |key, value| %(#{key}=\"#{value}\") }\n \"export #{env.join(' ')}\"\n end\n end",
"def env\n # Look for a GAMEWORK_ENV constant\n _env = Object.const_defined?('GAMEWORK_ENV') && GAMEWORK_ENV\n # otherwise default to 'development'\n @env ||= ActiveSupport::StringInquirer.new(_env || 'development')\n end",
"def app_env\n return @app_env if @app_env\n\n global_app_env = YAML::load_file(\"#{ENV['WARDEN_CONFIG_DIR']}/app_env.yaml\")\n project_app_env_file_path = \"#{Warden::project_path}/etc/app_env.yaml\"\n\n if File.exists?(project_app_env_file_path)\n project_app_env = YAML::load_file(\"#{Warden::project_path}/etc/app_env.yaml\")\n global_app_env.deep_merge!(project_app_env)\n end\n\n @app_env = global_app_env['app_environment']\n end",
"def environment\n verify_environment\n ENV['ENV']\nend",
"def environment\n\n return @environment || :development\n\n end",
"def env\n @env\n end",
"def environment\n self.config[:environment] || :development\n end",
"def environ\n case environment\n when 'production' then :prd\n when 'staging' then :stg\n when 'test' then :tst\n when 'development' then :dev\n end\n end",
"def env\n @env || {}\n end",
"def env\n site.env\n end",
"def autodetect_environment\n rails_env = if defined?(::Rails) && ::Rails.respond_to?(:env)\n ::Rails.env.to_s\n elsif defined?(::RAILS_ENV)\n ::RAILS_ENV.to_s\n end\n \n LIVE_RAILS_ENVIRONMENTS.include?(rails_env) ? 'live' : 'test'\n end",
"def get_root_environment\n\n fetch_environment.get_root_environment\n end",
"def environment\n Sinatra.application.options.env.to_sym\nend",
"def env\n @_env\n end",
"def environment\n environment = 'development'\n\n if ARGV.last.match(/(development|production)/)\n environment = ARGV.last\n end\n \n return environment\nend",
"def get_env(name)\n ENV[name]\n end",
"def environment\n @environment ||= ENV['HUBBLE_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'\n end",
"def get_environment\n\n fetch_environment || get_expression_pool.fetch_engine_environment\n end",
"def environment(name = nil)\n name = default_environment_name unless name\n known_environments.find { |env| env.match_name?(name) }\n end",
"def env_str\n @env_str ||= begin\n env = Rails.env\n env.include?('production') ? '' : env\n end\n end",
"def env_str\n @env_str ||= begin\n env = Rails.env\n env.include?('production') ? '' : env\n end\n end",
"def environment\n self.class.environment\n end",
"def environment\n @environment\n end",
"def environment\n @environment ||= nil\n end",
"def target_environment\n return unless application = applications.first\n application.split(\"-\").first\n end",
"def detect_env\n @environments.find{|env_name,proc|\n instance_eval(&proc)\n } \n end",
"def env\n return {} unless instance.respond_to? :env\n\n instance.env\n end",
"def environment\n return @vars unless @vars.nil?\n\n # If not set, Try to find them...\n glob_path = File.join(@deployment_home, @settings.env_file_glob_path)\n regexp_find = glob_path.gsub(/\\*/, '(.*)')\n Dir[glob_path].each do | file_name |\n # Get the environment name from the file part of the glob path:\n # e.g. given ./environments/ci_mgt/kb8or.yaml\n # get ci_mgt from ./environments/*/kb8or.yaml\n /#{regexp_find}/.match(file_name)\n env_name = $1\n if env_name == @env_name\n debug \"env=#{env_name}\"\n # Ensure we set the defaults as vars BEFORE we add environment specifics:\n @vars = @settings.defaults\n env_vars = Context.resolve_env_file(file_name)\n @vars = @vars.merge(env_vars)\n @vars = @vars.merge(@overridden_vars)\n @vars['env'] = env_name\n @environment_file = file_name\n break\n end\n end\n # Now finaly, update the settings now we know the environment!\n unless @vars\n @vars = {}\n end\n @settings = @settings.new(@vars)\n update_k8context\n debug \"vars=#{vars}\"\n @vars\n end",
"def get_env(name)\n ENV[name] || ENV[name.downcase] || ENV[name.upcase] || nil\n end",
"def railsenv\n config['environment_variables']['RAILS_ENV'] || 'production'\nend",
"def environment\n @_environment\n end",
"def app_state_environment\n app_state[:environment] ||= Mash.new\n end",
"def get_environment\n VanagonLogger.info <<-WARNING.undent\n #get_environment is deprecated; environment variables have been moved\n into the Makefile, and should not be used within a Makefile's recipe.\n The #get_environment method will be removed by Vanagon 1.0.0.\n WARNING\n\n if environment.empty?\n \": no environment variables defined\"\n else\n environment_variables\n end\n end",
"def get_env(name)\n @ant.instance_eval(\"@env_%s\" % name)\n end",
"def environment\n options['environment'] || :development\n end",
"def pseudo_env\n ENV[\"PSEUDO_PRODUCTION_ENV\"]&.inquiry || Rails.env\n end",
"def getEnvVar\n if ENV['ENV'].nil?\n UI.user_error!(\"No 'ENV' environment variable set. Set it using `awsenv` config file. Must contain 'dev', 'qa' or 'prod' in value.\")\n end\n\n env_raw = /(dev|qa|prod)/.match(ENV.fetch('ENV', nil))[1]\n UI.important(\"ENVIRONMENT: #{env_raw}\")\n\n if env_raw.nil? || env_raw.length == 0\n UI.user_error!(\"Your 'ENV' environment variable is set but doesn't contain 'dev', 'qa' or 'prod' as value.\")\n end\n\n return env_raw\nend",
"def env\n return super unless anycabled?\n\n request.env\n end",
"def app_environment\n os = host_os\n if os.nil?\n Applitools::EyesLogger.info 'No OS set, checking for mobile OS...'\n if driver.mobile_device?\n platform_name = nil\n Applitools::EyesLogger.info 'Mobile device detected! Checking device type..'\n if driver.android?\n Applitools::EyesLogger.info 'Android detected.'\n platform_name = ANDROID\n elsif driver.ios?\n Applitools::EyesLogger.info 'iOS detected.'\n platform_name = IOS\n else\n Applitools::EyesLogger.warn 'Unknown device type.'\n end\n # We only set the OS if we identified the device type.\n unless platform_name.nil?\n platform_version = driver.platform_version\n if platform_version.nil?\n os = platform_name\n else\n # Notice that Ruby's +split+ function's +limit+ is the number of elements, whereas in Python it is the\n # maximum splits performed (which is why they are set differently).\n major_version = platform_version.split('.', 2)[0]\n os = \"#{platform_name} #{major_version}\"\n end\n Applitools::EyesLogger.info \"Setting OS: #{os}\"\n end\n else\n Applitools::EyesLogger.info 'No mobile OS detected.'\n end\n end\n\n # Create and return the environment object.\n Applitools::Base::Environment.new(os, host_app, viewport_size, inferred_environment)\n end",
"def default_environment_name\n return nil unless config?\n config.default_environment\n end",
"def global_env\n @global_env ||= global? ? self : @parent.global_env\n end",
"def env_suffix\n if ENV['STACK_ENV']\n ENV['STACK_ENV']\n elsif %w(development test).include?(rails_env)\n `whoami`.strip\n else\n rails_env\n end\n end",
"def env\n @request.env\n end",
"def env_vars\n @env ||= calculate_env_vars\n end",
"def verify_environment\n # Use Rack environment if available\n if ENV['RACK_ENV'] && !ENV['ENV']\n ENV['ENV'] = ENV['RACK_ENV']\n # Use Rails environment if available\n elsif ENV['RAILS_ENV'] && !ENV['ENV']\n ENV['ENV'] = ENV['RAILS_ENV']\n end\n\n # Otherwise, use the more general environment setting\n unless ENV['ENV']\n warn 'ENV - environment variable must be defined, defaulting ' +\n 'to development'\n ENV['ENV'] = 'development'\n end\nend",
"def app_env?(env_name)\n APP_ENV.casecmp(env_name.to_s).zero?\nend",
"def environment(env = File.basename($0, '.*'))\n env = ENV[env] || ENV[env.upcase] or return\n require 'shellwords'\n parse(*Shellwords.shellwords(env))\n end",
"def default_environment\n return nil unless default_environment_name\n environment(default_environment_name)\n end",
"def environment_info\n info = \"[Ruby: #{RUBY_VERSION}]\"\n info << \" [#{configuration.framework}]\" if configuration.framework\n info << \" [Env: #{configuration.environment_name}]\" if configuration.environment_name\n end",
"def environment_for(bundle_name=nil)\n\n # If no bundle name is provided, then just return the base environment.\n return base_environment if bundle_name.nil?\n \n # Get the bundle location info. This will return nil if the bundle\n # is not found anywhere. In that case, return nil to indicate bundle\n # does not exist.\n bundle_location = bundle_location_for(bundle_name)\n return nil if bundle_location.nil?\n\n # A bundle was found, so collect the base environment and any bundle-\n # specific configs provided by the developer.\n base_env = base_environment\n config_env = bundle_environment_for(bundle_name)\n\n # Now we have the relevant pieces. Join them together. Start with the\n # base environment and fill in some useful defaults...\n ret = base_env.dup.merge(config_env).merge(bundle_location)\n ret[:required] = [:sproutcore] if ret[:required].nil?\n\n # Add local library so we get proper deployment paths, etc.\n ret[:library] = self\n\n # Done! return...\n return ret\n end",
"def app_environments\n @app_environments ||= apps.map { |app| app.app_environments }.flatten\n end",
"def env\n %w[INSTALLATION=1] + extra_env\n end",
"def environment_name\n return @environment_name if @environment_name.is_a? String\n if ENV['EY_ENVIRONMENT_NAME']\n @environment_name = ENV['EY_ENVIRONMENT_NAME']\n elsif engine_yard_cloud_api.possible_to_detect_environment_from_git_config?\n @environment_name = engine_yard_cloud_api.environment_name\n end\n raise RuntimeError, \"[engineyard-metadata gem] You need to run this from the application repo, set EY.metadata.environment_name= or set ENV['EY_ENVIRONMENT_NAME']\" unless @environment_name.to_s.strip.length > 0\n @environment_name\n end",
"def environment\n @environment || SemanticLogger.environment\n end",
"def shell_env\n @shell.env\n end",
"def base_environment\n environment[:all] || (next_library.nil? ? {} : next_library.base_environment)\n end",
"def environment\n @options.fetch(:environment, 'production')\n end",
"def get_env(format, app, node = self.node)\n return '' unless node.attribute?(app)\n\n if node[app]['env'].nil?\n Chef::Log.info(\"Attribute 'env' for application '#{app}' is not defined!\")\n return ''\n end\n\n appenv = streamline_appenv(node[app]['env'])\n generate_config_part(format, 'settings', appenv)\n end",
"def oauth_request_env\n if respond_to?(:env)\n env\n elsif respond_to?(:request) and request.respond_to?(:env)\n request.env\n else\n raise \"Couldn't find 'env' ... please override #oauth_request_env\"\n end\n end",
"def type_env\n @current_env\n end",
"def rails_environment?(env)\n rails_environment.to_s == env.to_s\n end",
"def oauth_request_env\n if respond_to?(:env)\n env\n elsif respond_to?(:request) and request.respond_to?(:env)\n request.env\n else\n raise \"Couldn't find 'env' ... please override #oauth_request_env\"\n end\n end",
"def environment(override = nil)\n override || @environment || autodetect_environment\n end",
"def env(key)\n if key.nil?\n nil\n elsif override_env.present?\n override_env[key]\n else\n ENV[key]\n end\n end",
"def env?(env)\n Merb.env == env.to_s\n end",
"def env_config\n @env_config ||= {}\n end",
"def env\n @_request.env\n end",
"def env\n image = options[:image] || app\n config = api.get_config_vars(app).body\n\n config.keys.sort.each do |key|\n puts \"#{key}=#{config[key]}\"\n end\n end",
"def env_hash\n read_env || reset_env unless defined?(DataCache.env_hash)\n DataCache.env_hash\n end",
"def environment\n if new_resource.parent_python\n environment = new_resource.parent_python.python_environment\n if new_resource.environment\n environment = environment.merge(new_resource.environment)\n end\n environment\n else\n new_resource.environment\n end\n end"
] |
[
"0.8449787",
"0.8447072",
"0.8290873",
"0.81389576",
"0.8026043",
"0.79950917",
"0.7994942",
"0.7969055",
"0.7874867",
"0.78728384",
"0.78645766",
"0.7833095",
"0.7754501",
"0.7724591",
"0.7676637",
"0.76710474",
"0.76710474",
"0.7664936",
"0.7664936",
"0.7649764",
"0.7633289",
"0.762199",
"0.76215816",
"0.7599564",
"0.7492227",
"0.7469761",
"0.7411504",
"0.74053675",
"0.7390593",
"0.7374744",
"0.73543036",
"0.731192",
"0.73007727",
"0.7242427",
"0.72421634",
"0.7214792",
"0.7203224",
"0.71976995",
"0.71572375",
"0.7149117",
"0.7123701",
"0.7121708",
"0.71139646",
"0.71078736",
"0.7078379",
"0.70673454",
"0.7062932",
"0.70439494",
"0.70386714",
"0.7030654",
"0.7030654",
"0.70200366",
"0.7007914",
"0.6995445",
"0.6988972",
"0.6984472",
"0.69212574",
"0.68723273",
"0.68588257",
"0.6845503",
"0.6832097",
"0.6825047",
"0.6822505",
"0.68001294",
"0.6782184",
"0.6768827",
"0.6759549",
"0.6732201",
"0.67291754",
"0.67206085",
"0.67130446",
"0.6704399",
"0.6691546",
"0.6649801",
"0.66466916",
"0.664418",
"0.6641681",
"0.6637806",
"0.65915006",
"0.65882576",
"0.6583048",
"0.6578141",
"0.65770733",
"0.6565201",
"0.6552843",
"0.65501213",
"0.6534419",
"0.65331805",
"0.6517736",
"0.64994717",
"0.64968175",
"0.64945525",
"0.6469769",
"0.6468839",
"0.64662033",
"0.6455038",
"0.6448121",
"0.6446687",
"0.6445468",
"0.64437455"
] |
0.8118427
|
4
|
Get the path to the default config files that will be loaded by the app
|
def config_files(config_root = self.config_root, env = self.env)
[
config_root / 'settings.yml',
config_root / 'settings' / 'default.yml',
config_root / 'settings' / "#{env}.yml",
*@custom_configs
].map(&:to_s).freeze
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def default_path\n Pathname.pwd.join(*base_config_path, self.class.config_folder)\n end",
"def app_config_path\n Pathname.new('.').join('config')\n end",
"def default_application_paths\n paths = []\n\n # Followed by the standard includes.\n paths.concat %w(\n config\n lib\n lib/core_ext\n app\n app/models\n app/controllers\n app/converters\n app/helpers\n ).map { |dir| \"#{root_path}/#{dir}\" }.select { |dir| File.directory?(dir) }\n end",
"def base_config_path\n BASE_CONFIG_PATH\n end",
"def default_paths\n [ '.' ]\n end",
"def default_global_config_file\n File.join(File.expand_path(ENV[\"HOME\"]), \".kitchen\", \"config.yml\")\n end",
"def resource_default_config_path\n type_string = instance_variable_defined?(:@new_resource) ? new_resource.declared_type.to_s : resource_name.to_s\n config_path = Array(type_string.gsub(/(grafana_)(config_)?/, '').split('_').join('.'))\n\n Chef::Log.debug(\"resource_default_config_path: Generated config path #{config_path}\")\n raise if nil_or_empty?(config_path)\n\n config_path\n end",
"def files\n @config.keys - [:defaults]\n end",
"def config_path\n @config_path ||= local_config_path\n end",
"def config_path\n ::Rails.root.to_s + \"/config/#{self.name.split('::').last.underscore.pluralize}.yml\"\n end",
"def config_files\n @config_files\n end",
"def config_file\n File.join AppRoot, ConfigFile\n end",
"def default_load_paths\n application_load_paths.collect { |lp| File.join(lp, \"widgets\") }\n end",
"def config_files\n @config_files ||= []\n end",
"def config_files\n @config_files ||= []\n end",
"def default_app_variables_path\n Hanami.root.join(\"apps\", Concierge.app.to_s, \"config\", \"environment_variables.yml\").to_s\n end",
"def config_path\n @config_path ||= 'config/spinach.yml'\n end",
"def getConfigPath\n if @conf[:config_name].index('/')\n return @conf[:config_name] if File.file?(@conf[:config_name])\n else \n @conf[:config_dirs].each {|i|\n r = Pathname.new(i) + @conf[:config_name]\n return r if File.file?(r)\n }\n end\n\n CliUtils.warnx \"no config file '#{@conf[:config_name]}' found\" if @conf[:verbose] >= 2\n return nil\n end",
"def config_file\n File.join(@path, %w[ application config application.php ])\n end",
"def configuration_file_path; end",
"def default_install_path\n begin\n ::Rails.root.join 'config', 'initializers', ''\n rescue NameError\n File.join Dir.pwd, 'config', 'initializers', ''\n end\n end",
"def config_path\n Gym.cache[:config_path] ||= \"#{Tempfile.new('gym_config').path}.plist\"\n return Gym.cache[:config_path]\n end",
"def default_files\n %w(~/.ssh/config /etc/ssh_config /etc/ssh/ssh_config)\n end",
"def config_files(override)\n # Get configuration from <source>/_config.yml or <source>/<config_file>\n config_files = override.delete('config')\n if config_files.to_s.empty?\n config_files = File.join(source(override), \"_config.yml\")\n @default_config_file = true\n end\n config_files = [config_files] unless config_files.is_a? Array\n config_files\n end",
"def config_path\n Gym.cache[:config_path] ||= \"/tmp/gym_config_#{Time.now.to_i}.plist\"\n return Gym.cache[:config_path]\n end",
"def active_configuration_path\n configuration_paths.find do |path|\n File.file? path\n end || theme_configuration_path\n end",
"def find_config_path\n path = Pathname(Pathname.pwd).ascend{|d| h=d+config_filename; break h if h.file?}\n end",
"def find_config_file\n\n root_directory = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))\n app_config = File.join(root_directory, CONFIG_FILE_NAME)\n global_config = File.join('/etc', CONFIG_FILE_NAME)\n\n [app_config, global_config].each do |config_file|\n return config_file if File.exists?(config_file)\n end\n\n nil\n\n end",
"def config_files(override)\n # Adjust verbosity quickly\n Jekyll.logger.adjust_verbosity(\n :quiet => quiet?(override),\n :verbose => verbose?(override)\n )\n\n # Get configuration from <source>/_config.yml or <source>/<config_file>\n config_files = override[\"config\"]\n if config_files.to_s.empty?\n default = %w(yml yaml).find(-> { \"yml\" }) do |ext|\n File.exist?(Jekyll.sanitized_path(source(override), \"_config.#{ext}\"))\n end\n config_files = Jekyll.sanitized_path(source(override), \"_config.#{default}\")\n @default_config_file = true\n end\n Array(config_files)\n end",
"def config_files(override)\n # Adjust verbosity quickly\n Jekyll.logger.adjust_verbosity(\n :quiet => quiet?(override),\n :verbose => verbose?(override)\n )\n\n # Get configuration from <source>/_config.yml or <source>/<config_file>\n config_files = override[\"config\"]\n if config_files.to_s.empty?\n default = %w(yml yaml toml).find(-> { \"yml\" }) do |ext|\n File.exist?(Jekyll.sanitized_path(source(override), \"_config.#{ext}\"))\n end\n config_files = Jekyll.sanitized_path(source(override), \"_config.#{default}\")\n @default_config_file = true\n end\n Array(config_files)\n end",
"def defaults\n @defaults ||= Dir.glob(File.expand_path(\"defaults/**/*.yml\", __dir__))\n end",
"def default_excluded_files\n ['config/environment.rb', 'lib/main.rb', 'config/boot.rb', 'bin/IronNails.Library.dll' ].collect{ |dir| \"#{root_path}/#{dir}\" }\n end",
"def config_path\n etc+\"php/\"\n end",
"def conf_folder\n conf['conf_folder'] || '.'\n end",
"def global_config_path\n linux_cfg = '/etc/openshift/' + conf_name\n File.exists?(linux_cfg) ? linux_cfg : File.join(File.expand_path(File.dirname(__FILE__) + \"/../../conf\"), conf_name)\n end",
"def default_concierge_variables_path\n Hanami.root.join(\"config\", \"environment_variables.yml\").to_s\n end",
"def config_file\n @config_file ||= File.join( home_dir, TyrantManager.config_file_basename )\n end",
"def full_configuration_path\n @full_config_path ||= File.join(self.class.config_base_path, self.class.config_path)\n end",
"def config_files(override); end",
"def get_defaults\n unless @defaults\n conf_str = JustInCase::Templates::CONFIG_FILE\n conf_hash = JSON.parse(conf_str)\n @defaults = conf_hash.symbolize_keys!\n end\n return @defaults\n end",
"def config_root\n @config_root ||= root / 'config'\n end",
"def default_config_file\n if File.exist?(kitchen_yml) && File.exist?(dot_kitchen_yml)\n raise UserError, \"Both #{kitchen_yml} and #{dot_kitchen_yml} found. Please use the un-dotted variant: #{kitchen_yml}.\"\n end\n\n File.exist?(kitchen_yml) ? kitchen_yml : dot_kitchen_yml\n end",
"def empty_config_file_path\n ::File.expand_path '../../../support/empty_resolv.conf', __FILE__\n end",
"def cfg_dir\n File.join(@full_path, CONFIG_DIR)\n end",
"def load_config_files\n [\n Pathname.new(ENV['GUIGNOL_YML'] || '/var/nonexistent'),\n Pathname.new('guignol.yml'),\n Pathname.new('config/guignol.yml'),\n Pathname.new(ENV['HOME']).join('.guignol.yml')\n ].each do |pathname|\n next unless pathname.exist?\n return YAML.load(pathname.read)\n end\n return {}\n end",
"def config_path\n test? ? \"config-test.yml\" : \"config.yml\"\n end",
"def get_config_path()\n return ENV['DOCS_CONFIG_PATH'] || CONFIG_PATH_DEFAULT\n end",
"def config_dir\n runtime_config.generated_files_dir\n end",
"def paths\n self.config[:paths]\n end",
"def paths\n Array(config.path).map(&:to_s)\n end",
"def core_cfg_path\n File.expand_path(ENV[\"DBS_CFGDIR\"].presence || \"~/.db_sucker\")\n end",
"def config_file\n CONFIG_FILE\n end",
"def default_files; end",
"def paths\n configuration.paths\n end",
"def dir_list\n path_from_env || default_path\n end",
"def config_path\n if result = chef_api_config_path\n Pathname(result).expand_path\n else\n Pathname(\"\")\n end\n end",
"def default_database_file_path\n\t\t\t@default_database_file_path ||= 'config/event_storage.yml'\n\t\tend",
"def get_config_directory()\n\t\t\tconfig_directory= File.join(@base_directory, \"config\")\n\t\t\treturn config_directory\n\t\tend",
"def default_config_file\n './deadlyzer.yml'\n end",
"def yml_directory\n @data_magic_yml_directory ||= 'config'\n end",
"def app_config_file(filename)\n File.read(File.dirname(__FILE__)+\"/../../app/config/\" + filename).split(\"\\n\")\nend",
"def read_config_files\n load_config_files\n end",
"def default_mysql_config_path\n mysql_config_paths.compact.first\nend",
"def default_mysql_config_path\n mysql_config_paths.compact.first\nend",
"def default_path\n Gem.default_path + [@home]\n end",
"def config_dev_path\n File.join test_app_path, 'config', 'deploy', 'dev.rb'\n end",
"def default_config\n self.class.default_config\n end",
"def get_config_file_for(name)\n if File.exists?(\"#{user_dir}/config/#{name}\")\n \"#{user_dir}/config/#{name}\"\n else\n \"#{root_dir}/config/#{name}\"\n end\n end",
"def default_sources\n self.class.default_sources.map{ |src| File.join(root, src) }\n end",
"def conf_root(root = nil)\n Pathname(File.expand_path(root || Environment::CONFROOT || ENV['MIKUTTER_CONFROOT'] || '~/.mikutter'))\n rescue\n Pathname(File.expand_path(ENV['MIKUTTER_CONFROOT'] || '~/.mikutter'))\n end",
"def default_modules_paths\n dirs = []\n do_initialize if Puppet[:codedir].nil?\n # add the puppet-repl directory so we can load any defined functions\n dirs << File.join(Puppet[:environmentpath],default_puppet_env_name,'modules') unless Puppet[:environmentpath].empty?\n dirs << Puppet.settings[:basemodulepath].split(':')\n dirs.flatten\n end",
"def default_options\n if Object.const_defined?('Rails')\n {\n :file => Rails.root.join('config', 'config.yml'),\n :reload => Rails.env.development?,\n :env => Rails.env\n }\n else\n {\n :file => File.expand_path(\"config.yml\"),\n :reload => false,\n :env => \"development\"\n }\n end\n end",
"def default_assembly_paths\n paths = []\n paths.concat %w( bin ).map{ |dir| \"#{root_path}/#{dir}\"}.select{ |dir| File.directory?(dir) }\n end",
"def default_routes_path\n basedir = @config.get(\"GEAR_BASE_DIR\")\n token = \"#{@container_uuid}_#{@namespace}_#{@container_name}\"\n File.join(basedir, '.httpd.d', token, \"routes.json\")\n end",
"def default_routes_path\n basedir = @config.get(\"GEAR_BASE_DIR\")\n token = \"#{@container_uuid}_#{@namespace}_#{@container_name}\"\n File.join(basedir, '.httpd.d', token, \"routes.json\")\n end",
"def config_file\n File.join(root, 'config.yml')\n end",
"def default_log_path\n if @config.log_root\n File.join(@config.log_root, default_log_file_name)\n else\n nil\n end\n end",
"def load!\n add!(File.join(DEFAULT_CONFIGURATION_DIRECTORY, DEFAULT_CONFIGURATION_FILE_NAME))\n end",
"def config_dir\n Wonkavision::Sample::CONFIG_DIR\n end",
"def configuration_file\n @config_file_name ||= MyRhouse.confpath( \"#{config_file_name}.yml\" )\n end",
"def load_configuration!\n unless @configured\n load Rails.root.join( *Parametrization::Config::DEFAULT_CONFIG_PATH )\n end\n end",
"def config_file\n \"#{confdir}/config.yml\"\n end",
"def config_filepath(name)\n File.expand_path(\"../fixtures/configs/#{name}.yaml\", __dir__)\nend",
"def setup_config_defaults\n Chef::Config[:knife][:dockerfiles_path] ||= File.join(Chef::Config[:chef_repo_path], \"dockerfiles\")\n config[:dockerfiles_path] = Chef::Config[:knife][:dockerfiles_path]\n end",
"def default_search_directory\n Figgy.config[\"default_search_directory\"]\n end",
"def source_paths\n Array(super) +\n [File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')] +\n [File.join(File.expand_path(File.dirname(__FILE__)),'rails_root', 'config')]\nend",
"def path\n @path || File.expand_path(ENV['NEXUS_CONFIG'] || DEFAULT_FILE)\n end",
"def _FILESDIR; Config._FILES; end",
"def default_directories\n [Texas.contents_subdir_name, \"lib/\", Texas.texas_dir]\n end",
"def package_config\n File.join @proj_path_base, 'packages.config'\n end",
"def paths_from_project_root\n @paths_from_project_root ||=\n [Config.project_root]\n end",
"def config_dir\n dir = options[:config] ? File.dirname(options[:config]) : './config'\n File.expand_path(dir)\n end",
"def default_load_paths_with_milkshake\n Milkshake.environment.gemspecs.each do |gemspec|\n app_path = File.join(gemspec.full_gem_path, 'app', 'controllers', 'application_controller.rb')\n if File.file?(app_path)\n return default_load_paths_without_milkshake\n end\n end\n \n path = File.expand_path(File.join(File.dirname(__FILE__), *%w( .. rails_fallbacks )))\n default_load_paths_without_milkshake.push(path)\n end",
"def config_filename\n return @config_filename if @config_filename\n\n @config_filename = File.join(config_directory, \"config\")\n end",
"def default_modules_paths\n dirs = []\n # add the puppet-debugger directory so we can load any defined functions\n dirs << File.join(Puppet[:environmentpath], default_puppet_env_name, 'modules') unless Puppet[:environmentpath].empty?\n dirs << Puppet.settings[:basemodulepath].split(File::PATH_SEPARATOR)\n dirs.flatten\n end",
"def paths\n @paths ||= begin\n paths = super\n paths.add 'config/routes.rb', with: 'routes.rb'\n paths.add 'config/locales', with: 'locales', glob: \"**/*.{rb,yml}\"\n paths\n end\n end",
"def config_dir\n \"#{gem_dir}/config\"\n end",
"def config_dir\n \"#{gem_dir}/config\"\n end",
"def config_files\n files = Dir[File.join(path, \"_config.yml\")]\n return files\n end",
"def set_config_paths\n @config_file_path = \"config/dissect/\"\n end"
] |
[
"0.80343175",
"0.77136433",
"0.7629951",
"0.75546503",
"0.7554519",
"0.7472683",
"0.7356335",
"0.72973317",
"0.7244747",
"0.7216675",
"0.7198952",
"0.7179988",
"0.7170117",
"0.71229273",
"0.71229273",
"0.70983595",
"0.70267105",
"0.7008329",
"0.6996136",
"0.69776815",
"0.6966183",
"0.6944459",
"0.69172287",
"0.68988115",
"0.68721867",
"0.6870344",
"0.6869419",
"0.6865391",
"0.68615186",
"0.6849525",
"0.6848998",
"0.68413675",
"0.6826677",
"0.68143696",
"0.67719793",
"0.6770257",
"0.6769775",
"0.6764219",
"0.67473346",
"0.6744394",
"0.6712139",
"0.6704927",
"0.66957986",
"0.6682035",
"0.6680597",
"0.6679254",
"0.66766477",
"0.6658601",
"0.66556054",
"0.6648664",
"0.6641545",
"0.6637574",
"0.6636637",
"0.66365856",
"0.66254425",
"0.66119605",
"0.6604632",
"0.6599008",
"0.65943325",
"0.6591585",
"0.6591373",
"0.6587999",
"0.65706044",
"0.65706044",
"0.6569156",
"0.6562865",
"0.6555749",
"0.65462995",
"0.65366614",
"0.6536526",
"0.6531769",
"0.65270716",
"0.6522647",
"0.65213007",
"0.65213007",
"0.6518691",
"0.65095145",
"0.65049195",
"0.6491636",
"0.6490237",
"0.6483573",
"0.64831656",
"0.6477844",
"0.64728695",
"0.64704716",
"0.6468589",
"0.64670616",
"0.64607537",
"0.6460137",
"0.64493954",
"0.64483356",
"0.6442637",
"0.6440169",
"0.6438867",
"0.64378333",
"0.64335454",
"0.64181244",
"0.64181244",
"0.64132875",
"0.6410726"
] |
0.7138303
|
13
|
are we in the development environment?
|
def development?
env == 'development'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def dev_env?\n env == 'development'\n end",
"def development?\n self.environment == ENV_DEV\n end",
"def dev?\n Rails.env == 'development'\n end",
"def development?\n environment == 'development'\n end",
"def development? ; @app.options[:env] == :development ; end",
"def development?\n environment == :development\nend",
"def dev_or_test?\n development? || test?\n end",
"def development?\n !production?\n end",
"def development_mode?\n RAILS_ENV == 'development'\n end",
"def development?\n ::Rails.env.development?\n end",
"def development?\n config[:target] == :development\n end",
"def development?\n @request.development?\n end",
"def developer?\n config[\"developer\"] == true\n end",
"def not_development?\n !Rails.env.eql?(\"development\")\n end",
"def development?\n ENV['RACK_ENV'] == 'development'\n end",
"def is_dev?\n @dev\n end",
"def development?; self == \"development\"; end",
"def development?\n @dependency.type == :development\n end",
"def development?\n ENV.fetch('RACK_ENV', 'unknown').casecmp?('development')\n end",
"def development?\n if ENV['RAILS_ENV']\n ENV['RAILS_ENV'] == 'development'\n else\n ENV['RACK_ENV'].nil? || ENV['RACK_ENV'] == 'development'\n end\n end",
"def debug?\n !production?\n end",
"def prod?\n !(Rails.env.development? || Rails.env.test?)\nend",
"def loadable?\n %w(test development).include?(Rails.env) || !loaded?\n end",
"def should_build?\n config.auto_build && !dev_server_running?\n end",
"def production?\n self.environment == ENV_PROD\n end",
"def test?\n !production?\n end",
"def development\r\n\r\n end",
"def debugging?\n ENV['DEBUG'] && ENV['DEBUG'] != ''\nend",
"def staging?\n self.environment == ENV_STAGE\n end",
"def isDevelopment\n return ENV['PODFILE_TYPE'] == 'development';\nend",
"def production? ; @app.options[:env] == :production ; end",
"def production?\n environment == :production\nend",
"def development_environment?(url = nil)\n url ||= self.url\n !production_environment?(url)\n end",
"def environment_valid?\n %w(test production development).include?(@environment)\n end",
"def public?\n !development_environments.include?(environment_name)\n end",
"def production?\n @production ||= true\n end",
"def production?\n @environment == :production\n end",
"def include_dev?\n config.dig(\"composer\", \"include_dev\") == true\n end",
"def production?\n ENV[\"JEKYLL_ENV\"] == \"production\"\nend",
"def legacy_development?\n # Middleman 3.4\n is_development = try(:development?)\n unless is_development.nil?\n return is_development\n end\n\n # Middleman 4.x\n app.development?\n end",
"def staging?\n status == \"STAGING\"\n end",
"def production?\n environment == :production\n end",
"def rails_development?\n defined?(::Spring)\n end",
"def test?\n settings.environment == 'test'\n end",
"def running?\n return RUN_MODE if RUN_MODE.present?\n Rails.env.production?\n end",
"def environment\n 'dev'\nend",
"def testing?\n $TESTING ||= env?(:test) || Merb::Config[:testing]\n end",
"def local?\n test_framework?\n end",
"def production?\n settings.environment == 'production'\n end",
"def test? ; @app.options[:env] == :test ; end",
"def test_env?\n @test_environment\n end",
"def test?\n self.environment == ENV_TEST\n end",
"def is_dev_mode\n true\n end",
"def production?\n rails_env == \"production\" || rails_env == \"staging\"\n end",
"def debugging?\n\t\t(datastore['DEBUG'] || '') =~ /^(1|t|y)/i\n\tend",
"def debugging?\n debugging = ENV[\"DEBUG\"]\n if defined?(Rails) && Rails.respond_to?(:env)\n debugging = true if [\"development\", \"test\"].include? Rails.env\n end\n debugging\n end",
"def debug?\n debugging || !ENV['DEBUG'].nil?\n end",
"def sandbox?\n !production?\n end",
"def initialized?\r\n if ENV[\"RAILS_ENV\"] == \"test\" || !User.table_exists? || $setup_disabled \r\n return false\r\n else \r\n $tmp_env = ENV[\"RAILS_ENV\"] || \"development\"\r\n return true\r\n end \r\n end",
"def is_developer\n return current_user.role == User::DEVELOPER\n end",
"def debug?\n @debug || ENV['HATCHET_DEBUG'] || false\n end",
"def debug? ; $DEBUG ; end",
"def is_production?\n return true if Rails.env.production? and (!request.env[\"HTTP_HOST\"].nil? and !request.env[\"HTTP_HOST\"].include?(\"-test\") and !request.env[\"HTTP_HOST\"].include?(\"-dev\") and !request.env[\"HTTP_HOST\"].include?(\"localhost\"))\n end",
"def testing?\n $TESTING || Merb::Config[:testing]\n end",
"def production?\n Rails.env.production? || ENV[\"SIMULATE_PROD\"]\n end",
"def sandbox?\n !production?\n end",
"def production?\n config[:target] == :production\n end",
"def debug?\n @debug || to_bool( ENV['LAUNCHY_DEBUG'] )\n end",
"def debug?\n $DEBUG\n end",
"def is_production?\n %w(prod production).include?(node.chef_environment)\n end",
"def debug?\n true\n end",
"def debug?\n true\n end",
"def is_sandbox?\n @sandbox == true\n end",
"def environment_configured?\n Rails.env.test? || required_vars.empty? || required_vars.all?{|var_name| !ENV[var_name].nil? && !ENV[var_name].empty?}\n end",
"def env\n return :development unless @env\n @env\n end",
"def debug?\n\t\t!!@debuggable_status\n\tend",
"def live?\n configuration.release_stage?\n end",
"def environment\n self.config[:environment] || :development\n end",
"def production?\n\n return true if Rails.env.production?\n\n end",
"def add_filter?\n Rails.env.test? || Rails.env.development?\n end",
"def session_debug?(controller = nil)\n dev = developer?\n local = not_deployed?\n setting =\n if controller\n session[\"app.#{controller}.debug\"]\n elsif local || dev\n session['app.debug']\n end\n if local && dev || dev_client?\n !false?(setting) # Debugging *on* by default.\n else\n true?(setting) # Debugging *off* by default.\n end\n end",
"def running_protected_environment?\n protected_environments.collect(&:to_sym).include?(Rails.env.to_sym)\n end",
"def default_production?\n @@default_production\n end",
"def debug? ## always include (NOT just insportdb?)\n value = ENV['DEBUG']\n if value && TRUE_VALUES.include?( value.downcase )\n true\n else\n false\n end\nend",
"def test?\n RUBYMOTION_ENV == 'test'\n end",
"def ci?\n ENV['CI'] == 'true'\nend",
"def blockdev?() end",
"def confirmation_required?\n Rails.env.development?\n end",
"def is_developer\n return Developer.find_by(email: session[:email]) != nil\n end",
"def is_kernel_developer?\n in_role?('devel') && (\n organization.name =~ /kernel/i ||\n reported_errata.where(\"synopsis like '%kernel%' AND created_at > ?\", 18.months.ago).any?\n )\n end",
"def has_sandbox?\n true\n end",
"def dev() end",
"def tooling?\n true\n end",
"def app_starting?\n @launching\n end",
"def setup?\n Crocoduck::Store.server_cluster && \n Crocoduck::Store.server_db && \n Crocoduck::Store.server_collection\n end",
"def for_startup?\n self.stage_id > 1\n end",
"def debug?\n false\n end",
"def test_env\n if ENVIRONMENT.is_a?(String) && ENVIRONMENT == \"test\"\n true\n else\n false\n end\n end",
"def debug_mode\n @@debug_mode == 1\n end",
"def environment?\n dir?('.bundle') || dir?('.virtualenv') || dir?('node_modules')\n end"
] |
[
"0.8386098",
"0.8336098",
"0.8248356",
"0.82409084",
"0.8180134",
"0.81496793",
"0.80109537",
"0.7994709",
"0.78839225",
"0.78470504",
"0.7831569",
"0.7772603",
"0.7676056",
"0.76184464",
"0.75766873",
"0.7560572",
"0.75370014",
"0.75306714",
"0.74144775",
"0.73504907",
"0.734687",
"0.73253775",
"0.7322771",
"0.73214126",
"0.7265147",
"0.72633564",
"0.7239163",
"0.7231609",
"0.71919346",
"0.7180101",
"0.71654594",
"0.7164556",
"0.71333134",
"0.71219516",
"0.7118847",
"0.7067479",
"0.7066888",
"0.7035477",
"0.70199645",
"0.7011598",
"0.69807106",
"0.696261",
"0.6957343",
"0.69462246",
"0.6942216",
"0.6939993",
"0.69309664",
"0.6899198",
"0.68931",
"0.68795294",
"0.6865391",
"0.68561023",
"0.6821897",
"0.6803162",
"0.6802445",
"0.6791401",
"0.6787987",
"0.67850375",
"0.6768341",
"0.6767174",
"0.6758015",
"0.67562914",
"0.6754136",
"0.6749069",
"0.6734944",
"0.67131793",
"0.67102516",
"0.67067856",
"0.66956687",
"0.6692181",
"0.66628975",
"0.66628975",
"0.662592",
"0.65948683",
"0.6590628",
"0.6588676",
"0.6574102",
"0.65720206",
"0.65496916",
"0.6541401",
"0.65311855",
"0.6518375",
"0.65093887",
"0.65005",
"0.649961",
"0.64973736",
"0.6497041",
"0.64952004",
"0.6451761",
"0.6444229",
"0.6438266",
"0.641047",
"0.64023995",
"0.64017415",
"0.639904",
"0.6386627",
"0.6380667",
"0.63750774",
"0.63738066",
"0.6363965"
] |
0.83794415
|
1
|
are we in the test environment?
|
def test?
rspec? || env == 'test'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_env?\n @test_environment\n end",
"def test?\n self.environment == ENV_TEST\n end",
"def test?\n settings.environment == 'test'\n end",
"def test?\n @@mode == :test\n end",
"def test_env\n if ENVIRONMENT.is_a?(String) && ENVIRONMENT == \"test\"\n true\n else\n false\n end\n end",
"def testing?\n $TESTING ||= env?(:test) || Merb::Config[:testing]\n end",
"def test?\n rspec? || minitest?\n end",
"def test?\n RUBYMOTION_ENV == 'test'\n end",
"def test? ; @app.options[:env] == :test ; end",
"def is_test_mode?\n ENV['TEST_MODE'] === 'TRUE'\nend",
"def test?\n true\n end",
"def local?\n test_framework?\n end",
"def test_environment_valid?\n return true unless @environment == \"test\"\n !!@test_url\n end",
"def test_system?\n rack_env?(:test) && pegasus_hostname == \"test.#{site_domain}\"\n end",
"def test?\n !production?\n end",
"def test?\n false\n end",
"def testing?\n $TESTING || Merb::Config[:testing]\n end",
"def test_mode?\n mode == 'test'\n end",
"def initialized?\r\n if ENV[\"RAILS_ENV\"] == \"test\" || !User.table_exists? || $setup_disabled \r\n return false\r\n else \r\n $tmp_env = ENV[\"RAILS_ENV\"] || \"development\"\r\n return true\r\n end \r\n end",
"def user_running_test?\n return true if ENV['CUCUMBER_FORMAT'] == 'Teamcity::Cucumber::Formatter'\n return true if ENV['TEAMCITY_RAKE_RUNNER_MODE'] == 'idea'\n return true if ENV['RAKE_CONSOLE'] == 'true'\n false\n end",
"def test?\n @test\n end",
"def inside_testkitchen?\n !! defined?(::Kitchen)\n end",
"def inside_testkitchen?\n !! defined?(::Kitchen)\n end",
"def environment_valid?\n %w(test production development).include?(@environment)\n end",
"def test_browser_mode?\r\n @browser_mode == BrowserMode::Test\r\n end",
"def testing?\n !!@test\n end",
"def setup?\n @setup\n end",
"def test?\n Base.gateway_mode == :test\n end",
"def test?\n Base.gateway_mode == :test\n end",
"def test?\n Base.gateway_mode == :test\n end",
"def dev_or_test?\n development? || test?\n end",
"def test?\n ENV['RACK_ENV'] == 'test'\n end",
"def tested?\n @tested\n end",
"def test?\n params.key?('testMode') && params['testMode'] != '0'\n end",
"def test_truth\n end",
"def passed?\n return @test_passed\n end",
"def loadable?\n %w(test development).include?(Rails.env) || !loaded?\n end",
"def test_framework?\n NewRelic::Agent.config[:framework] == :test\n end",
"def test?\n self.class.test?\n end",
"def environment_configured?\n Rails.env.test? || required_vars.empty? || required_vars.all?{|var_name| !ENV[var_name].nil? && !ENV[var_name].empty?}\n end",
"def testsuite\n testMode == \"testsuite\"\n end",
"def is_sandbox?\n @sandbox == true\n end",
"def enabled?\n !Rails.env.test?\n end",
"def cd_into_test?\n !File.exist?(\"app\") && File.exist?(\"test\") &&\n (File.exist?(\"main.tf\") || File.exist?(\"main.rb\"))\n end",
"def fake?\n @test_mode == :fake\n end",
"def test_disabled?\n ENV['NO_TEST'] == '1'\nend",
"def test_disabled?\n ENV['NO_TEST'] == '1'\nend",
"def integration_test?\n Rails.env.test? && defined?(Cucumber::Rails)\n end",
"def run_on_browserstack?\n ENV['TEST_DRIVER'] && ENV['TEST_DRIVER'] == 'browserstack'\nend",
"def is_for_test_rail_run\n !ENV[\"TESTRAIL_RUN_ID\"].nil? && ENV[\"TESTRAIL_RUN\"].nil? && ENV[\"TESTRAIL_PLAN_ID\"].nil?\n end",
"def unlabeled_test?\n test_mode? && test_datum && test_datum.is_test\n end",
"def setup?\n Crocoduck::Store.server_cluster && \n Crocoduck::Store.server_db && \n Crocoduck::Store.server_collection\n end",
"def checkEnvironment(iProviderEnv)\n assert_equal(\n {\n :CGI => {\n :InternalDirectory => \"/home/groups/m/my/myproject/cgi-bin\",\n :URL => \"http://myproject.sourceforge.net/cgi-bin\"\n },\n :Shell => {\n :InternalDirectory => '/home/groups/m/my/myproject/WEACETools/Slave'\n },\n :PersistentDir => '/home/groups/m/my/myproject/persistent/WEACE'\n },\n iProviderEnv\n )\n end",
"def test_xmls?\n repository.application.service_library? ||\n !test_persistence_file_content_fragments.empty?||\n !test_persistence_file_fragments.empty? ||\n !test_artifact_fragments.empty? ||\n !test_orm_file_fragments.empty?\n end",
"def mock_environment?\n # The GoGrid environments have a mockedServices: true/false value in the environment details. This is a much\n # easier way to determine if the environment uses mocked services. The RE team is updating the MyServices\n # environment details service to also have this value. This mock_environment? method handles both cases until\n # the RE teams' service is updated.\n details = EnvironmentDetails.environment_details\n if details.has_key?('mockedServices')\n Log.instance.debug \"Mocked environment? : #{details['mockedServices']}\"\n return details['mockedServices']\n end\n\n #\n # The old school way of going to SDP to determine if we're a mocked environment...\n #\n endpoint = EnvironmentDetails.apps.sdp.environment_property('store.service.getstoreavailability.endpoint')\n # The endpoint may have some characters 'escaped', like: http\\://lmia0123/path/to/endpoint\n endpoint.gsub!('\\\\', '')\n host = URI(endpoint).host\n\n @mock_environment ||= {}\n return @mock_environment[host] if @mock_environment.has_key? host\n\n # The mock servers have a ping service we can test for existence.\n endpoint = \"http://#{host}/IsThisAMock/pingservice.asp\"\n Log.instance.debug \"Checking if we are a mock environment: #{endpoint}\"\n response = HTTParty.post(endpoint, :body => \"\")\n @mock_environment[host] = response.code == 200\n Log.instance.debug \"Mocked environment? [#{host}] : #{@mock_environment[host]}\"\n @mock_environment[host]\n rescue => e\n # TODO Need an approach for partial environment names \"http://mcomtest002.qa10.c4d.griddynamics.net/\"\n # TODO or IP addresses used as URL.\n Log.instance.warn \"Error looking up environment property: #{e}\"\n Log.instance.warn \"Mocked environment? [#{host}] : false\"\n false\n end",
"def rspec?; ::ENV['TEST_RUNNER'].present?; end",
"def run_integration_tests?\n ENV['TEST_DATADOG_INTEGRATION']\n end",
"def ready?\n # In test, we're always ready :-)\n return true if ENV.key?('INSTANA_TEST')\n\n # Occasionally Run Fork detection\n if rand(10) > 8\n if !@is_resque_worker && (@process[:pid] != Process.pid)\n ::Instana.logger.debug \"Instana: detected fork. (this pid: #{Process.pid}/#{Process.ppid}) Calling after_fork\"\n after_fork\n end\n end\n\n @state == :ready || @state == :announced\n rescue => e\n Instana.logger.debug { \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\" }\n Instana.logger.debug { e.backtrace.join(\"\\r\\n\") } unless ENV.key?('INSTANA_TEST')\n return false\n end",
"def pass?\n chdir do\n setup_test_app\n run_tests\n end\n end",
"def minitest?\n # Minitest >= 5\n (defined?(::Minitest) &&\n ::Minitest.class_variable_defined?(:@@installed_at_exit) &&\n ::Minitest.class_variable_get(:@@installed_at_exit)) ||\n # Minitest < 5\n (defined?(::Minitest::Unit) &&\n ::Minitest::Unit.class_variable_defined?(:@@installed_at_exit) &&\n ::Minitest::Unit.class_variable_get(:@@installed_at_exit))\n end",
"def test?()\n return $testP ;\n end",
"def testing\n # ...\n end",
"def test?\n params['x_test_request'] == 'true'\n end",
"def test?\n @options[:test] || Base.gateway_mode == :test\n end",
"def test_running_app_current_app\n assert_equal app, NSRunningApplication.currentApplication\n end",
"def one_running?\n system = OpenNebula::System.new(OpenNebula::Client.new)\n config = system.get_configuration\n\n OpenNebula.is_error?(config)\n end",
"def main_battle_test?\r\n # If battle test\r\n if $BTEST\r\n battle_test\r\n return true\r\n end\r\n return false\r\n end",
"def requires_external_tests_for_qe?\n required_external_tests_for_transition(:from => 'NEW_FILES', :to => 'QE').any?\n end",
"def valid_environment?\n env['USER'] == config.user && env['HOME'] == config.home_path\n end",
"def ready?\n # In test, we're always ready :-)\n return true if ENV['INSTANA_GEM_TEST']\n\n @state == :announced\n end",
"def should_load?\n test_framework? || trace_observer_configured?\n end",
"def setup_done?\n Pillar.exists? pillar: Pillar.all_pillars[:apiserver]\n end",
"def test\n testMode == \"test\" || testMode == \"screenshot\" || testMode == \"testsuite\"\n end",
"def verify_as_current_state?\n true\n end",
"def is_for_test_rail_plan\n !ENV[\"TESTRAIL_RUN\"].nil? && !ENV[\"TESTRAIL_PLAN_ID\"].nil? && !ENV[\"TESTRAIL_ENTRY_ID\"].nil? && !ENV[\"TESTRAIL_ENTRY_RUN_ID\"].nil?\n end",
"def has_sandbox?\n true\n end",
"def test_truth\n assert true\n end",
"def testing_mode?(op)\n op.plan.nil?\n end",
"def working?\n true\n end",
"def working?\n true\n end",
"def healthy?\n return true\n end",
"def use_sample_data?\n\t\t# for simplicity, turn it on if running in development\n\t\tdevelopment? || test?\n\tend",
"def test?\n params['x_test_request'] == 'true'\n end",
"def instrumentalists?\n true\n end",
"def integration_test?\n defined?(follow_redirect!)\n end",
"def development?\n self.environment == ENV_DEV\n end",
"def online_test\n return if check_offline_object(@virtualtest)\n end",
"def is_running?\n # TODO: cache this maybe?\n fetch_is_running?\n end",
"def setup\n true\n end",
"def testing_enabled?\n if Sidekiq.const_defined?('Testing') && Sidekiq::Testing.enabled?\n require 'sidekiq-unique-jobs/testing'\n return true\n end\n\n false\n end",
"def loaded?\n browser.title.include?('PHPTRAVELS')\n end",
"def complete?(env)\n hit_status(env).present?\n end",
"def complete?(env)\n hit_status(env).present?\n end",
"def complete?(env)\n hit_status(env).present?\n end",
"def has_unit_tests? # :nodoc:\n not test_files.empty?\n end",
"def test_truth\r\n assert true\r\n end",
"def test_truth\r\n assert true\r\n end",
"def test_truth\r\n assert true\r\n end",
"def passed_test?(event)\n event['event'] == 'test' && event['status'] == 'pass'\n end",
"def selenium_env?\n true\nend"
] |
[
"0.8128343",
"0.80245185",
"0.79179513",
"0.7496802",
"0.74355936",
"0.74281174",
"0.73509985",
"0.734666",
"0.7342551",
"0.72612697",
"0.72370946",
"0.72165114",
"0.71773195",
"0.71473",
"0.71248317",
"0.70725167",
"0.7047358",
"0.7045271",
"0.7002887",
"0.6983234",
"0.6946675",
"0.6886194",
"0.6886194",
"0.6868635",
"0.68200123",
"0.67969066",
"0.67903435",
"0.6765214",
"0.6765214",
"0.6765214",
"0.67399454",
"0.6739938",
"0.6715466",
"0.6693158",
"0.6635746",
"0.6595574",
"0.6588116",
"0.6584869",
"0.6582536",
"0.6576433",
"0.6559074",
"0.6558616",
"0.65375376",
"0.6509441",
"0.6494346",
"0.6486768",
"0.6486768",
"0.6466173",
"0.64538455",
"0.6437881",
"0.64241266",
"0.6409206",
"0.6404705",
"0.6404329",
"0.640302",
"0.6402557",
"0.6393043",
"0.63825315",
"0.6363811",
"0.63613033",
"0.635251",
"0.63285774",
"0.6323336",
"0.63177246",
"0.6300643",
"0.62953126",
"0.62926674",
"0.62881523",
"0.62855893",
"0.62840575",
"0.62752414",
"0.62700325",
"0.62607354",
"0.6254397",
"0.6244869",
"0.6239837",
"0.62273663",
"0.62246364",
"0.6220867",
"0.6220867",
"0.62057227",
"0.61995965",
"0.61957055",
"0.6190865",
"0.61722636",
"0.6167347",
"0.6159319",
"0.61586833",
"0.61540353",
"0.6146485",
"0.61457974",
"0.61378473",
"0.61378473",
"0.61378473",
"0.6118959",
"0.61177677",
"0.61177677",
"0.61177677",
"0.611506",
"0.6114428"
] |
0.7219837
|
11
|
Returns true if environment is development? or test?
|
def dev_or_test?
development? || test?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def development?\n env == 'development'\n end",
"def dev_env?\n env == 'development'\n end",
"def development?\n self.environment == ENV_DEV\n end",
"def development?\n environment == 'development'\n end",
"def development?\n environment == :development\nend",
"def test?\n settings.environment == 'test'\n end",
"def test?\n self.environment == ENV_TEST\n end",
"def development? ; @app.options[:env] == :development ; end",
"def dev?\n Rails.env == 'development'\n end",
"def development?\n config[:target] == :development\n end",
"def test_env\n if ENVIRONMENT.is_a?(String) && ENVIRONMENT == \"test\"\n true\n else\n false\n end\n end",
"def test?\n !production?\n end",
"def development?\n !production?\n end",
"def test_env?\n @test_environment\n end",
"def environment_valid?\n %w(test production development).include?(@environment)\n end",
"def testing?\n $TESTING ||= env?(:test) || Merb::Config[:testing]\n end",
"def development?\n ENV.fetch('RACK_ENV', 'unknown').casecmp?('development')\n end",
"def not_development?\n !Rails.env.eql?(\"development\")\n end",
"def prod?\n !(Rails.env.development? || Rails.env.test?)\nend",
"def test? ; @app.options[:env] == :test ; end",
"def development_environment?(url = nil)\n url ||= self.url\n !production_environment?(url)\n end",
"def development_mode?\n RAILS_ENV == 'development'\n end",
"def development?\n ::Rails.env.development?\n end",
"def development?; self == \"development\"; end",
"def development?\n ENV['RACK_ENV'] == 'development'\n end",
"def development?\n if ENV['RAILS_ENV']\n ENV['RAILS_ENV'] == 'development'\n else\n ENV['RACK_ENV'].nil? || ENV['RACK_ENV'] == 'development'\n end\n end",
"def development?\n @request.development?\n end",
"def staging?\n self.environment == ENV_STAGE\n end",
"def production?\n self.environment == ENV_PROD\n end",
"def production?\n environment == :production\nend",
"def environment_configured?\n Rails.env.test? || required_vars.empty? || required_vars.all?{|var_name| !ENV[var_name].nil? && !ENV[var_name].empty?}\n end",
"def is_test_mode?\n ENV['TEST_MODE'] === 'TRUE'\nend",
"def local?\n test_framework?\n end",
"def loadable?\n %w(test development).include?(Rails.env) || !loaded?\n end",
"def production?\n @environment == :production\n end",
"def production?\n rails_env == \"production\" || rails_env == \"staging\"\n end",
"def testing?\n $TESTING || Merb::Config[:testing]\n end",
"def development?\n @dependency.type == :development\n end",
"def test_environment_valid?\n return true unless @environment == \"test\"\n !!@test_url\n end",
"def is_production?\n return true if Rails.env.production? and (!request.env[\"HTTP_HOST\"].nil? and !request.env[\"HTTP_HOST\"].include?(\"-test\") and !request.env[\"HTTP_HOST\"].include?(\"-dev\") and !request.env[\"HTTP_HOST\"].include?(\"localhost\"))\n end",
"def developer?\n config[\"developer\"] == true\n end",
"def production?\n environment == :production\n end",
"def test?\n rspec? || env == 'test'\n end",
"def debugging?\n debugging = ENV[\"DEBUG\"]\n if defined?(Rails) && Rails.respond_to?(:env)\n debugging = true if [\"development\", \"test\"].include? Rails.env\n end\n debugging\n end",
"def production? ; @app.options[:env] == :production ; end",
"def should_build?\n config.auto_build && !dev_server_running?\n end",
"def running?\n return RUN_MODE if RUN_MODE.present?\n Rails.env.production?\n end",
"def public?\n !development_environments.include?(environment_name)\n end",
"def env\n return :development unless @env\n @env\n end",
"def test?\n RUBYMOTION_ENV == 'test'\n end",
"def test_system?\n rack_env?(:test) && pegasus_hostname == \"test.#{site_domain}\"\n end",
"def production?\n settings.environment == 'production'\n end",
"def enabled?\n !Rails.env.test?\n end",
"def add_filter?\n Rails.env.test? || Rails.env.development?\n end",
"def is_dev?\n @dev\n end",
"def environment\n 'dev'\nend",
"def debug?\n !production?\n end",
"def debugging?\n ENV['DEBUG'] && ENV['DEBUG'] != ''\nend",
"def is_production?\n %w(prod production).include?(node.chef_environment)\n end",
"def test?\n ENV['RACK_ENV'] == 'test'\n end",
"def legacy_development?\n # Middleman 3.4\n is_development = try(:development?)\n unless is_development.nil?\n return is_development\n end\n\n # Middleman 4.x\n app.development?\n end",
"def production?\n Rails.env.production? || ENV[\"SIMULATE_PROD\"]\n end",
"def production?\n config[:target] == :production\n end",
"def environment\n self.config[:environment] || :development\n end",
"def test_development_mode\n set_env 'RACK_ENV', nil\n refute Config.development?\n set_env 'RACK_ENV', 'development'\n assert Config.development?\n end",
"def staging?\n status == \"STAGING\"\n end",
"def environment?\n dir?('.bundle') || dir?('.virtualenv') || dir?('node_modules')\n end",
"def ci?\n ENV['CI'] == 'true'\nend",
"def integration_test?\n Rails.env.test? && defined?(Cucumber::Rails)\n end",
"def production?\n @production ||= true\n end",
"def test?\n @@mode == :test\n end",
"def valid_environment?\n env['USER'] == config.user && env['HOME'] == config.home_path\n end",
"def only_test_or_dev\n yield if Rails.env.test? || Rails.env.development?\nend",
"def env_production?\n ENV['RACK_ENV'] == 'production' || ENV['APP_ENV'] == 'production'\n end",
"def production?\n ENV[\"JEKYLL_ENV\"] == \"production\"\nend",
"def env?(env)\n Merb.env == env.to_s\n end",
"def isDevelopment\n return ENV['PODFILE_TYPE'] == 'development';\nend",
"def ci_environment?\n # check for any ci system env variables\n return true if ENV['GO_PIPELINE_NAME']\n return true if ENV['CI']\n false\n end",
"def production?\n\n return true if Rails.env.production?\n\n end",
"def rails_development?\n defined?(::Spring)\n end",
"def in_production?\n\n ## Use attribute rather than method so we can distinguish between default and set values\n return true if @environment == :production\n return false if @environment == :development\n return false if @environment == :test\n\n if defined? Rails and Rails.respond_to? :env\n return Rails.env.production?\n end\n \n if defined? Rack and defined? RACK_ENV\n return true if RACK_ENV == 'production'\n end \n \n return false\n \n end",
"def include_dev?\n config.dig(\"composer\", \"include_dev\") == true\n end",
"def app_env?(env_name)\n APP_ENV.casecmp(env_name.to_s).zero?\nend",
"def test_mode?\n mode == 'test'\n end",
"def rails_environment?(env)\n rails_environment.to_s == env.to_s\n end",
"def production_environment?(url = nil)\n url ||= self.url\n !!url.match(/(macys|bloomingdales)\\.com/)\n end",
"def user_running_test?\n return true if ENV['CUCUMBER_FORMAT'] == 'Teamcity::Cucumber::Formatter'\n return true if ENV['TEAMCITY_RAKE_RUNNER_MODE'] == 'idea'\n return true if ENV['RAKE_CONSOLE'] == 'true'\n false\n end",
"def test?\n rspec? || minitest?\n end",
"def gateway_mode\n @config[:test].present? ? :test : :production\n end",
"def autodetect_environment\n rails_env = if defined?(::Rails) && ::Rails.respond_to?(:env)\n ::Rails.env.to_s\n elsif defined?(::RAILS_ENV)\n ::RAILS_ENV.to_s\n end\n \n LIVE_RAILS_ENVIRONMENTS.include?(rails_env) ? 'live' : 'test'\n end",
"def initialized?\r\n if ENV[\"RAILS_ENV\"] == \"test\" || !User.table_exists? || $setup_disabled \r\n return false\r\n else \r\n $tmp_env = ENV[\"RAILS_ENV\"] || \"development\"\r\n return true\r\n end \r\n end",
"def test_disabled?\n ENV['NO_TEST'] == '1'\nend",
"def test_disabled?\n ENV['NO_TEST'] == '1'\nend",
"def running_protected_environment?\n protected_environments.collect(&:to_sym).include?(Rails.env.to_sym)\n end",
"def environment\n\n return @environment || :development\n\n end",
"def environment\n options['environment'] || :development\n end",
"def default_production?\n @@default_production\n end",
"def production?\n ENV[\"RACK_ENV\"] == \"production\"\n end",
"def sandbox?\n !production?\n end",
"def run_on_browserstack?\n ENV['TEST_DRIVER'] && ENV['TEST_DRIVER'] == 'browserstack'\nend"
] |
[
"0.86751854",
"0.86735874",
"0.86732763",
"0.8673128",
"0.84796625",
"0.8343251",
"0.8250853",
"0.8207119",
"0.8196234",
"0.8175681",
"0.8170555",
"0.8160151",
"0.8153777",
"0.8112107",
"0.80798095",
"0.8047786",
"0.804529",
"0.80203384",
"0.79971206",
"0.7926902",
"0.79214835",
"0.78966814",
"0.78895825",
"0.786745",
"0.7820607",
"0.7783461",
"0.76775664",
"0.7668068",
"0.7665142",
"0.7621687",
"0.76166594",
"0.7595632",
"0.7554564",
"0.7550567",
"0.7526979",
"0.7523012",
"0.75139916",
"0.7482707",
"0.7482541",
"0.74720794",
"0.74278843",
"0.74264866",
"0.7369718",
"0.73449534",
"0.73408914",
"0.7337428",
"0.7332423",
"0.73063743",
"0.7296593",
"0.7296242",
"0.7259132",
"0.72573864",
"0.7215446",
"0.7213812",
"0.72023535",
"0.71998197",
"0.71966183",
"0.71960133",
"0.71937156",
"0.71806616",
"0.7154069",
"0.7146163",
"0.713193",
"0.71295357",
"0.71199703",
"0.7117139",
"0.7115562",
"0.70996994",
"0.7075206",
"0.70722896",
"0.7070994",
"0.7048428",
"0.70284235",
"0.7014402",
"0.7006817",
"0.69864774",
"0.696265",
"0.69121975",
"0.68704027",
"0.68662953",
"0.6847496",
"0.68449616",
"0.6828332",
"0.680684",
"0.680604",
"0.68047446",
"0.68021405",
"0.67925787",
"0.6789668",
"0.6776019",
"0.67526054",
"0.67307544",
"0.67307544",
"0.6712923",
"0.6706678",
"0.6703653",
"0.66988575",
"0.66988397",
"0.6698607",
"0.6691615"
] |
0.90946126
|
0
|
add custom configs before other things start
|
def setup(configs = nil)
return if @setup
@setup = true
@custom_configs = configs || []
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setup_config\n # To be Extended\n end",
"def post_configure\n # noop\n end",
"def configure\n load_all_configs \n end",
"def configure; end",
"def before_configuration(&block); end",
"def preconfigure(&block)\n @preconfigure ||= block\n end",
"def startup_hook; end",
"def initialize\n super\n \n run_hook :before_configuration\n \n # Search the root of the project for required files\n $LOAD_PATH.unshift(root)\n \n # Check for and evaluate local configuration\n local_config = File.join(root, \"config.rb\")\n if File.exists? local_config\n puts \"== Reading: Local config\" if logging?\n instance_eval File.read(local_config)\n end\n \n run_hook :build_config if build?\n run_hook :development_config if development?\n \n run_hook :after_configuration\n \n # Add in defaults\n default_extensions.each do |ext|\n activate ext\n end\n \n if logging?\n self.class.extensions.each do |ext|\n puts \"== Extension: #{ext}\"\n end\n end\n end",
"def post_setup\n end",
"def before_configuration_tasks \n end",
"def setup(&block)\n Config.setup(&block)\n end",
"def load_preconfig\n\t\tbegin\n\t\t\tconf = Msf::Config.load\n\t\trescue\n\t\t\twlog(\"Failed to load configuration: #{$!}\")\n\t\t\treturn\n\t\tend\n\n\t\tif (conf.group?(ConfigCore))\n\t\t\tconf[ConfigCore].each_pair { |k, v|\n\t\t\t\ton_variable_set(true, k, v)\n\t\t\t}\n\t\tend\n\tend",
"def configure\n end",
"def setup_initial_config!\n application.config do\n attribute :praxis do\n attribute :validate_responses, Attributor::Boolean, default: false\n attribute :validate_response_bodies, Attributor::Boolean, default: false\n\n attribute :show_exceptions, Attributor::Boolean, default: false\n attribute :x_cascade, Attributor::Boolean, default: true\n end\n end\n end",
"def init_config()\n options_apply_filter(\"DEFAULT\")\n end",
"def _init_configuration\n\t\t# Set defaults\n\t\t@setup = { \"create\" => false, \"environment\" => false, \"test\" => true, \"destroy\" => false }\n\t\t@config = false\n\tend",
"def init!\n # check if configuration file is already created\n unless File.exist?(CONFIG_FILE)\n puts \"=> [PagSeguro] The configuration could not be found at #{CONFIG_FILE.inspect}\"\n return\n end\n \n # The developer mode is enabled? So install it!\n developer_mode_install! if developer?\n end",
"def preconfigure\n yield(configuration.configured_options)\n end",
"def add_standard_properties\n super\n\n @config_manager.add_override_property('run.config_name', self.class.basename)\n end",
"def setup\n yield(application_config)\n end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def setup_common\n options[:log].each do |spec|\n mod, level, file = spec.split(\":\")\n app.log_setup(mod, level, file)\n end\n\n if options[:debug]\n app.public_logs = true\n app.filter_backtraces = false\n require \"roby/app/debug\"\n end\n\n nil\n end",
"def setup(args={})\n super\n @conf_key = (args[:config_key] || :http_endpoints).to_sym\n set_points\n end",
"def pre_connect_hooks; end",
"def pre_connect_hooks; end",
"def initialize\n set_config\n end",
"def before_setup; end",
"def setup(&blk)\n @config.read(&blk)\n @config\n end",
"def configure(&block); end",
"def configure(&block); end",
"def setup(&block)\n block.call config if block_given?\n end",
"def init_compile_config\n end",
"def config\n\n end",
"def bootstrap_init\n end",
"def load_config\n\t\t# load conifg\n\t\tend",
"def finish_setup(config_data)\n return if config_data == nil\n\n if config_data['config']\n ::TingYun::Agent.logger.debug \"Using config from server\"\n end\n ::TingYun::Agent.logger.debug \"Server provided config: #{config_data.inspect}\"\n server_config = TingYun::Configuration::ServerSource.new(config_data)\n ::TingYun::Agent.config.replace_or_add_config(server_config)\n #log_connection!(config_data)\n end",
"def before_setup\n # do nothing by default\n end",
"def init_compile_config\n # TODO\n end",
"def init_compile_config\n # TODO\n end",
"def configure\n # do nothing\n end",
"def set_config(*args); end",
"def set_config(*args); end",
"def set_config(*args); end",
"def set_config(*args); end",
"def set_config(*args); end",
"def pre_setup_suite()\n @cfg['pre_setup'] =\"defined\"\n return true\n end",
"def initialize\n super\n Souffle::Config.merge!(config)\n end",
"def pre_init(&block)\n @hooks[:pre_init] = block\n end",
"def startup\nend",
"def set_config(config)\n\t\tend",
"def startup\n end",
"def setup\n if config.key?(:particle_config_file)\n if File.readable?(config[:particle_config_file])\n file = File.read(config[:particle_config_file])\n config_hash = JSON.parse(file)\n keys = %w[particle_user particle_password particle_token particle_event particle_data particle_private]\n keys.each do |key|\n config[key.to_sym] = config_hash[key] if config_hash.key?(key)\n end\n end\n end\n\n unless (config[:particle_user] && config[:particle_password]) || config[:particle_token]\n puts 'Must supply user and password or token, check --help message for more information'\n exit 2\n end\n\n config[:particle_data] = \"#{@event['check']['name']}::#{@event['occurrences']}\" unless config.key?(:particle_data)\n config[:particle_private] = false unless config.key?(:particle_private)\n\n return unless config[:verbose]\n\n puts \"Post Setup:: Private: #{config[:particle_private]}\"\n if config[:particle_token]\n puts \"Post Setup:: Token: #{config[:particle_token]}\"\n else\n puts 'Post Setup:: Using Login'\n end\n end",
"def initialize\n configure_via_yaml\n configure_via_env\n end",
"def initialize(*args)\n initialize_config unless instance_variable_defined?(:@config)\n super\n end",
"def startup\n end",
"def startup\n end",
"def startup\n end",
"def configure_components\n config.producer ||= ::WaterDrop::Producer.new do |producer_config|\n # In some cases WaterDrop updates the config and we don't want our consumer config to\n # be polluted by those updates, that's why we copy\n producer_config.kafka = config.kafka.dup\n producer_config.logger = config.logger\n end\n\n return unless Karafka.pro?\n\n # Runs the pro loader that includes all the pro components\n require 'karafka/pro/loader'\n Pro::Loader.setup(config)\n end",
"def configure_manager\n end",
"def setup_components\n config\n .internal\n .configurators\n .each { |configurator| configurator.call(config) }\n end",
"def apply_pooka_configure(data)\n @logger_path = data['logger_path']\n @logger_level = data['logger_level']\n @pid_path = data['pid_path'] || @pid_path\n @sleep_time = data['sleep_time'] || @sleep_time\n end",
"def config=(config); end",
"def pre_install; end",
"def setup\n setup_methods.each { |m| self.send(m) }\n start_services\n \n wait_time = cfg('wait-after-startup')\n if not wait_time.nil?\n 1.upto(wait_time) do |i|\n puts \"Waiting #{wait_time-i} seconds before commencing benchmarks\"\n sleep 1\n end\n end\n end",
"def setup\n debug 'No custom setup defined'\n end",
"def configure_backdat\n @commands = parse_options\n\n begin\n ::File.open(config[:config_file]) { |f| apply_config(f.path) }\n rescue Errno::ENOENT => error\n msg = \"Did not find the config file: #{config[:config_file]}\"\n msg << \", Using command line options.\"\n Backdat::Log.warn \"*****************************************\"\n Backdat::Log.warn msg\n Backdat::Log.warn \"*****************************************\"\n end\n end",
"def configurations; end",
"def before_bootstrap; end",
"def configure(root_config)\n end",
"def configure(root_config)\n end",
"def setup\n @configs ||= Configuration.config\n \n yield(@configs) if block_given?\n \n @configs\n end",
"def config_files(override); end",
"def configure!\n yield self\n setup\n end",
"def install_pre_hook\n end",
"def setup\n @configure = Hatemile::Util::Configure.new\n end",
"def use(config)\n\t\t\tcmd = config['init_cmd']\n\t\t\tunless cmd.nil?\n\t\t\t\tsystem cmd\n\t\t\tend\n end",
"def setup(settings = {})\n @config = defaults.merge(settings)\n end",
"def configure(root_config)\n\n end",
"def initialize\n super\n configure_logging\n detect_platform()\n detect_resolver()\n load_config()\n end",
"def before_bootstrap\n end",
"def add_config(name, config)\n\t\tend",
"def setup!\n Fission.registration.each do |key, klasses|\n klasses.each do |klass|\n args = [:fission, :workers, *key.split('.')]\n num = nil\n until(args.empty? || num)\n num = Carnivore::Config.get(*args)\n unless(num.is_a?(Fixnum))\n num = nil\n args.pop\n end\n end\n klass.workers = num.is_a?(Fixnum) ? num : 0\n src_key = key.split('.').first\n src = Carnivore::Source.source(src_key)\n if(src)\n name = klass.to_s.split('::').last\n src.add_callback(name, klass)\n else\n Carnivore::Utils.warn \"Workers defined for non-registered source: #{key}\"\n end\n end\n end\n\n # Setup process manager if needed\n # if(Carnivore::Config.get(:fission, :utils, :process, :max_processes).to_i > 0)\n # require 'fission/utils/process'\n # if(Carnivore::Config.get(:fission, :utils, :process, :spawn))\n # ChildProcess.posix_spawn = true\n # end\n # Utils::Process.supervise_as :process_manager\n # end\n end",
"def do_setup(config)\n require File.join(config.root.join('config', 'environment'))\n\n # force eager load of Rails and application irrespective of config\n # context: require 'source' is not atomic or thread-safe, i.e. race conditions can occur if a class is required inside multiple threads at the same time\n rc = Rails.application.config\n rc.eager_load_namespaces.each(&:eager_load!) unless rc.eager_load # if true, already happened\n\n filename = call_hook(:stdout_filename)\n # puts \"stdout to: #{filename} #{Rails.root}\"\n\n if filename\n STDIN.reopen(\"/dev/null\")\n STDOUT.reopen(filename, \"a\")\n STDERR.reopen(STDOUT)\n end\n puts \"starting rails\"\n call_hook(:setup)\n end"
] |
[
"0.7228922",
"0.67720205",
"0.67710435",
"0.67485243",
"0.6706806",
"0.6627635",
"0.6590881",
"0.65618175",
"0.6489989",
"0.6478255",
"0.6409258",
"0.63975376",
"0.63944656",
"0.63705426",
"0.63701934",
"0.6366857",
"0.6334453",
"0.628768",
"0.62800384",
"0.62677824",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.62611914",
"0.6234385",
"0.62214047",
"0.6218042",
"0.6218042",
"0.6210899",
"0.62062967",
"0.6205308",
"0.6204011",
"0.6204011",
"0.6187485",
"0.61660004",
"0.6164543",
"0.61374456",
"0.61250556",
"0.61110276",
"0.61045694",
"0.60989773",
"0.60989773",
"0.6097583",
"0.60847104",
"0.60847104",
"0.60847104",
"0.60847104",
"0.60847104",
"0.60760343",
"0.6052251",
"0.6037679",
"0.60307354",
"0.6028445",
"0.60170025",
"0.60169536",
"0.60049284",
"0.5983878",
"0.59770024",
"0.59770024",
"0.59770024",
"0.59732807",
"0.5971372",
"0.59623945",
"0.59582174",
"0.5954881",
"0.5945858",
"0.594117",
"0.5934165",
"0.5929742",
"0.5921497",
"0.5912085",
"0.59095913",
"0.59095913",
"0.5885625",
"0.58819455",
"0.58749616",
"0.5874244",
"0.5871882",
"0.58533853",
"0.5845995",
"0.58458066",
"0.5845313",
"0.5842979",
"0.58393824",
"0.5839121",
"0.58353806"
] |
0.7018678
|
1
|
indicates if the rfsb has been sent to the shipping machine, and then been recieved from the shipping machine back to the webserver. We know this if both sf and acf integrity_hashes are set on the object
|
def cycle_complete?
!self.sf_integrity_hash.nil? and !self.acf_integrity_hash.nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def should_gen_a_new_rfsb?(sale)\n return true if sale.ready_for_shipment_batch_id.nil?\n false\n end",
"def refunded?\n !@refund_id.nil?\n end",
"def received?\r\n self['trans_status']=='99'\r\n end",
"def is_delivery_receipt_requested\n return @is_delivery_receipt_requested\n end",
"def delivered?\n @delivered\n end",
"def well_formated_response?\n all_expected_fields_received? && validate_bank_response_signature\n end",
"def already_uploaded_this_acf?(nmd)\n !ReadyForShipmentBatch.find_by_acf_integrity_hash(nmd.integrity_hash).nil?\n end",
"def fees_state?\n self.form_state == :fees\n end",
"def sent?\n self.status == 'sent'\n end",
"def in_transit?\n status.sent?\n end",
"def sent?\n @sent\n end",
"def signalled?\n\t\t\t\t@signalled\n\t\t\tend",
"def failed_full_sync_required?\n\t\t\treturn request_status == REQUEST_STATUS['failed_full_sync_required']\n\t\tend",
"def sent?\n status.sent? || status.received? || status.read?\n end",
"def payment_received?\n payment_state == PAYMENT_RECEIVED\n end",
"def ready_to_submit?\n return self.new_record? == false && \\\n self.approvable.new_record? == false && \\\n self.mail_sent == false\n end",
"def sent?\n status == \"sent\"\n end",
"def shipped?\n shipped == true\n end",
"def all_expected_fields_received?\n @signature_fields ||= %w(idterminal idcomercio idtransaccion importe moneda coderror codautorizacion firma).map{|value| value = value.to_sym}\n !@fields.empty? && @fields.areset?(@signature_fields)\n end",
"def ship_sunk?\n @ship_sunk\n end",
"def rerequested_check?\n checks_event? &&\n decoded_payload['action'] == 'rerequested' &&\n !tag_created_check_suite?\n end",
"def require_receipt?\n !!(self.registered_download.require_receipt?)\n end",
"def outdated?\n @outdated = []\n fields.each do |fld|\n if fld[:trans]\n # SomeTransferObject.remote_tranfer_function(remote_obj_data)\n virtual_local_val = fld[:trans][:obj].constantize.send( fld[:trans][:rem_trans], loc_obj.send( fld[:loc_key] ) )\n @outdated << fld if virtual_local_val != rem_obj.send( fld[:rem_key] )\n else\n @outdated << fld if rem_obj.send( fld[:rem_key] ) != loc_obj.send( fld[:loc_key] )\n end \n end\n !@outdated.empty?\n end",
"def shipping?\n each_line do |line|\n # has it shipped?\n return true if line.li_date_shipped\n # or is it queued up for shipping?\n return true if Ship.for_line_item(line)\n end\n return false\n end",
"def update_ok?(order_hash)\n\t\tif !order_hash[:order_number]\n\t\t\treturn false\n\t\telsif order_hash[:status] == 'SH' \n\t\t\t\treturn true unless order_hash[:tracking_number] == nil || order_hash[:ship_method] == nil\n\t\telse\n\t\t\treturn true\n\t\tend \n\tend",
"def update_ok?(order_hash)\n\t\tif !order_hash[:order_number]\n\t\t\treturn false\n\t\telsif order_hash[:status] == 'SH' \n\t\t\t\treturn true unless order_hash[:tracking_number] == nil || order_hash[:ship_method] == nil\n\t\telse\n\t\t\treturn true\n\t\tend \n\tend",
"def needs_sending?\n !sent? && !flagged?\n end",
"def check_if_alreay_refunded(transaction_id, gs)\n st = gs.session_transactions\n .refund_types\n .find_by(transaction_id: transaction_id)\n { transaction_id: transaction_id, balance: st.wallet_balance } if st\n end",
"def is_pending_recovery?\n self.activated? and self.verification_key ? true : false\n end",
"def before_save\n changed_fields?\n if(@changed_fields && @changed_fields.keys.include?('rmt_product_id') && ((bins = Bin.find_all_by_delivery_id(self.id)).length>0))\n raise \"sorry cannot change rmt_product of this delivery , #{bins.length} bin(s) have already been scanned for this delivery\"\n end\n puts\n end",
"def settled_payment?\n SUCCESSFUL_PAYMENT.include?(response['payment_state'])\n end",
"def check_rbs_availability!; end",
"def is_delivery\n profile.delivery\n end",
"def needs_initial_response?\n # logger.debug(\"CHC: needs_initial_response '#{p_s_b}'\")\n return false if p_s_b != 'P'\n # logger.debug(\"CHC: needs_initial_response still here\")\n center = queue.center.center\n ret = false\n pmr.signature_lines.each do |sig|\n # logger.debug(\"CHC: stype=#{sig.stype} ptype=#{sig.ptype}\")\n # Set ret to true for any requeue of the primary. The last\n # one will be the requeue to the current location.\n if sig.stype == 'CR' && sig.ptype == '-' && sig.center != center\n # logger.debug(\"CHC: CR line at #{sig.date}\")\n ret = true\n end\n # Set ret to false for any CT from this center.\n if sig.stype == 'CT' && sig.center == center\n # logger.debug(\"CHC: CT line at #{sig.date}\")\n ret = false\n end\n end\n # Ret will be the last toggle from the above two conditions.\n ret\n end",
"def to_be_performed?\n self.research_billing_qty > 0\n end",
"def stored_offsite?\n (@trustee == true || (! billing_key.blank? && !changed?))\n end",
"def delivered?\n processed? && !held? && !bounced? && message.present?\n end",
"def supports_shipment_retry_awb_document?\n return false\n end",
"def delivered?\n (!current_stage.nil? &&\n current_stage.stage.eql?('delivered') &&\n current_stage.status.eql?('passed') &&\n !AutomateSoup.url.nil? &&\n !AutomateSoup.credentials.nil?)\n end",
"def delivered?\n\t\tinstance_variable_defined? :@value\n\tend",
"def need_scrapping?\n !@festival.instance_of?(Festival) || !@festival.valid? || @festival.should_be_updated?\n end",
"def pending_pickup?\n @is_pending_pickup\n end",
"def true(argvs)\n return nil unless argvs\n return nil unless argvs.is_a? Sisimai::Data\n return nil unless argvs.deliverystatus.size > 0\n return true if argvs.reason == 'mailboxfull'\n\n # Delivery status code points \"mailboxfull\".\n # Status: 4.2.2\n # Diagnostic-Code: SMTP; 450 4.2.2 <***@example.jp>... Mailbox Full\n require 'sisimai/smtp/status'\n return true if Sisimai::SMTP::Status.name(argvs.deliverystatus) == 'mailboxfull'\n\n # Check the value of Diagnosic-Code: header with patterns\n return true if match(argvs.diagnosticcode)\n return false\n end",
"def nyc_formation_triggered?\n @nyc_formation_state\n end",
"def is_delivery_receipt_requested=(value)\n @is_delivery_receipt_requested = value\n end",
"def check_via_branch\n if @msg.via_branch_rfc3261\n @msg.via_branch_id = @msg.via_branch[7..-1] # The branch without \"z9hG4bK\".\n return true\n end\n\n if @msg.is_a? Request\n unless @msg.sip_method == :ACK\n log_system_notice \"request doesn't contain a RFC 3261 Via branch => 400\"\n @msg.reply 400, \"Via branch non RFC 3261 compliant\"\n else\n log_system_notice \"ACK doesn't contain a RFC 3261 Via branch, ignoring it\"\n end\n else\n log_system_notice \"response doesn't contain a RFC 3261 Via branch, ignoring it\"\n end\n false\n end",
"def outdated?\n @outdated = []\n fields.each do |fld|\n if fld.transition?\n # call r_trans method with local val to compare local with remote val\n # SomeTrans.remote_transfer_method( l_obj.field )\n virtual_l_val = eval \"#{fld.r_trans} l_obj.send( fld.l_name )\"\n @outdated << fld if virtual_l_val != r_obj.send( fld.r_name )\n else\n # no transfer method, directly compare values\n @outdated << fld if r_obj.send( fld.r_name ) != l_obj.send( fld.l_name )\n end\n end\n !@outdated.empty?\n end",
"def is_retrigger\n attributes.fetch(:isRetrigger)\n end",
"def is_read_receipt\n return @is_read_receipt\n end",
"def delivered?\n\t\t@mutex.synchronize {\n\t\t\tinstance_variable_defined? :@value\n\t\t}\n\tend",
"def check\n @response = get_fixity_response_from_fedora\n status.match(\"SUCCESS\") ? true : false\n end",
"def shipping?\n true\n end",
"def draft?\n self.sent? || self.batch_sent? ? false : true\n end",
"def invoice?\n (payment_on_account? || payment_received?) && fully_shipped?\n end",
"def should_be_set_to_draft?\n return false if self.draft?\n self.payin_rules.any?{|pr| pr.changed?} || self.ad_images.any?{|ai| ai.changed? } || self.location.changed? || self.changes.except('status','refusal_reason').present?\n end",
"def sent?\n sender_id.present?\n end",
"def faab?\n free_agent? && !waiver_bid.nil?\n end",
"def submitted_fafsa?\n !fafsa_submitted_at.nil?\n end",
"def transfer_given?\n params.has_key?(:is_transfer) || params.has_key?(:transfer_buddy)\n end",
"def has_receipt?\n receipt.present?\n end",
"def is_read_receipt_requested\n return @is_read_receipt_requested\n end",
"def transferable?\n !bundle? && !part_of_bundle? && unreserved? or\n bundle? && bundled_vouchers.all?(&:unreserved?)\n end",
"def check_and_update_delivery_status!\n update_attribute(:delivery_status_checked_at, Time.zone.now)\n deliver! if dummy_tracking? || (carrier && carrier.delivered?(tracking_number))\n end",
"def verify#todo\n #if its a fault, then its a no for sure\n #otherwise make sure all the fields are the right type, and are initialized etc\n true\n end",
"def verified_request?; end",
"def tfs_webhook?\n # https://docs.microsoft.com/en-us/vsts/service-hooks/services/webhooks\n return false unless @data.key? 'resource'\n return false unless @data.key? 'eventType'\n\n true\n end",
"def complete?\n status == \"verified\"\n end",
"def track_shipments?\n !store.disable_shipment_transfers?\n end",
"def validate_for_sent?\n [\n :ax_account_number,\n :ax_account_id,\n :ax_order_number,\n :ax_order_id,\n :email_address,\n #:first_name,\n #:last_name,\n :serial_number\n ].detect { |attr| self.send(attr).blank? }.nil?\n end",
"def fully_downloaded?\n self.transmission_status == 8 && self.transmission_total_size == self.transmission_downloaded_size\n end",
"def delivery_status_report?\n multipart_report? && content_type_parameters['report-type'] =~ /^delivery-status$/i\n end",
"def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end",
"def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end",
"def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end",
"def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end",
"def imperfect_return_resubmission?\n return false unless previously_transmitted_submission.present?\n \n previously_transmitted_submission.efile_submission_transitions.collect(&:efile_errors).flatten.any? { |error| [\"SEIC-F1040-501-02\", \"R0000-504-02\"].include? error.code }\n end",
"def package_delivered\n self.status = CONSTANT['BOX_DELIVERED']\n self.package.status = CONSTANT['PACKAGE_DELIVERED_DELIVERY']\n if self.package.save\n if self.save\n pin = self.access.generate_pin\n if pin\n self.package.user.send_pick_up_pin pin #TODO\n return true\n end\n end\n end\n return false\n end",
"def is_foreign_transaction?\n return true if @extra_details.has_key?('currencyRate')\n false\n end",
"def payment_received?\n status == Enums::PaymentStatus::PAYMENT_RECEIVED\n end",
"def has_valid_payload?\n\t\treturn self.payload_hash == self.calculate_payload_hash\n\tend",
"def has_pushed_rhn_stage?\n return true if rhnqa? || rhnqa_shadow?\n\n has_pushed_since_last_respin?(RhnStagePushJob)\n end",
"def appended_to_fund_request?( fund_request )\n return true if new_record? || fund_requests.actionable.empty?\n false\n end",
"def include_checksum?\n include_checksum\n end",
"def has_ships_still_floating?\n end",
"def valid?\n # binding.pry\n # if (self.status == \"pending\") && (self.amount > 0)\n # true\n # elsif (self.status != \"pending\") || (self.amount = 0)\n # false\n # end\n if (receiver.valid? == true) && (sender.valid? == true)\n true\n end\n end",
"def deliverable?\n recipient.status != \"address_not_exist\"\n end",
"def can_be_synced_to_remote?\n if is_drupal?\n !(lapsed? or applied?) and club.billing_enable\n elsif is_spree?\n !(applied?) and club.billing_enable\n end\n end",
"def shipped?\n !!self.shipped_at?\n end",
"def allowed_to_ship_data?\n return false if (Time.now.to_i - self.synced_at) < 43200\n return true\n end",
"def late?\n \t\tTime.now > @delivery_time\n \t\treturn true\n \tend",
"def verify\n if (buffer.offset + @_model.fbe_offset - 4) > buffer.size\n return false\n end\n\n fbe_full_size = read_uint32(@_model.fbe_offset - 4)\n if fbe_full_size < @_model.fbe_size\n return false\n end\n\n @_model.verify\n end",
"def verify\n if (buffer.offset + @_model.fbe_offset - 4) > buffer.size\n return false\n end\n\n fbe_full_size = read_uint32(@_model.fbe_offset - 4)\n if fbe_full_size < @_model.fbe_size\n return false\n end\n\n @_model.verify\n end",
"def verify\n if (buffer.offset + @_model.fbe_offset - 4) > buffer.size\n return false\n end\n\n fbe_full_size = read_uint32(@_model.fbe_offset - 4)\n if fbe_full_size < @_model.fbe_size\n return false\n end\n\n @_model.verify\n end",
"def verify\n if (buffer.offset + @_model.fbe_offset - 4) > buffer.size\n return false\n end\n\n fbe_full_size = read_uint32(@_model.fbe_offset - 4)\n if fbe_full_size < @_model.fbe_size\n return false\n end\n\n @_model.verify\n end",
"def is_fir?\n self.fir_role != nil\n end",
"def changed?\n #card_type_changed?\n ret=(changed & DB_FIELDS).present? || VIRTUAL_FIELDS.any? {|attr| self.send(attr).present?}\n ret\n end",
"def is_confirmed?\n return self.status == Erp::QuickOrders::Order::STATUS_CONFIRMED\n end",
"def bitbucket_server_webhook?\n # https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html\n @headers.key?('HTTP_X_EVENT_KEY') && @headers.key?('HTTP_X_REQUEST_ID')\n end",
"def recipient_required?\n transfer_type?\n end",
"def fixity_check?\n event_type == FIXITY_CHECK\n end"
] |
[
"0.59853685",
"0.5933234",
"0.58303905",
"0.5734012",
"0.57134426",
"0.5640094",
"0.56085914",
"0.5581897",
"0.5573078",
"0.55507386",
"0.5548839",
"0.5520923",
"0.55179834",
"0.5509138",
"0.54957247",
"0.5487326",
"0.5446273",
"0.5442873",
"0.5432538",
"0.5427214",
"0.54256624",
"0.54243904",
"0.5415073",
"0.54138225",
"0.53929865",
"0.53929865",
"0.5391555",
"0.53883237",
"0.53663343",
"0.53433657",
"0.5329406",
"0.5319668",
"0.5317567",
"0.53080237",
"0.52916694",
"0.52907676",
"0.52881724",
"0.5281636",
"0.5273525",
"0.5269002",
"0.5250032",
"0.52499187",
"0.52427036",
"0.5236141",
"0.52173036",
"0.52041554",
"0.5201751",
"0.5196509",
"0.51960605",
"0.5192982",
"0.5189782",
"0.5185504",
"0.5184276",
"0.51749104",
"0.51733416",
"0.5173078",
"0.51726073",
"0.5172062",
"0.51701474",
"0.5169978",
"0.51684433",
"0.5166902",
"0.5157428",
"0.5153431",
"0.5151275",
"0.5147499",
"0.51451236",
"0.5131887",
"0.51312196",
"0.5130142",
"0.5128705",
"0.51237714",
"0.51237714",
"0.51237714",
"0.51237714",
"0.5114159",
"0.51065636",
"0.51014465",
"0.5094545",
"0.50925887",
"0.5076694",
"0.50746477",
"0.5072361",
"0.50658625",
"0.50632167",
"0.50627327",
"0.5062504",
"0.5056093",
"0.505117",
"0.5050339",
"0.50476295",
"0.50476295",
"0.50476295",
"0.50476295",
"0.5043159",
"0.5041978",
"0.5041675",
"0.5040269",
"0.50359637",
"0.5034148"
] |
0.56532896
|
5
|
( + 2) 3
|
def get_fuel_for_mass(mass)
fuel_needed = (mass / 3) - 2
fuel_needed = fuel_needed + get_fuel_for_mass(fuel_needed) if fuel_needed >= MINIMUM_MASS_FOR_FUEL
fuel_needed
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def calculate\n (2 + 2) * 2\nend",
"def arthamatic_operation(number)\n\tnumber + 3\nend",
"def plus_three(num)\n num + 3\nend",
"def add_three(number)\n return number + 3\n number + 4\nend",
"def add_three(number)\n return number + 3\n number + 4\nend",
"def add_three(number)\n return number + 3\n number + 4\nend",
"def add_three(number)\n return number + 3\n number + 4\nend",
"def add_three(number)\n return number + 7\n number + 12\nend",
"def addittion(x, y)\n return (x + y)\nend",
"def test_plus\r\n assert_equal 3, @interpreter.run(\"(+ 1 2)\")\r\n end",
"def add(a,b)\n return (a + b);\nend",
"def plus(x, y)\n z = x + y\n return z\nend",
"def add_three(number)\n return number + 3\nend",
"def add_three(number)\n return number + 3\nend",
"def add_three(number)\n return number + 3\nend",
"def add_three(number)\n return number + 3\nend",
"def arithmetic2(a, b)\nend",
"def add_three(number)\n number + 3\n return number + 4\nend",
"def add_three(n)\n n + 3\nend",
"def plus(number, other)\n\tnumber + other\nend",
"def plus_one(num_2)\n return num_2 +1\n\nend",
"def + b\n 1.plus self.plus(b)\n end",
"def number_method(num)\n num = (3 + 5)\nend",
"def add_three(number)\n number + 3\n number + 4 \nend",
"def plus(a, b)\n a + b\nend",
"def plus(a, b)\n a + b\nend",
"def one_plus_one (num)\n new = num + 3\n print new \n \nend",
"def addition(a, b)\n\ta + b\nend",
"def add_three(number)\n number + 3\nend",
"def add_three(number)\n number + 3\nend",
"def add_three(number)\n number + 3\nend",
"def arithmetic1(n)\r\r\n n * 5 - 20\r\r\nend",
"def addition (a, b)\n a + b\nend",
"def add_two(x)\n\tx + 5\nend",
"def add_2(x, y)\n x + y\n end",
"def addition(a, b)\n\treturn a + b\nend",
"def addition(a,b)\n\ta + b\nend",
"def z(a)\n # a + a # =>\nend",
"def add(first_num, second_num)\n @result = (first_num + second_num)\nend",
"def Multiply(x)\n (x * 3)\nend",
"def operation(num)\n\treturn num*num, num**3\nend",
"def add(num1, num2)\n my_result = (num1 + num2)\n \nend",
"def add(n, p)\n return n + p\nend",
"def add (a, b)\n puts 1\n puts 2 \n (a+b)\n return result\n \nend",
"def add_three(n)\n puts n + 3\nend",
"def add_two(number)\n number + 2 # res of last line will be returned\nend",
"def addition(a, b) \n return a + b\nend",
"def triple_add(a, b, c)\n puts \"ADDING #{a} + #{b} + #{c}\"\n return a + b + c\nend",
"def add_twos(num1, num2)\n number = (num1 + num2)\n puts number\nend",
"def double(val)\r\n val * 5\r\n # the return is te result of the last expression\r\n val * 2\r\nend",
"def three(number)\n puts 'Always ' + (((number + 5) * 2 - 4) / 2 - number).to_s\nend",
"def add(a,b)\n p (a + b)\nend",
"def add_three(n)\r\n puts n + 3 \r\nend",
"def add_three(num1, num2, num3)\n result = num1 + num2 + num3\n return result\nend",
"def plus_one(number)\n number + 1\nend",
"def addition (num1, num2)\n\tnum1 + num2\nend",
"def add(x, y)\n return(x + y)\nend",
"def +(x); end",
"def arithmetic1 (n)\nn*5-20\nend",
"def add (x, y)\n return x + y\nend",
"def times_three_and_plus_five(number)\n number * 3 + 5\n end",
"def always_three(num)\n (((num + 5) * 2 - 4) / 2 - num)\nend",
"def add(num1, num2)\n solution = (num1 + num2)\nend",
"def add(x, y)\n result = x + y \nend",
"def numbers(a, b)\n p \"#{a} + #{b}\"\n return a + b\nend",
"def add_it_up\n number = 2 + 2\n puts number\nend",
"def addition(num)\n\treturn num+1\nend",
"def add_three n1, n2, n3\n return n1 + n2 + n3\nend",
"def add (a, b) \n return a + b; \nend",
"def always_three_method(number)\n\t(((number+5)*2 -4)/2 - number)\nend",
"def add( first_number, second_number )\n return first_number + second_number\nend",
"def /(int)\n\t\tself + int\n\tend",
"def addition(a,b)\n puts c = a + b\n end",
"def add(n1, n2)\n\tn1 + n2\nend",
"def expression\r\n # -> uncomment the next line to manually enable rule tracing\r\n # trace_in( __method__, 1 )\r\n result = nil\r\n a = nil\r\n b = nil\r\n\r\n begin\r\n # at line 9:4: a= NUMBER '+' b= NUMBER\r\n a = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_expression_28 )\r\n match( T__6, TOKENS_FOLLOWING_T__6_IN_expression_30 )\r\n b = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_expression_34 )\r\n # --> action\r\n result = a.text.to_i + b.text.to_i \r\n # <-- action\r\n\r\n rescue ANTLR3::Error::RecognitionError => re\r\n report_error(re)\r\n recover(re)\r\n\r\n ensure\r\n # -> uncomment the next line to manually enable rule tracing\r\n # trace_out( __method__, 1 )\r\n\r\n end\r\n \r\n return result\r\n end",
"def addition(num1, num2)\n return num1 + num2\nend",
"def add(first_number, second_number)\n return first_number + second_number\nend",
"def add(first_number, second_number)\n return first_number + second_number\nend",
"def add(first_number, second_number)\n return first_number + second_number\nend",
"def addition(num_1, num_2)\n num_1 + num_2\n return num_1 + num_2\nend",
"def add_two num\n p num + 2\nend",
"def add_three(num1, num2, num3)\nreturn num1 + num2 + num3\nend",
"def add(num_1, num_2)\n\tnum_1 = 2\n\tnum_2 = 3\n\tnum_1 + num_2\nend",
"def add (first_number , second_number)\n return first_number + second_number\nend",
"def add(first_number, second_number)\n return first_number + second_number\nend",
"def exponent_plus(num1, num2)\n total = (num1 ** 2) + num2\n return total\nend",
"def add_3(x, y, z)\n x + y + z\n end",
"def plus(x, y)\n\nend",
"def add_three(num1, num2, num3)\n\tnum1 + num2 + num3\nend",
"def addition(num1, num2)\n num1 + num2\nend",
"def add(num1, num2)\n result = num1 + num2\nend",
"def add(num1, num2)\n result = num1 + num2\nend",
"def add(n1,n2)\n\tn1+n2\nend",
"def plus(number)\n @operation = '+' \n @number = number\nend",
"def +(num)\n old_plus(old_plus(num))\n end",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(first_number, second_number)\n return first_number + second_number\nend",
"def addition(num1, num2)\n p num1 + num2\nend"
] |
[
"0.7626227",
"0.74221385",
"0.7077151",
"0.69432366",
"0.69432366",
"0.69432366",
"0.69432366",
"0.6815046",
"0.67873836",
"0.6780155",
"0.677549",
"0.6746993",
"0.6726859",
"0.6726859",
"0.6726859",
"0.6726859",
"0.67255557",
"0.669436",
"0.66880566",
"0.66735154",
"0.66540515",
"0.6602809",
"0.659479",
"0.65801334",
"0.6571794",
"0.6571794",
"0.6563459",
"0.655452",
"0.65522707",
"0.65522707",
"0.65522707",
"0.6551858",
"0.65463835",
"0.6501559",
"0.64948916",
"0.6491482",
"0.64899385",
"0.6484842",
"0.6484221",
"0.6483446",
"0.6474038",
"0.6473238",
"0.6469429",
"0.6460052",
"0.64587873",
"0.64367557",
"0.6432325",
"0.6431392",
"0.6389483",
"0.63811064",
"0.6370205",
"0.6369627",
"0.6367363",
"0.63637304",
"0.63400227",
"0.6335493",
"0.6335383",
"0.6335186",
"0.6328013",
"0.6325945",
"0.6308108",
"0.62988156",
"0.62922144",
"0.62882257",
"0.6280762",
"0.6275847",
"0.62755406",
"0.62704414",
"0.6258691",
"0.6257175",
"0.6239732",
"0.62352437",
"0.62349534",
"0.6233804",
"0.6233366",
"0.62301004",
"0.6217559",
"0.6217559",
"0.6217559",
"0.6211654",
"0.6207587",
"0.6203788",
"0.6201727",
"0.6201596",
"0.6201037",
"0.6195129",
"0.619116",
"0.6191151",
"0.6187171",
"0.6186861",
"0.61860293",
"0.61860293",
"0.61859345",
"0.6179809",
"0.6159963",
"0.615754",
"0.615754",
"0.615754",
"0.615754",
"0.6157292",
"0.6151345"
] |
0.0
|
-1
|
Any action against the Functor is processesd by the function.
|
def method_missing(op, *args, &blk)
@function.call(op, *args, &blk)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fmap(*)\n raise NotImplementedError\n end",
"def functor_t\n raise NotImplementedError\n end",
"def process(action, *args); end",
"def apply( data, type, &block )\n @applyhash = self.applyhash\n if not @applyhash.key? type\n Kernel::raise(\"FloatFunctor::apply no regsitration for type #{type} and object #{self.inspect}\")\n else\n return self.send(@applyhash[type], data, &block )\n end\n end",
"def map(func)\n\t\tif (!@head) then return end\n\t\tcurrent = @head\n\t\twhile (current)\n\t\t\tcurrent.alter(func)\n\t\t\tcurrent = current.get_next()\n\t\tend\n\tend",
"def lambda; end",
"def fmap(fn=nil, &block)\n self.class.return( call(fn || block) )\n rescue => e\n self.class.fail(e)\n end",
"def perform_action(data); end",
"def apply_filters( value, args )\n return value if @callbacks.blank?\n\n @nesting_level += 1\n @iterations[@nesting_level] = @callbacks.keys\n num_args = args.length\n\n @iterations[@nesting_level].each do |priority|\n @current_priority[@nesting_level] = priority\n\n @callbacks[priority].each do |the_|\n\n args[0] = value unless @doing_action\n\n # Avoid the array_slice if possible.\n if the_[:accepted_args] == 0\n value = the_[:function].call\n elsif the_[:accepted_args] >= num_args\n value = the_[:function].call(args)\n else\n value = the_[:function].call(args.slice(0, the_[:accepted_args]))\n end\n end\n end\n @iterations.delete(@nesting_level)\n @current_priority.delete(@nesting_level)\n\n @nesting_level -= 1\n\n value\n end",
"def apply()\n end",
"def process_action(*_arg0); end",
"def process_action(*_arg0); end",
"def process_action(*_arg0); end",
"def apply_to_all(arg)\r\n\treturn lambda{|x| x.map{ |z| arg.call(z)}}\r\nend",
"def process_action(method_name, *args); end",
"def compute( &math_func )\n math_func.call( 3, 5 )\nend",
"def call(f)\n CAS::Help.assert(f, Hash)\n p = 1\n @x.each do |y|\n p = p.overloaded_mul(y.call(f))\n end\n p\n end",
"def function(*x)\n val = (self.memoize ? memoized(*x) : process(*x))\n self.notify_observers(val)\n val\n end",
"def factions\n \n end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def map(list, &function)\n list.reduce([]) do |acc, val|\n acc.push function.call(val)\n end\nend",
"def fn\n Fn\n end",
"def postproc=(_arg0); end",
"def dispatch(*_arg0); end",
"def lambda=(_); end",
"def convert_to_functor(pattern_or_functor)\n case pattern_or_functor\n when FunctorExpression then pattern_or_functor\n else\n p = pattern_or_functor\n if p.optional? || p.context\n raise ArgumentError.new(\"Can't translate #{p} to Prolog functor\")\n end\n FunctorExpression.new('q-', p.subject, p.predicate, p.object)\n end\n end",
"def perform_if_needed(**action_parameters)\n return if performed?(**action_parameters)\n\n yield\n\n mark_performed(**action_parameters)\n end",
"def dispatch action\n @action = action\n\n invoke do\n filter(*before_filters_for(action))\n args = action_arguments action\n __send__(action, *args)\n end\n\n rescue => err\n invoke{ handle_error err }\n ensure\n filter(*after_filters_for(action))\n end",
"def reduce\n _reduce = ->(acc, f, xs){\n xs == [] ? acc : _reduce.(f.(acc, xs[0]), f, xs[1..-1])\n }\n\n curry.(->(f, xs) {\n _reduce.(xs[0], f, xs[1..-1])\n })\n end",
"def each_object( &action )\n @objs.each { |o| action.call( o ) }\n end",
"def for(operation); end",
"def fmapr_compose\n ->(*fns) {\n -> x { fns.reverse.inject(x) {|x, fn| x.success? ? x.fmap(fn).value_or : x} }\n }\n end",
"def double(callable)\n callable.call * 2\nend",
"def map( &proc ) # this is a wrapper, which saves the given block\n\t\ttraverse( proc )\n\tend",
"def processor=(_arg0); end",
"def non_index_dispatch\n if binary?\n run(Binary)\n return\n elsif unary?\n run(Unary)\n return\n end\n regular_dispatch\n end",
"def apply(raw_event); end",
"def filter(&callable)\n filters << callable\n end",
"def act_fun(pnum, jnum, signal, signal_hash, nodes, jokes)\n\talpha_decay = 1.5\n\tbegin\n\t\tsh = signal_hash[[jnum,pnum]]\n\t\tdiv_factor = signal.to_f ** alpha_decay\n\t\tnd = normdist(jokes[jnum],nodes[pnum])\n\t\tout = sh * ((nd * 2) / div_factor) / sh\n\t\tout\n\trescue\n\t\t0\n\tend\nend",
"def apply_filter\n end",
"def apply\n end",
"def _dispatch(action=:to_s)\n hook :before_dispatch\n self.action_name = action\n \n caught = catch(:halt) do\n start = Time.now\n result = _call_filters(_before_filters.reverse)\n @_benchmarks[:before_filters_time] = Time.now - start if _before_filters\n result\n end\n \n @body = case caught\n when :filter_chain_completed then _call_action(action_name)\n when String then caught\n when nil then _filters_halted\n when Symbol then send(caught)\n when Proc then caught.call(self)\n else\n raise MerbControllerError, \"The before filter chain is broken dude. wtf?\"\n end\n start = Time.now\n _call_filters(_after_filters) \n @_benchmarks[:after_filters_time] = Time.now - start if _after_filters\n hook :after_dispatch\n end",
"def multiple_lambda(arg)\n puts [1,2,3].map { |x| arg.call(x) }\nend",
"def arithmetic_proc(target)\n # Fooled you! I metaprogrammed it to save some typing!\n end",
"def duas1(action)\n action.call\n action.call\nend",
"def selected_map!(arr, proc_1, proc_2)\r\n arr.each_with_index { |el, i| arr[i] = proc_2.call(el) if proc_1.call(el) }\r\n nil\r\nend",
"def process_iter(exp)\n if exp.first.last == :lambda\n process_lambda_iter exp\n else\n process_regular_iter exp\n end\n end",
"def proc_factor(factor)\n Proc.new { |x| x * factor }\nend",
"def process(*)\n end",
"def process(*)\n end",
"def call(f)\n CAS::Help.assert(f, Hash)\n p = 0\n @x.each do |y|\n p = p.overloaded_plus(y.call(f))\n end\n p\n end",
"def _dispatch(action)\n _run_filters(:before, action)\n response = send(action)\n _run_filters(:after, action)\n response\n end",
"def on_iter( node )\n descend( node )\n target, args, block = node\n \n func = build_function( args, block )\n block.delete!\n \n case target.type\n when CALL, NEW\n arg_node = target.last\n if placeholder = arg_node.find { | child | child.type == FUNC_ARG }\n placeholder.replace!( func )\n else\n append_argument( arg_node, func )\n end\n else\n if target.type == ID and target.text == 'eval'\n node.replace!( \"(#{ func })()\" )\n else\n target.append!( '( ' << func << ' )' )\n end\n end\n end",
"def apply_method(x, &cb)\n cb.call(x)\nend",
"def test2 &action\n puts \"Testing:\\n\\n\"\n action.call\n end",
"def double(callable_object)\n callable_object.call * 2\nend",
"def process(data, object)\n data[:function].blank? ? object.to_s : send(data[:function].to_sym, object.to_s)\n end",
"def double(callable_object)\n callable_object.call * 2\nend",
"def double(callable_object)\n callable_object.call * 2\nend",
"def double(callable_object)\n callable_object.call * 2\nend",
"def invoke; end",
"def function\n block.function\n end",
"def run(function, arguments)\n\t\t\t\taction = function[0]\n\t\t\t\tfunction = function_for(function)\n\n\t\t\t\tself.send(action, function, *arguments)\n\t\t\tend",
"def map_values!(hash, fn)\n hash.each { |key, value| hash[key] = fn[value] }\n hash\n end",
"def ll_map(function) \n current = 0\n current_node = @head\n\n while current < @num_nodes\n current_node.set_Data(function.call(current_node.get_Data()))\n current_node = current_node.get_Next()\n current += 1\n end\n end",
"def each(&a_proc); end",
"def process(*)\n end",
"def _perform(args); end",
"def non_index_dispatch\n case\n when binary_operator?\n run(Binary)\n when attribute_assignment?\n run(AttributeAssignment)\n else\n normal_dispatch\n end\n end",
"def on_transform(&blk)\n @transform_handler = blk\n self\n end",
"def functional_interactions\n (1..9).to_a.inject(FunctionalNoOp) { |interaction, _| interaction | FunctionalNoOp }\nend",
"def run\n begin\n coll = @klass.collection.map_reduce(formula.map, formula.reduce, { :query => @selector, :out => \"#map_reduce\" } ).find.to_a\n rescue\n raise \"Error: could not execute map reduce function\"\n end\n\n formula.process(coll)\n end",
"def op; end",
"def visitEachContact(func)\n\t\t@dataArray.each do |singleEntry|\n\t\t\tfunc.call(singleEntry)\n\t\tend\n\t\n\tend",
"def map\n C.curry.(\n ->(f, xs) {\n _f = ->(acc, x) {\n concat.(acc, [f.(x)])\n }\n\n C.fold.([], _f, xs)\n }\n )\n end",
"def apply; nil; end",
"def my_map_p(proc)\n\t\tresults = []\n\t\tself.my_each do |item|\n\t\t\tresults << proc.call(item)\n\t\tend\n\t\tresults\n\tend",
"def f\n end",
"def reducer; end",
"def selected_map!(arr, proc_1, proc_2)\n arr.each.with_index do |ele, idx|\n if proc_1.call(ele)\n arr[idx] = proc_2.call(ele)\n end\n end\n nil\nend",
"def lift\n ->(f, with, i) { f.(i) ? with.(i) : nil }.curry\n end",
"def list_to_action(e)\n if atom? e\n if e == :quote\n @quote\n elsif e == :lambda\n @lambda\n elsif e == :cond\n @cond\n end\n else\n @application # -> will become a function\n end \n end",
"def reduce_function\n 'function (key, values) { return reduce(key, values);};'\n end",
"def compose(f)\n if self.respond_to?(:arity) && self.arity == 1\n lambda { |*args| self[f[*args]] }\n else\n lambda { |*args| self[*f[*args]] }\n end\n end",
"def uncurry\n Functors.uncurry(&self)\n end",
"def apply(fn, x, a)\n if atom?(fn)\n case fn\n when :car then caar(x)\n when :cdr then cdar(x)\n when :cons then cons(car(x), cadr(x))\n when :atom then atom?(car(x))\n when :eq then car(x) == cadr(x)\n else\n apply(eval_one(fn,a), x, a)\n end\n elsif car(fn) == :lambda\n eval_one(caddr(fn), pairlis(cadr(fn), x, a))\n elsif car(fn) == :label\n apply(caddr(fn), x, cons(cons(cadr(fn), caddr(fn)), a))\n end\nend",
"def do_action(tag, *arg )\n # global $wp_filter, $wp_actions, $wp_current_filter\n # TODO continue\n end",
"def on_tlambda *xs\n unless @found\n @level += 1\n end\n super\n end",
"def compose(other)\n Functors.compose(self, other)\n end",
"def action_processed(_action)\n @entities.each(&:unpass!)\n end",
"def map_value!(hash, key, fn)\n hash.update(key => fn[hash[key]])\n end",
"def perform(action, data = T.unsafe(nil)); end",
"def accept=(_arg0); end",
"def preproc=(_arg0); end",
"def map_or_apply(unknown_object, function)\n unknown_object.is_a?(Array) ? unknown_object.map(&function) : function.(unknown_object)\n end",
"def map_or_apply(unknown_object, function)\n unknown_object.is_a?(Array) ? unknown_object.map(&function) : function.(unknown_object)\n end",
"def my_map(proc)\n return_array = []\n self.my_each do |item|\n return_array << proc.call(item)\n end\n return_array\n end",
"def unop!(meth); map!{|i| meth.call(i)}; end",
"def f\n yield\n end",
"def f\n yield\n end"
] |
[
"0.57064384",
"0.567832",
"0.5631018",
"0.5564093",
"0.5480766",
"0.5422048",
"0.53626895",
"0.53556687",
"0.53132975",
"0.53109384",
"0.53052485",
"0.53052485",
"0.53052485",
"0.5275732",
"0.5275103",
"0.514948",
"0.51464474",
"0.51301265",
"0.51165277",
"0.510714",
"0.510714",
"0.5100588",
"0.50944734",
"0.50932777",
"0.50800514",
"0.5072262",
"0.5047309",
"0.5038444",
"0.50365317",
"0.5034766",
"0.50341165",
"0.50259453",
"0.5022515",
"0.5018784",
"0.5008061",
"0.500647",
"0.49993145",
"0.49946055",
"0.49921265",
"0.49763232",
"0.4969716",
"0.4958216",
"0.4942477",
"0.4917876",
"0.49116302",
"0.4901464",
"0.48980516",
"0.48938128",
"0.489244",
"0.48896956",
"0.48896956",
"0.48868385",
"0.4883861",
"0.48820356",
"0.48793727",
"0.4878744",
"0.4877683",
"0.48670802",
"0.48642626",
"0.48642626",
"0.48642626",
"0.48535687",
"0.48497102",
"0.4848501",
"0.48482513",
"0.48441762",
"0.4844156",
"0.48426837",
"0.48387745",
"0.48387283",
"0.48306057",
"0.48250413",
"0.48239008",
"0.48228824",
"0.4817295",
"0.48101",
"0.48062253",
"0.47954342",
"0.47944894",
"0.47931832",
"0.47885633",
"0.4785245",
"0.47842127",
"0.4782709",
"0.47690058",
"0.4761089",
"0.4760372",
"0.4758266",
"0.4757989",
"0.47569808",
"0.47508028",
"0.47497255",
"0.4749316",
"0.47473615",
"0.47441903",
"0.47355124",
"0.47355124",
"0.47340077",
"0.4732298",
"0.4724416",
"0.4724416"
] |
0.0
|
-1
|
Initializes a new Session object
|
def initialize(attributes = {})
@access_token = attributes['access_token']
@refresh_token = attributes['refresh_token']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(session); end",
"def init_session\n if session\n if session.updated_at < Time.now - ::Gricer.config.max_session_duration\n self.session = Session.create previous_session: session, ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n else\n self.session.touch\n end\n else\n self.is_first_in_session = true\n self.session = Session.create ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n self.session.touch\n end\n \n session\n end",
"def initialize(session)\n self.session = session\n end",
"def initialize(session)\n @session = session\n end",
"def initialize(session)\n @session = session\n end",
"def initialize(session)\n @session = session\n end",
"def new\n @session = Session.new\n end",
"def new\n @session = Session.new('')\n end",
"def initialize\n\t\t\t\tcgi = CGI.new('html4')\n\n\t\t\t\t# We make sure to delete an old session if one exists,\n\t\t\t\t# not just to free resources, but to prevent the session\n\t\t\t\t# from being maliciously hijacked later on.\n\t\t\t\tbegin\n\t\t\t\t\t@session = CGI::Session.new(cgi, 'database_manager' => CGI::Session::PStore, 'new_session' => false)\n\t\t\t\t\t@session.delete\n\t\t\t\trescue ArgumentError # if no old session\n\t\t\t\tend\n\t\t\t\t@session = CGI::Session.new(cgi, 'database_manager' => CGI::Session::PStore, 'new_session' => true)\n\t\t\t\t@session['datastore'] = {}\n\t\t\tend",
"def new\n @session = Session.new\n end",
"def initialize(session, option=nil)\n @session = Session.find_first([\"sessid = '%s'\", session.session_id])\n if @session\n @data = @session.data\n else\n @session = Session.new(\"sessid\" => session.session_id, \"data\" => {})\n end\n end",
"def initialize(params)\n @params = params\n @sessions = {}\n end",
"def initialize(session, request_id)\n @session = session\n @request_id = request_id\n\n session[SESSION_KEY] ||= {}\n session[SESSION_KEY][request_id] ||= {}\n end",
"def initialize_session\n query_data = {\n \"IsHacked\" => @is_hacked,\n \"DeviceGenerationInfo\" => @device_generation_info,\n \"PublisherSDKVersion\" => @publisher_sdk_version,\n \"IsUsingSdk\" => @is_using_sdk,\n \"PublisherUserId\" => @publisher_user_id,\n \"OSVersion\" => @os_version,\n \"ClientIp\" => @client_ip,\n \"UDIDs\" => parse_udids, \n \"AppId\" => @app_id,\n \"IsOnCellular\" => @is_on_cellular\n }\n \n @raw_data = post_request(@api_url, query_data.to_json)\n @session = W3i::SessionData.new(@raw_data)\n\n true\n end",
"def initialize(session, option=nil)\n if @session = @@session_class.find_session(session.session_id)\n @data = unmarshalize(@session.data)\n else\n @session = @@session_class.create_session(session.session_id, marshalize({}))\n @data = {}\n end\n end",
"def initialize(sessions)\n @sessions = sessions\n end",
"def initialize( * )\n\t\tsuper\n\t\t@session = nil\n\t\t@session_namespace = nil\n\tend",
"def initialize(session, options = T.unsafe(nil)); end",
"def initialize(session, options = T.unsafe(nil)); end",
"def initialize_session\n puts 'initializing session with client'\n end",
"def initialize(session = :default)\n self.session = Mongoid::Sessions.with_name(session)\n rescue => e\n # client/session not configured\n end",
"def initialize_session\n response = @savon.call :initialize_session\n # Without ActiveSupport\n # 1.hour.from_now is 3600 seconds from Time.now\n @session_expiry_time = Time.now + 3600\n @session_id = response.body[:initialize_session_response][:initialize_session_result]\n end",
"def initialize(session)\n @now = session || Hash.new\n @next = Hash.new\n super(@now)\n end",
"def initialize(session, option=nil)\n @session_id = session.session_id\n unless GLOBAL_HASH_TABLE.key?(@session_id)\n unless session.new_session\n raise CGI::Session::NoSession, \"uninitialized session\"\n end\n GLOBAL_HASH_TABLE[@session_id] = {}\n end\n end",
"def init\n if @read_session\n @session_id = self[:session_id]\n @author_id = self[:author_id]\n @visits = self[:visits]\n @updated_at = self[:updated_at]\n @created_at = self[:created_at]\n @id = self[:id]\n else\n self[:session_id] = SessionCredential.generate_id\n self[:author_id] = SessionCredential.generate_id\n @session_id = self[:session_id]\n @author_id = self[:author_id]\n @visits = self[:visits]\n @updated_at = self[:updated_at]\n @created_at = self[:created_at]\n @id = self[:id]\n end\n end",
"def initialize_session(params_hash)\n raise_error_unless_params_is_a_hash(params_hash)\n raise_error_if_params_are_empty(params_hash)\n request.method = :post\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def initialize\n @session = {}\n @flash = {}\n end",
"def initialize( request )\n @request = request\n @data ||= ( File.exist?( session_path ) ? load_session : {} )\n end",
"def init\n @session_id = SecureRandom.uuid\n request(:init, '{\"init\":\"none\"}')\n end",
"def session #:nodoc:\n @session ||= Session.new\n end",
"def initialize(session_id = nil, map_state = nil)\n if session_id.blank?\n create_session\n else\n @session_id = session_id\n end\n \n if map_state\n @map_state = map_state\n end\n end",
"def initialize(session = :default)\n if Mongoid.respond_to?(:clients) # Mongoid 5\n self.session = Mongoid::Clients.with_name(session)\n elsif Mongoid.respond_to?(:sessions) # Mongoid 4\n self.session = Mongoid::Sessions.with_name(session)\n end\n rescue => e\n # client/session not configured\n end",
"def initialize_session\n # When setting a value, using ||= sets the default value\n # EX:// cart ||= 0 will initialize the variable and default to zero\n # if no value exists for cart\n session[:user_cart] ||= []\n session[:item_quantity] ||= {}\n end",
"def init_session\n init_language\n set_page_cache_directory\n init_views\n init_votes\n init_cookies\n end",
"def initialize(session)\n @session = session\n @keep = false\n\n session[KEPT_KEY] ||= []\n session[SESSION_KEY] = {}\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def initialize_session\n response = @soap_client.call :initialize_session\n # Without ActiveSupport\n # 1.hour.from_now is 3600 seconds from Time.now\n @session_expiry_time = Time.now + 3600\n @session_id = response.body[:initialize_session_response][:initialize_session_result]\n end",
"def build_session\n # If it's empty assume user doesn't need session attributes.\n @session_attributes = Hash.new if @session_attributes.nil?\n @session = { :sessionAttributes => @session_attributes }\n @session\n end",
"def initialize(session)\n @session = session\n on_start\n true\n end",
"def session\n @session ||= Session.new( req )\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(@req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def session\n @session ||= Session.new(req)\n end",
"def initialize_session\n Session.create(sc: @sc, msisdn: @msisdn, session_id: @session_id, req_no: @req_no)\n @response = Registration.subscription_selection(@screen_id)\n end",
"def new\n @session = User::Session.new\n end",
"def load_session\n session = Session.new(nil, nil)\n if session.load\n @session = session ; true\n end\n end",
"def initialize(session_id = nil, auth_token = nil)\n @session_id, @auth_token = session_id, auth_token\n end",
"def session\n @session ||= Session.new(req)\n end",
"def new_session\n open_session do |sess|\n sess.extend(SessionMethods)\n yield sess if block_given?\n end\n end",
"def create_session\n @connection.create_session(@config || {})\n end",
"def set_session\n \n end",
"def init_session\n before do\n path = defined?(init_session_path) ? init_session_path : '/'\n get(path)\n end\n end",
"def initialize(app, session)\n super(app)\n @session = session\n @session.reset!\n end",
"def initialize(session)\n raise Copy::AuthenticationError unless session.valid?\n @session = session\n self\n end",
"def session\n @session ||= OpenStruct.new\n end",
"def initialize(session_id, options = nil)\r\n RAGI.LOGGER.debug(\"creating ragi session with id=#{session_id}\")\r\n\r\n standard_options = {\r\n # This tells the base class where to look in the request_hash\r\n \"session_key\" => \"session_id\",\r\n\r\n # Disable output\r\n \"no_hidden\" => true,\r\n \"no_cookies\" => true,\r\n \r\n # Create a new session iff there is not an existing session id\r\n \"new_session\" => (session_id == nil)\r\n }\r\n\r\n full_options = DEFAULT_OPTIONS.merge(standard_options)\r\n full_options.merge!(options) if options\r\n\r\n # Convert all keys to strings\r\n full_options.keys.each do |key|\r\n full_options[key.to_s] = full_options.delete(key) if key.class != String\r\n end\r\n\r\n request_hash = { \"session_id\" => session_id }\r\n super(request_hash, full_options)\r\n end",
"def initialize(version = '1.0')\n @session_attributes = Hash.new\n @version = version\n end",
"def initialize_session\n session[:cart] ||= []\n end",
"def initialize_session\n session[:cart] ||= []\n end",
"def create_session\n Puppet::HTTP::Session.new(self, build_resolvers)\n end",
"def initialize(session)\n @session = session\n @builder = Query.new\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def session=(_arg0); end",
"def session\n @session ||= Session.new(@request)\n end",
"def session\n @session ||= Session.new(request)\n end",
"def session\n @session ||= {}\n end",
"def session\n @session ||= Session.new(@request)\n @session\n end",
"def initialize(session, marshaller)\n raise ArgumentError('session is required') if session.nil?\n raise ArgumentError('marshaller is required') if marshaller.nil?\n\n @session = session\n @marshaller = marshaller\n end",
"def session\r\n @session ||= {}\r\n end",
"def initialize(session)\n @session = session\n @session[:cart] = [] unless @session[:cart]\n end",
"def initialize_session\n # Save the thread incase we need to forcibly kill it\n @puppet_thread = Thread.current\n @puppet_thread_id = @puppet_thread.object_id.to_i\n end",
"def session\n @session ||= Puffs::Session.new(req)\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = Session.find(params[:id])\n end",
"def set_session\n @session = current_session\n end",
"def init \n\t\t\t@user_id, user_name = \"SELECT user_id, user_name FROM BULK_USER WHERE user_id=? AND user_pwd=?\", @user_name, @password\n\t\t\tif !@user_id || !user_name\n\t\t\t\traise \"login denied\"\n\t\t\tend\n\n\t\t\t@session_token = class.generateSessionToken @user, @client_ip\n\t\t\t\n\t\t\t\"INSERT INTO bulk_session (session_token, user_id, since, last_seen, ip_address)\n\t\t\t\tVALUES (?, ?, date('now'), date('now'), ?)\", @session_token, user_id, @client_ip\n\n\t\t\t@session_id= 'SELECT last_inserted_value'\n\t\t\t\n\t\tend",
"def new(*)\n # return new mock session\n BunnyMock::Session.new\n end",
"def new(api_key = nil, secret_key = nil, session_key = nil)\n Session.create(api_key, secret_key, session_key)\n end",
"def initialize(session, params)\n @session = session\n # Set up all non-included fields to be the empty string\n param_fields_with_default = SOURCE_FIELDS.inject({}) do |obj, field|\n obj[field] = (params[field] || '')\n obj\n end\n \n # Set up mixpanel_guid\n @session['mixpanel_guid'] ||= (params['mixpanel_guid'] || SecureRandom.uuid)\n @session.reverse_merge!(param_fields_with_default)\n end",
"def new\n\t\t@user_session = UserSession.new\n\tend"
] |
[
"0.82180506",
"0.79475015",
"0.78998554",
"0.78190297",
"0.78190297",
"0.78190297",
"0.77705884",
"0.7679515",
"0.7535753",
"0.7535098",
"0.7491678",
"0.74459237",
"0.74120414",
"0.7377829",
"0.73428303",
"0.7336974",
"0.73125815",
"0.7310738",
"0.7310738",
"0.7308767",
"0.725125",
"0.7223247",
"0.7211487",
"0.71892345",
"0.7171782",
"0.7160407",
"0.7154205",
"0.7133309",
"0.71184653",
"0.71171826",
"0.7055819",
"0.7033146",
"0.7010984",
"0.7008017",
"0.6971623",
"0.6938812",
"0.6938812",
"0.6938812",
"0.69319576",
"0.69251275",
"0.691863",
"0.6915477",
"0.6915247",
"0.6915247",
"0.6914998",
"0.6914998",
"0.6914998",
"0.6914998",
"0.6914998",
"0.6902367",
"0.6900161",
"0.6879703",
"0.68764484",
"0.68755645",
"0.6870187",
"0.68475544",
"0.68456566",
"0.6838245",
"0.68378496",
"0.68330187",
"0.6725798",
"0.672042",
"0.67194676",
"0.6677336",
"0.6677336",
"0.6672239",
"0.6655572",
"0.6652136",
"0.66518486",
"0.66489804",
"0.6636604",
"0.6626504",
"0.6618765",
"0.6617768",
"0.6615392",
"0.66133034",
"0.66104597",
"0.6603863",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.659933",
"0.6577895",
"0.65774035",
"0.6569049",
"0.6566407",
"0.65659785",
"0.6557488"
] |
0.0
|
-1
|
Obtain hash with access_token and refresh_token
|
def hash
return {} unless access_token && refresh_token
return {
'access_token' => access_token,
'refresh_token' => refresh_token
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hash\n [grant_type, code, refresh_token, redirect_uri, client_id, client_secret].hash\n end",
"def build_token_hash\n { 'access_token' => access_token }\n end",
"def fetch_token_from_hash(refresh_token)\n @access_token_obj = OAuth2::AccessToken.from_hash(@auth_client,\n :refresh_token => refresh_token).refresh!\n end",
"def hash\n [expires_in, data, access_token, refresh_token, scope, token_type].hash\n end",
"def get_access_token\n token_hash = Hash.new\n token_obj = get_access_token_json\n if token_obj.response.code.to_i == 200\n response_json = JSON.parse token_obj.response.body\n token_hash[\"access_token\"]= response_json[\"access_token\"]\n token_hash[\"token_type\"]= response_json[\"token_type\"]\n end\n return token_hash\n end",
"def hash\n [access_token_url, audience, client_id, client_secret, resource, scope, token_api_authentication, type].hash\n end",
"def get_json_hash(url)\n JSON.parse(@access_token.get(url).body)\nend",
"def create_access_token\n hash = nil\n Songkick::OAuth2.generate_id do |token|\n hash = Songkick::OAuth2.hashify(token) \n end\n return hash\n end",
"def token_hash(auth_code = T.unsafe(nil), headers = T.unsafe(nil)); end",
"def from_refresh_token(hash)\n refresh_token, client_id, client_secret, redirect_uri =\n requiring(hash, :refresh_token, :client_id,\n :client_secret, :redirect_uri)\n\n Authentication::OAuth2::AccessTokenAuthentication\n .from_refresh_token(refresh_token,\n client_id: client_id,\n client_secret: client_secret,\n redirect_uri: redirect_uri)\n end",
"def to_hash\n {\n access_token: access_token,\n refresh_token: refresh_token,\n expires_in: expires_in,\n expires_at: expires_at.iso8601\n }\n end",
"def create_refresh_token(client)\n verified_client = Oauth2Client.find_by_client_id(client.client_id)\n Songkick::OAuth2.generate_id do |refresh_token|\n if verified_client\n hash = Songkick::OAuth2.hashify(refresh_token)\n else\n hash = nil\n end\n end\n return hash\n end",
"def to_hash\n params.merge(:access_token => token, :refresh_token => refresh_token, :expires_at => expires_at)\n end",
"def ACCESS_TOKEN\n return '74d84308fb5a4bc795ab17b87c46e0e5'\n end",
"def fresh_token\n refresh! if expired?\n access_token\n end",
"def refresh_token\n end",
"def fresh_token\n refresh! if token_expired?\n access_token\n end",
"def access_token\n @access_token ||= ShakeTheCounter::Authentication.renew_access_token(client_id: id, client_secret: secret, refresh_token: refresh_token)[\"access_token\"]\n end",
"def latest_refresh_token\n credentials.refresh_token\n end",
"def digest\n Digest::MD5.hexdigest(id.to_s+Interactiff::Application.config.secret_token).to_i(16).to_s[3,8]\n end",
"def find_oauth_access_token\n end",
"def do_auth data_hash\n url = \"#{@@oauth_info[:oauth_url]}/access_token\"\n ssl = @@ssl\n headers = {:content_type => \"application/x-www-form-urlencoded;charset=UTF-8\"}\n\n conn = Faraday.new(:url => url, :ssl => ssl) do |faraday|\n faraday.request :url_encoded\n faraday.adapter Faraday.default_adapter\n faraday.response :logger\n end\n\n response = conn.post url, data_hash, headers\n if response.status == 200\n res_hash = JSON.parse response.body\n @access_token = res_hash[\"access_token\"]\n @refresh_token = res_hash[\"refresh_token\"]\n @expires_at = res_hash[\"expires_in\"].seconds.from_now\n return true\n else\n return false\n end\n end",
"def hash\n [type, page_access_token, app_id, app_secret, account_sid, auth_token, phone_number_sid, token, channel_access_token, encoding_aes_key, from_address, certificate, password, auto_update_badge, server_key, sender_id, consumer_key, consumer_secret, access_token_key, access_token_secret].hash\n end",
"def access_token\n refresh! if access_token_expires_at&.<= Time.now + 60 # time drift margin\n @access_token\n end",
"def refresh(access_token)\n new_access_token = access_token.client.access_token!\n expires = Time.zone.at(decode_id_token(new_access_token.id_token).exp).to_datetime\n\n {\n access_token: new_access_token.access_token,\n expires_at: expires\n }\n rescue Rack::OAuth2::Client::Error\n # Refresh token was expired\n {}\n end",
"def http_auth_hash; end",
"def access_token_secret\n credentials['secret']\n end",
"def access_token\n @auth.access_token\n end",
"def access_token\n Rails.cache.fetch(\"googl_access_token\", expires_in: 50.minutes) do \n request = { query: { client_id: ENV['GOOGL_CLIENT_ID'],\n client_secret: ENV['GOOGL_CLIENT_SECRET'],\n refresh_token: ENV['GOOGL_REFRESH_TOKEN'],\n grant_type: \"refresh_token\"} }\n\n result = self.class.post(\"/oauth2/v3/token\", request)\n\n result.parsed_response[\"access_token\"]\n end\n end",
"def refresh_token\n self.generate_token\n end",
"def c_hash\n sha256 = Digest::SHA256.new\n token = @code.token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end",
"def access_token\n end",
"def get_sig(access_token)\n\t\tmethod_str = 'application_key=' + @options['application_key'] + 'method=users.getCurrentUser'\n\t\tDigest::MD5.hexdigest(method_str + Digest::MD5.hexdigest(access_token + @options['client_secret']))\n\tend",
"def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('/services/api/json/1.2.2/?method=smugmug.auth.checkAccessToken').body)['Auth']['User']\n end",
"def refresh_token\n @auth.refresh_token\n end",
"def token_hash\n { api_token: @api_token }\n end",
"def access_token_was_refreshed; end",
"def access_token\n api_key.access_token rescue \"\"\n end",
"def get_RefreshToken()\n \t return @outputs[\"RefreshToken\"]\n \tend",
"def get_RefreshToken()\n \t return @outputs[\"RefreshToken\"]\n \tend",
"def access_token\n creds = JSON.parse(File.read(FILE_CREDS))\n authorization = Google::Auth::UserRefreshCredentials.new(\n client_id: creds['installed']['client_id'],\n client_secret: creds['installed']['client_secret'],\n scope: SCOPE,\n refresh_token: refresh_token,\n expires_at: (Time.now+100).utc,\n grant_type: 'authorization_code')\n authorization.fetch_access_token!\n authorization.access_token\nend",
"def access_token\n @access_token\n end",
"def access_token\n @data[:access_token]\n end",
"def oauth_access_token\n session[:access_token]\n end",
"def get_token\n consumer = OAuth::Consumer.new('jzICjLlLF3dLrGVaVal0w', '3ydl3o44K4MaR8sFAk2gWtTTzHfFc7PzZjelP0XIoik', {\n :site => 'https://api.twitter.com',\n :scheme => :header\n })\n token_hash = {\n :oauth_token => '14615533-Qy2ck9vrfqsNdUp5cGi5PpHyrqBRmh7aXP6qcUr9w',\n :oauth_token_secret => 'tECZ96ci1nXrvs3OkxSEbZyQtngQWslhgGeuTgEFJwU'\n }\n\n OAuth::AccessToken.from_hash(consumer, token_hash)\nend",
"def get_token_from_hash(hash)\n access_token = hash.delete('access_token') || hash.delete(:access_token) || hash.delete('oauth_token') || hash.delete(:oauth_token)\n access_token_opts = {:expires_at => hash[\"expires\"] || hash[:expires],\n :header_format => \"OAuth2 %s\",\n :param_name => \"access_token\"}\n\n @token = OAuth2::AccessToken.new(self, access_token, access_token_opts)\n end",
"def token\n return @access_token if @access_token && !needs_refresh?\n\n update_access_token\n @access_token\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def oauth_hash\n {\n :consumer_key => consumer_key || Bountybase.config.twitter_app[\"consumer_key\"],\n :consumer_secret => consumer_secret || Bountybase.config.twitter_app[\"consumer_secret\"],\n :oauth_token => oauth_token,\n :oauth_token_secret => oauth_secret\n }\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def get_access_token\n auth = storage['authentication']\n return auth['access_token'] if auth && auth['expires'] > Time.now.to_i\n\n auth = authenticate_client\n storage['authentication'] = auth\n auth['access_token']\n end",
"def refresh_token\n @token = @authenticator.refresh_token\n end",
"def get_access_token\n response = RestClient.post(\"#{API_URL}/authentication/v1/authenticate\",\n { client_id: Rails.application.secrets.FORGE_CLIENT_ID,\n client_secret: Rails.application.secrets.FORGE_CLIENT_SECRET,\n grant_type:'client_credentials',scope:'data:read data:write bucket:create'\n \n })\n return JSON.parse(response.body)['access_token']\n end",
"def get_NewRefreshToken()\n \t return @outputs[\"NewRefreshToken\"]\n \tend",
"def get_NewRefreshToken()\n \t return @outputs[\"NewRefreshToken\"]\n \tend",
"def get_token_from_hash(hash)\n access_token = hash.delete('access_token') || hash.delete(:access_token) || hash.delete('oauth_token') || hash.delete(:oauth_token)\n opts = {:expires_at => hash[\"expires\"] || hash[:expires],\n :header_format => \"OAuth2 %s\",\n :param_name => \"access_token\"}\n\n @token = AccessToken.new(self, access_token, opts)\n end",
"def getSig(access_token)\n\t\t\t\tmethodStr = 'application_key=' + @options['application_key'] + 'method=users.getCurrentUser'\n\t\t\t\tDigest::MD5.hexdigest(methodStr + Digest::MD5.hexdigest(access_token + @options['client_secret']))\n\t\t\tend",
"def validate_token_hash\n if @token_request_at and\n @token_hash and @token_hash['expires_in'] and\n (Time.now - @token_request_at) > @token_hash['expires_in'].to_i\n @token_hash = nil\n elsif @token_request_at and\n @token_hash and @token_hash['expires_in']\n @token_hash['access_token']\n else\n puts \"start get token ...\"\n end\n end",
"def cached_access_token(config)\n File.read(config.access_token_filename).chomp\n end",
"def access_token\n @config[\"token\"]\n end",
"def cached_refresh_token(config)\n File.read(config.refresh_token_filename).chomp\n end",
"def get_access_token\n\t\treturn @credentials.get_access_token\n\tend",
"def identity_hash\n request.env['omniauth.auth']\n end",
"def get_access(params: nil, host:)\n result = TokenAdapter.new.(client_id: ENV['CLIENT_ID'],\n secret: ENV['CLIENT_SECRET'],\n code: params[:code],\n code_verifier: extract_verifier(params),\n redirect_uri: redirect_callbacks_url(host: host))\n {id_token: validate_id_token(result[\"id_token\"]), result: result}\n end",
"def token\n Digest::MD5.hexdigest(\"#{id}#{created_at}\")\n end",
"def get_refresh_token(refresh_token)\n conn = Faraday.new(url: config[:base_url]) do |faraday|\n faraday.request :url_encoded\n faraday.adapter Faraday.default_adapter\n end\n\n params = refresh_access_token_params(refresh_token)\n\n conn.post do |req|\n req.url \"/api/oauth2/token\"\n req.body = params\n req.headers[\"Accept\"] = \"application/json\"\n req.headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\"\n end\n end",
"def hash\n [access_token_strategy, allowed_cors_origins, audience, authorization_code_grant_access_token_lifespan, authorization_code_grant_id_token_lifespan, authorization_code_grant_refresh_token_lifespan, backchannel_logout_session_required, backchannel_logout_uri, client_credentials_grant_access_token_lifespan, client_id, client_name, client_secret, client_secret_expires_at, client_uri, contacts, created_at, frontchannel_logout_session_required, frontchannel_logout_uri, grant_types, implicit_grant_access_token_lifespan, implicit_grant_id_token_lifespan, jwks, jwks_uri, jwt_bearer_grant_access_token_lifespan, logo_uri, metadata, owner, policy_uri, post_logout_redirect_uris, redirect_uris, refresh_token_grant_access_token_lifespan, refresh_token_grant_id_token_lifespan, refresh_token_grant_refresh_token_lifespan, registration_access_token, registration_client_uri, request_object_signing_alg, request_uris, response_types, scope, sector_identifier_uri, skip_consent, subject_type, token_endpoint_auth_method, token_endpoint_auth_signing_alg, tos_uri, updated_at, userinfo_signed_response_alg].hash\n end",
"def tokens\n (@token.is_a? OAuth2::AccessToken) ? @token.to_hash : @token\n end",
"def auth_token\n response_hash[:ebay_auth_token]\n end",
"def access_token\n return nil unless (temp_access_token = read_attribute(:access_token))\n # logger.debug2 \"temp_access_token = #{temp_access_token}\"\n encrypt_remove_pre_and_postfix(temp_access_token, 'access_token', 43)\n end",
"def access_token\n return nil unless (temp_access_token = read_attribute(:access_token))\n # logger.debug2 \"temp_access_token = #{temp_access_token}\"\n encrypt_remove_pre_and_postfix(temp_access_token, 'access_token', 43)\n end",
"def access_token\n OAuth::AccessToken.new(consumer, oauth_token, oauth_token_secret)\n end",
"def token\n @access_token.token\n end",
"def credentials\n {\n access_token: token,\n refresh_token: refresh_token,\n expires_at: token_expires_at\n }\n end",
"def get_refresh_token\n\t\tif File.exists?(REFRESH_TOKEN_FILE_NAME)\n\t\t\treturn File.read(REFRESH_TOKEN_FILE_NAME, :encoding => Encoding::UTF_8)\n\t\telse\n\t\t\treturn get_new_refresh_token\n\t\tend\n\tend",
"def access_token; self; end",
"def get_access_token\n raise HyvesException, 'You need an request token to make get an access token' if request_token.nil?\n @access_token = request_token.get_access_token\n\n @userid = request_token.response[\"userid\"]\n @expiredate = Time.at(request_token.response[\"expiredate\"].to_i) if not request_token.response[\"expiredate\"].nil?\n\n @access_token\n end",
"def get_OAuthTokenSecret()\n \t return @outputs[\"OAuthTokenSecret\"]\n \tend",
"def fetch_refresh_token(options)\n password_options = {\n :brightbox_password => options[:password],\n :brightbox_support_two_factor => true,\n :brightbox_one_time_password => options[:one_time_password]\n }\n\n default_fog_options = password_auth_params.merge(password_options)\n connection = Fog::Compute.new(default_fog_options)\n begin\n connection.get_access_token!\n rescue Excon::Errors::Unauthorized\n raise Brightbox::Api::ApiError, \"Invalid credentials\"\n end\n connection\n end",
"def get_access_token\n # Get the current token hash from session\n token_hash = session[:azure_token]\n\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n token = OAuth2::AccessToken.from_hash(client, token_hash)\n\n # Check if token is expired, refresh if so\n if token.expired?\n new_token = token.refresh!\n # Save new token\n session[:azure_token] = new_token.to_hash\n access_token = new_token.token\n else\n access_token = token.token\n end\n end",
"def generate_refresh_token\n @raw_refresh_token = UniqueToken.generate\n secret_strategy.store_secret(self, :refresh_token, @raw_refresh_token)\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def token_metadata()\n return @data[\"access\"][\"token\"]\n end",
"def authenticate(refresh_token, oauth_path)\n oauth_key = post(oauth_path, refresh_token)\n oauth_key = oauth_key['oauth_key']\n update_headers(oauth_key: oauth_key)\n nil\n end",
"def token_secret; end",
"def token_secret; end",
"def token_secret; end",
"def refresh\n result = JsonWebToken.verify(params[:refresh_token])\n rescue StandardError => e\n render json: { error: e }, status: :unauthorized\n else\n render json: {\n access_token: JsonWebToken.encode_access_token(user_id: result[0]['user_id']),\n refresh_token: JsonWebToken.encode_refresh_token(user_id: result[0]['user_id'])\n }, status: :ok\n end",
"def refresh_token()\n if @access_token_obj\n @access_token_obj.refresh_token\n else\n return nil\n end\n end",
"def get_access_token\n uri = URI.parse(@token_url)\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.request_uri)\n auth = Base64.encode64(@login + ':' + @password).gsub(\"\\n\", \"\")\n req['Authorization'] = \"Basic #{auth}\"\n send = 'grant_type=client_credentials'\n req.body = send\n res = http.request(req)\n if res.code == \"200\"\n data = res.body\n result = JSON.parse(data)\n @access_token = result['access_token']\n else\n puts \"Invalid getting access token\"\n exit\n end\n end",
"def get_access_token\n @oauth_access_token = oauth_request.get_access_token\n @authenticated_user_uri = oauth_consumer.token_request_response[\"Content-Location\"]\n end",
"def prepare_access_token(oauth_token, oauth_token_secret)\n consumer = OAuth::Consumer.new(\"zuDJxQuK96WA2s0k0g3tqHr6r\", \"PhiNIibo53GYGhXgoWJ1UDBoKDVGqhaeCmTiSWCwz3VKucxfTD\",\n { :site => \"https://api.twitter.com\",\n :scheme => :header\n })\n # now create the access token object from passed values\n token_hash = { :oauth_token => oauth_token,\n :oauth_token_secret => oauth_token_secret\n }\n access_token = OAuth::AccessToken.from_hash(consumer, token_hash )\n \n RestClient.add_before_execution_proc do |req, params|\n access_token.sign! req\n end\n\n return access_token\nend"
] |
[
"0.77518904",
"0.7053428",
"0.6891941",
"0.6822592",
"0.66937613",
"0.6689462",
"0.6669668",
"0.666153",
"0.66542876",
"0.6616804",
"0.6567058",
"0.65151054",
"0.6498517",
"0.6467488",
"0.64602053",
"0.6447396",
"0.6437423",
"0.64197814",
"0.638882",
"0.6365381",
"0.63502955",
"0.63443667",
"0.6341297",
"0.62843645",
"0.6265439",
"0.62575597",
"0.6244308",
"0.62364894",
"0.62063885",
"0.61959094",
"0.6192758",
"0.6161193",
"0.61420417",
"0.61343414",
"0.61294794",
"0.6128855",
"0.61231095",
"0.6107671",
"0.6094345",
"0.6094345",
"0.6084975",
"0.6072364",
"0.6064143",
"0.6052718",
"0.6045373",
"0.6043801",
"0.6033801",
"0.6030476",
"0.6030476",
"0.6030476",
"0.6024729",
"0.60242265",
"0.60242265",
"0.60242265",
"0.60242265",
"0.60242265",
"0.60242265",
"0.60045964",
"0.5993891",
"0.59920704",
"0.5982975",
"0.5982975",
"0.5974572",
"0.5972799",
"0.59711325",
"0.5967793",
"0.59655815",
"0.59593624",
"0.59485674",
"0.5946401",
"0.593907",
"0.5938712",
"0.5938655",
"0.59347445",
"0.59318656",
"0.5924201",
"0.59240454",
"0.59240454",
"0.59170836",
"0.59136975",
"0.5912281",
"0.58998847",
"0.58976597",
"0.5897488",
"0.58929545",
"0.5884057",
"0.58827716",
"0.5882311",
"0.5879806",
"0.5879806",
"0.5874068",
"0.58690757",
"0.58609885",
"0.58609885",
"0.58609885",
"0.58485585",
"0.58467966",
"0.58467835",
"0.58383507",
"0.5837921"
] |
0.747697
|
1
|
Create a new Unix Password Cracker.
|
def initialize(args = {})
@file = args[:file] if args[:file]
@dictionary = args[:dictionary] if args[:dictionary]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def createNagiosPasswd\n `touch /usr/local/nagios/etc/htpasswd.users`\n `echo nagiosadmin:uPODiTjNs5eaY >> /usr/local/nagios/etc/htpasswd.users` \n end",
"def create(username, password)\n SecKeychainAddGenericPassword(nil, @service.length, @service, username.length, username, password.length, password, nil)\n end",
"def create_pw_client(opts = {})\n usr = opts[:user] || user()\n pw = opts[:password] || password()\n remote = opts[:remote_name] || self.remote_name\n\n logger.info(\"Authorizing #{usr} to work with #{remote}.\")\n\n configure_octokit(opts)\n\n Octokit::Client.new(:login => usr, :password => pw)\n end",
"def create_new!\n if Dir.exist? @config_dir\n # Without :secure, it would follow symlinks and destroy things outside of\n # that folder. See docs for details.\n FileUtils.rm_rf( @config_dir, :secure => true )\n end\n Dir.mkdir(@config_dir, 0700)\n new_private_key = RbNaCl::PrivateKey.generate\n File.open(@config_file, \"w\") do |f|\n f.write(new_private_key.to_bytes)\n end\n end",
"def create_new_password\n pass = generate_password\n set_password(pass)\n pass\n end",
"def generate_password\n pass = \"\"\n 20.times { pass += (rand(74) + 48).chr }\n\n begin\n Puppet.settings.write(:capass) { |f| f.print pass }\n rescue Errno::EACCES => detail\n raise Puppet::Error, \"Could not write CA password: %s\" % detail.to_s\n end\n\n @password = pass\n\n return pass\n end",
"def create_credentials\n FileUtils.mkdir_p(@local_credentials_dir)\n message \"Going to create the credentials.yml in #{@local_credentials_dir}\"\n if e.ask_to_overwrite_local(@local_credentials_file_yml)\n Spinner.return :message => \"Creating #{y('credentials.yml')}..\" do\n local_credentials_yml = File.new(@local_credentials_file_yml, \"w\")\n local_credentials_yml.write(yaml_template)\n local_credentials_yml.close\n g(\"Finished creating the credentials.yml\")\n end\n end \n end",
"def create(options = {})\n options[:name] ||= SecureRandom.hex\n\n create_options = { p: port }\n create_options[:c] = options[:name] if options[:name]\n create_options[:d] = options[:dir] if options[:dir]\n exec(\"create\", create_options)\n\n options[:name]\n end",
"def create_safe\n if !File.file? @pwfile\n puts \"No password safe detected, creating one at #@pwfile\"\n FileUtils.touch @pwfile\n write_safe\n end\n end",
"def create_ssh_setup\n command = \"echo 'y\\\\\\n' \\| ssh-keygen -f /tmp/#{@name_args[0]}.key -N \\\"\\\" -P \\\"\\\"\"\n result = run_remote_command(command)\n\n if config[:username].eql? \"root\"\n auth_keys_file = '/root/.ssh/authorized_keys'\n else\n auth_keys_file = \"/home/#{config[:username]}/.ssh/authorized_keys\"\n end\n\n # we don't want to overwrite anything that may already exist here\n command = \"echo \\\"\\##{@name_args[0]}\\\" >> #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"cat /tmp/#{@name_args[0]}.key.pub >> #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"chmod 0600 #{auth_keys_file}\"\n result = run_remote_command(command)\n\n command = \"cat /tmp/#{@name_args[0]}.key\"\n ssh_key = run_remote_command(command)\n end",
"def create_temp_keychain()\n puts \"Creating empty temp keychain at #{@temp_kc_path}\" if @verbose \n CertTools.createKeychain(@temp_kc_path, @temp_kc_name)\n end",
"def create_user\n command = compile_command(\"useradd\") do |useradd|\n useradd << universal_options\n useradd << useradd_options\n end\n\n run_command(:command => command)\n\n # SmartOS locks new users by default until password is set\n # unlock the account by default because password is set by chef\n if check_lock\n unlock_user\n end\n end",
"def root_dir\n 'gen_passwd'\n end",
"def create_hashed_password\n self.password = password.crypt(\"ChaveDoProvas\")\n end",
"def _my_mkpass()\n mymkpass = ''\n 9.to_i.times{ mymkpass << (65 + rand(25)).chr }\n return mymkpass\nend",
"def generate(opts)\n check_opts(opts)\n \n identity_file = opts[:prefix] + \"_identity\"\n ssh_wrapper_script_file = opts[:prefix] + \"_ssh_wrapper\"\n\n File.open(identity_file, \"w\") do |io|\n io << opts[:private_key]\n end\n FileUtils.chmod(0600, identity_file)\n FileUtils.chown(opts[:user], opts[:group], identity_file)\n\n File.open(ssh_wrapper_script_file, \"w\") do |io|\n io << template.result(:identity=>identity_file)\n end\n FileUtils.chmod(0755, ssh_wrapper_script_file)\n FileUtils.chown(opts[:user], opts[:group], ssh_wrapper_script_file)\n end",
"def create\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n name = params[:user][:name]\n\n seeds = ('a'..'z').to_a\n seeds.concat( ('A'..'Z').to_a )\n seeds.concat( (0..9).to_a )\n seeds.concat ['/', '.']\n seeds.compact!\n \n salt = '$1$'\n 8.times { salt << seeds[ rand(seeds.size) ].to_s }\n password = params[:user][:password].crypt(salt)\n logger.info(password)\n system(\"sudo useradd #{name} -s #{Rails.root}/script/gitty_shell.rb -p '#{password}'\")\n system(\"sudo -u #{name} git init /home/#{name}\")\n system(\"sudo chmod 755 /home/#{name}\")\n format.html { redirect_to home_url }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def passwd(*) end",
"def passwd(*) end",
"def create_password\n self.uuid = TempPassword.get_uuid\n self.hashed_uuid = Digest::SHA1.hexdigest(uuid)\n end",
"def create(*args)\n # since we don't care about the inputs, just glob args\n rc, new_path = czk.create(*args)\n [rc, @req_registry.strip_chroot_from(new_path)]\n end",
"def create_username_password(**args)\n\t\t\t\t\tjson_body = {\n\t\t\t\t\t\t'' => '0',\n\t\t\t\t\t\tcredentials: args.merge(\n\t\t\t\t\t\t\t'$class' => 'com.cloudbees.plugins.credentials.impl.'\\\n\t\t\t\t\t\t\t\t'UsernamePasswordCredentialsImpl'\n\t\t\t\t\t\t)\n\t\t\t\t\t}.to_json\n\t\t\t\t\tcreate_(\"json=#{::CGI.escape json_body}\")\n\t\t\t\tend",
"def generate_password\n require 'securerandom' unless defined?(SecureRandom)\n password = SecureRandom.hex(30)\n node.normal['mysql']['local_admins'][new_resource.user]['password'] = password\n password\n end",
"def jenkins_password(opts)\n\tbegin\n\t\trun_in_shell \"docker cp #{opts[:name]}:/var/jenkins_home/secrets/initialAdminPassword ./temp-password\"\n\t\tpass = File.read './temp-password'\n\t\trun_in_shell \"unlink ./temp-password\"\n\t\treturn pass\n\trescue\n\t\treturn ''\n\tend\nend",
"def writable_create_project(dashboard_name) \n\tscript \"create_dashing_project\" do\n\t\tinterpreter \"bash\"\n\t\tuser \"root\"\n\t\tcwd \"/home\"\n\t\tcode <<-EOH\n\t\tdashing new \"#{dashboard_name}\"\n\t\tchmod 777 \"#{dashboard_name}\"\n\t\tcd \"#{dashboard_name}\"\n\t\tEOH\n\tend\n\tChef::Log.info \"#{dashboard_name} dashboard project created\"\n\nend",
"def run_bootstrap\n dockercfg_location = args[0]\n cloudsql_credentials_location = args[1]\n\n if dockercfg_location.nil? || dockercfg_location == ''\n puts 'Please specify the dockercfg json key location as first param.'\n exit(1)\n end\n\n if cloudsql_credentials_location.nil? || cloudsql_credentials_location == ''\n puts 'Please specify the cloudsql_credentials_location json key location as second param.'\n exit(1)\n end\n\n # puts `kubectl create secret generic gcr-secret --namespace default --from-file=.dockercfg=#{dockercfg_location}`\n puts `kubectl create secret docker-registry gcr-secret --docker-username=_json_key --docker-password=\"$(cat #{dockercfg_location})\" --docker-server=https://gcr.io --docker-email=doesnotmatter@example.com`\n puts `kubectl create secret generic cloudsql-credentials --namespace default --from-file=credentials.json=#{cloudsql_credentials_location}`\n end",
"def set_password_legacy\n guid = @user['generateduid'][0].to_ruby\n password_hash_file = \"#{@@password_hash_dir}/#{guid}\"\n begin\n File.open(password_hash_file, 'w') { |f| f.write(resource[:password_sha1])}\n rescue Errno::EACCES => detail\n raise(\"Could not write to password hash file: #{detail}\")\n end\n end",
"def generate\n @password = (1..@length).map { (33 + rand(89)).chr }.join \n check_password_contents\n @password\n end",
"def create(password)\n @call_params[:password] = password\n @call_params[:path] = \"/#{@call_params[:path]}\" unless @call_params[:path].start_with? '/'\n @client.call(self.class, __callee__.to_s, @call_params)\n end",
"def generate_mysql_password(user)\n key = \"server_#{user}_password\"\n encrypted_attribute_write([$php_appstack, 'mysql', key]) { secure_password }\nend",
"def debian_password\n nil\n end",
"def generate(\n key,\n seconds = 10,\n length = 64,\n char_pool = (32..126).map(&:chr).join.gsub(/\\s/, '')\n )\n char_pool_size = char_pool.size\n new_pw = (1..length.to_i).map{\n char_pool[SecureRandom.random_number(char_pool_size)]\n }.join\n \n if add(key, new_pw) \n get(key, seconds)\n end\n end",
"def generate_key\n puts \"please enter return 3 times\"\n cmd = \"ssh-keygen -t rsa\"\n `#{cmd}`\n end",
"def passwd\r\n @password = \"12345\"\r\n end",
"def create(username, groups = '', opts = {})\n payload = {\n :account => {\n :username => username,\n :comment => '',\n :groups => groups,\n :password => password_opts.merge(opts.fetch(:password, {}))\n }\n }\n @server.commands.get(post(payload)['command']['id'])\n end",
"def create_user\n user new_resource.user do\n comment \"Service user for #{new_resource.name}\"\n gid new_resource.group if new_resource.group\n home new_resource.home\n shell '/bin/false'\n system true\n uid new_resource.uid\n end\n end",
"def create_setting_file()\n puts \"Creating empty Setting file at #{@setting_file_path}\" if @verbose\n FileUtils.rm_rf(@setting_file_path) if FileTest.exists? @setting_file_path\n cmd_str = CertTools.security_tool_path + \" add-trusted-cert -o \" + Utilities.quote_str(@setting_file_path)\n `#{cmd_str}`\n $?\n end",
"def new_login_password_field\n $tracer.trace(__method__)\n #unit_test_no_generate: new_login_password_field, input.className(create_ats_regex_string(\"ats-createpwdfield\"))\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-createpwdfield\")), __method__, self)\n end",
"def call\n shell.create_file private_key_filepath, rsa_private_key.to_pem\n shell.create_file protected_key_filepath, rsa_protected_key\n shell.create_file public_key_filepath, rsa_public_key.to_pem\n\n `chmod 600 #{private_key_filepath}`\n `chmod 600 #{protected_key_filepath}`\n `chmod 644 #{public_key_filepath}`\n\n ::FileUtils.touch gitignore_filepath\n\n unless ::File.read(gitignore_filepath) =~ /^.chamber.pem$/\n shell.append_to_file gitignore_filepath, \"\\n# Private and protected key files for Chamber\\n\"\n shell.append_to_file gitignore_filepath, \"#{private_key_filename}\\n\"\n shell.append_to_file gitignore_filepath, \"#{protected_key_filename}\\n\"\n end\n\n shell.copy_file settings_template_filepath, settings_filepath\n\n shell.say ''\n shell.say 'The passphrase for your encrypted private key is:', :green\n shell.say ''\n shell.say rsa_key_passphrase, :green\n shell.say ''\n shell.say 'Store this securely somewhere.', :green\n shell.say ''\n shell.say 'You can send them the file located at:', :green\n shell.say ''\n shell.say protected_key_filepath, :green\n shell.say ''\n shell.say 'and not have to worry about sending it via a secure medium (such as', :green\n shell.say 'email), however do not send the passphrase along with it. Give it to', :green\n shell.say 'your team members in person.', :green\n shell.say ''\n shell.say 'In order for them to decrypt it (for use with Chamber), they can run:', :green\n shell.say ''\n shell.say \"$ cp /path/to/{#{protected_key_filename},#{private_key_filename}}\", :green\n shell.say \"$ ssh-keygen -p -f /path/to/#{private_key_filename}\", :green\n shell.say ''\n shell.say 'Enter the passphrase when prompted and leave the new passphrase blank.', :green\n shell.say ''\n end",
"def generate_new_key(device: nil)\n password = nil\n dev_id = nil\n get_device(device: device) do |device|\n telnet_config = {\n 'Host' => device.ip,\n 'Port' => 8080\n }\n connection = Net::Telnet.new(telnet_config)\n connection.puts(\"genkey\")\n waitfor_config = {\n 'Match' => /./,\n 'Timeout' => false\n }\n password = nil\n dev_id = nil\n while password.nil? or dev_id.nil?\n connection.waitfor(waitfor_config) do |txt|\n while line = txt.slice!(/^.*\\n/) do\n words = line.split\n if words[0] == \"Password:\"\n password = words[1]\n elsif words[0] == \"DevID:\"\n dev_id = words[1]\n end\n end\n end\n end\n connection.close\n end\n return password, dev_id\n end",
"def generate\n Puppet.info \"Creating a new SSL key for #{name}\"\n @content = OpenSSL::PKey::RSA.new(Puppet[:keylength].to_i)\n end",
"def generate_and_print_password\n password = Simp::Cli::Utils.generate_password\n logger.say ('~'*80).green + \"\\n\"\n logger.say 'NOTE: '.green.bold + \" The generated password is: \\n\\n\"\n logger.say ' ' + password.yellow.bold + \"\\n\\n\"\n logger.say ' >>>> Please remember this password! <<<<'.bold\n logger.say ' It will ' + '**NOT**'.bold + ' be written to the log or hieradata.'\n logger.say ('~'*80).green + \"\\n\"\n logger.say '*** Press enter to continue ***'.cyan.bold.blink\n ask ''\n password\n end",
"def generate_password\n if new_record?\n self.password = self.password_confirmation = /\\w{0,10}/.gen unless password\n end\n end",
"def cmk\n if ENV['USER'] == @site\n \"/omd/sites/#{@site}/bin/cmk\"\n else\n \"sudo -i -u #{@site} /omd/sites/#{@site}/bin/cmk\"\n end\n end",
"def make_up_password\n\to = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten\n\tpass = (0...12).map { o[rand(o.length)] }.join + \"@\"\n\tputs \"Using #{pass} for password\\n\"\n\treturn pass\nend",
"def create_user(user)\n user.downcase!\n hash = Hash.new\n hash[:name] = \"#{user}\"\n hash[:balance] = 0\n puts \"Please create a password: \"\n hash[:password] = gets.chomp\n write_to_file(\"userdata/#{user}.txt\",hash)\n write_to_file(\"userdata/#{user}_history.txt\", nil)\nend",
"def new_password(data)\n data.strip!\n unless data =~ /^\\w{6,20}$/\n ask_password\n return\n end\n @display.echo_on\n @new_password = data\n ask_color\n end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def create(file=@file)\n if self.legacy?\n return unless @password.send(:to_file, self) \n end\n super\n end",
"def passwd=(p0) end",
"def passwd=(p0) end",
"def new_password_field()\n\t\t# unit_test_no_generate: new_password_field, input.className(create_ats_regex_string(\"ats-newpwdfield\"))\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(input.className(create_ats_regex_string(\"ats-newpwdfield\")), __method__)\n\tend",
"def create_password\n self.salt = User.make_salt(self.username)\n self.hashed_password = User.hash_with_salt(@password, self.salt)\n end",
"def create_certificate # :nodoc:\n child = DRb::Worm::Certificates.new @name, @key_size\n\n @key = child.create_key\n csr_pem = child.create_certificate_signing_request\n cert_pem = @ca.create_child_certificate csr_pem\n\n @certificate = OpenSSL::X509::Certificate.new cert_pem\n end",
"def create(password, key=nil, uuid=nil, path=nil)\n key ||= Utils.mk_random_privkey\n\n json = Keystore.make_json key, password\n json[:id] = uuid\n\n new json, password, path\n end",
"def create_database(db_name)\n config = Rails.configuration.database_configuration[Rails.env]\n password = Shellwords.escape(config['password'])\n new_db = \"mysqldump -u#{config['username']} -p#{password} -h#{config['host']} #{config['database']} > /home/rails/current/tmp/backup.sql;\n mysqladmin -u#{config['username']} -p#{password} create #{db_name};\n mysql -u#{config['username']} -p#{password} -h#{config['host']} #{db_name} < /home/rails/current/tmp/backup.sql\"\n system new_db\n end",
"def create_cookbook(name, type, tmp)\n target = File.join(tmp, name)\n template_org = locate_config_value(\"github_template_org\")\n if template_org.nil? || template_org.empty?\n Chef::Log.fatal(\"Cannot find github_template_org within your configuration\")\n else\n\n github_url = @github_url.gsub('http://', 'git://') if @github_url =~ /^http:\\/\\/.*$/\n github_url = @github_url if @github_url =~ /^https:\\/\\/.*$/\n\n template_path = File.join(github_url, template_org, \"chef_template_#{type}.git\")\n shell_out!(\"git clone #{template_path} #{target}\") # , :cwd => cookbook_path)\n end\n end",
"def generate_monitor_ssh_keys\n priv_key_file = path(:monitor_priv_key)\n pub_key_file = path(:monitor_pub_key)\n unless file_exists?(priv_key_file, pub_key_file)\n ensure_dir(File.dirname(priv_key_file))\n ensure_dir(File.dirname(pub_key_file))\n cmd = %(ssh-keygen -N '' -C 'monitor' -t rsa -b 4096 -f '%s') % priv_key_file\n assert_run! cmd\n if file_exists?(priv_key_file, pub_key_file)\n log :created, priv_key_file\n log :created, pub_key_file\n else\n log :failed, 'to create monitor ssh keys'\n end\n end\n end",
"def create(api_params)\n keygen = SSHKey.generate\n api_params[:privatekey] = keygen.private_key\n api_params[:publickey] = keygen.ssh_public_key\n api_request(SSHKEYS, CREATE, api_params)\n end",
"def run(action, arguments, options)\n case action\n when :v, :version\n puts \"pws #{PWS::VERSION} by \" + Paint[\"J-_-L\", :bold] + \" <https://github.com/janlelis/pws>\"\n when :help, :actions, :commands\n puts(<<HELP)\n \n #{Paint[\"Usage\", :underline]}\n \n #{Paint['pws', :bold]} [-namespace] action [arguments] [--options]\n \n #{Paint[\"Info\", :underline]}\n \n pws allows you to manage passwords in encryted password files (safes). It\n operates on the file specified in the environment variable PWS or on \"~/.pws\".\n Using a single dash, you can set a namespace that will be appended to the\n filename, e.g. `pws -work show` will operate on \"~/.pws-work\".\n \n #{Paint[\"Available Actions\", :underline]}\n \n #{Paint['ls', :bold]} / list / show / status ( pattern = nil )\n Lists all available password entries. Optionally takes a regex filter.\n \n #{Paint['get', :bold]} / entry / copy / password / for ( name, seconds = 10 )\n Copies the password for <name> to the clipboard. The second argument specifies,\n how long the password is kept in the clipboard (0 = no deletion).\n Please keep in mind that other programs can access (and log) the contents\n of your clipboard.\n\n #{Paint['ps', :bold]} / print-screen ( name, seconds = 10 )\n Displays the password on stdout. The second argument specifies,\n how long the password is shown (0 = no deletion).\n Please keep in mind that the password will appear in your shell's logfile,\n for example, in \"~/.bash_history\"\n\n #{Paint['add', :bold]} / set / store / create ( name, password = nil )\n Stores a new password entry. The second argument can be the password, but\n it's recommended to not pass it, but enter it interactively.\n \n #{Paint['gen', :bold]} / generate ( name, seconds = 10, length = 64, char_pool )\n Generates a new password for <name> and then copies it to the clipboard, like\n get (the second argument is the time - it gets passed to get). The third\n argument sets the password length. The fourth argument allows you to pass a\n character pool that is used for generating the passwords.\n \n #{Paint['update', :bold]} / update-add ( name, password = nil )\n Updates an existing password entry.\n \n #{Paint['update-gen', :bold]} / update-generate( name, seconds = 10, length = 64, char_pool )\n Updates an existing password entry using the generate method.\n \n #{Paint['rm', :bold]} / remove / del / delete ( name )\n Removes a password entry.\n \n #{Paint['mv', :bold]} / move / rename ( old_name, new_name )\n Renames a password entry.\n \n #{Paint['master', :bold]} ( password = nil )\n Changes the master password.\n \n #{Paint['resave', :bold]} / convert\n Just save the safe. Useful for converting the file format.\n \n #{Paint['v', :bold]} / version\n Displays version and website.\n \n #{Paint['help', :bold]} / actions / commands\n Displays this help.\n\n #{Paint[\"Available Options\", :underline]}\n \n #{Paint['--in', :bold]}\n Specifies the password file input format. Neccessary to convert 0.9 safes.\n Supported values: 0.9 1.0\n \n #{Paint['--out', :bold]}\n Specifies the password file output format. Ignored for non-writing actions,\n e.g. get. Defaults to the current version.\n Supported values: 1.0\n \n #{Paint['--filename', :bold]}\n Path to the password safe to use. Overrides usual path and any namespaces.\n \n #{Paint['--cwd', :bold]}\n Use a .pws file in the current directory instead of the one specified in\n ENV['PWS'] or with --filename.\n \n #{Paint['--iterations', :bold]}\n Sets the number of sha iterations used to transform your password into the\n encryption key (pbkdf2). A higher number takes longer to compute, but makes\n it harder for attacker to bruteforce your password.\n \n #{Paint['--seconds', :bold]}, #{Paint['--length', :bold]}, #{Paint['--charpool', :bold]}, #{Paint['--exclude', :bold]}\n Preset options for specific actions.\n \n #{Paint[\"ENV Variables\", :underline]}\n \n You can use environment variables to customize the default settings of pws.\n Except for PWS (info at top), the following variables can be used:\n \n PWS_SECONDS\n PWS_LENGTH\n PWS_CHARPOOL\n PWS_ITERATIONS\n\nHELP\n else # redirect to safe\n if PWS.public_instance_methods(false).include?(action)\n status = PWS.new(options).public_send(action, *arguments.map{ |a|\n a.unpack('a*')[0] # ignore encoding\n })\n exit(status ? 0 : 2)\n else\n raise ArgumentError, \"Unknown action: #{action}\\nPlease see `pws --help` for a list of available commands!\"\n end\n end\n rescue PWS::NoLegacyAccess\n pa \"NO ACCESS\", :red, :bold\n pa 'The password safe you are trying to access migth be a version 0.9 password file', :red\n pa 'If this is the case, you will need to convert it to a version 1.0 password file by calling:', :red\n pa 'pws resave --in 0.9 --out 1.0', :red\n exit(3)\n rescue PWS::NoAccess\n # pa $!.message.capitalize, :red, :bold\n pa \"NO ACCESS\", :red, :bold\n exit(3)\n rescue ArgumentError\n pa $!.message.capitalize, :red\n exit(4)\n rescue Interrupt\n system 'stty echo' if $stdin.tty? # ensure terminal's working\n pa \"..canceled\", :red\n exit(5)\n end",
"def generate_password\n self.password = \"1234\"\n end",
"def new_user_password(username)\n password = @prompt.mask('Password >')\n raise RequirementError.new, 'Requirements not met' if password.match?(/[!@#$%^&*(),.?\":{}|<>]/)\n\n @user = User.new(username, password, gen_uid)\n @user_playlist = Playlist.new(@user)\n store_user\n rescue RequirementError\n puts 'Password cannot contain special characters. Please try again!'.colorize(:light_red)\n end",
"def create\n authorizable_keystore = client(resource).authorizable_keystore(resource[:intermediate_path], resource[:authorizable_id])\n result = authorizable_keystore.create(resource[:password])\n\n handle(result)\n end",
"def ssh_create(host, user, key)\n\n if key.start_with?('-----BEGIN RSA PRIVATE KEY-----')\n ssh = Net::SSH.start(host, user,\n {\n :key_data => key,\n :user_known_hosts_file => \"/dev/null\"\n } )\n elsif File.exist?(key)\n ssh = Net::SSH.start(host, user,\n {\n :key_data => IO.read(key),\n :user_known_hosts_file => \"/dev/null\"\n } )\n else\n ssh = Net::SSH.start(host, user,\n {\n :password => key,\n :user_known_hosts_file => \"/dev/null\"\n } )\n end\n\n ssh\n end",
"def create_gitops_kubeconfig\n log(\"green\", \"creating kubeconfig secret inside concourse-#{team_name}\")\n set_kube_context(MANAGER_CLUSTER)\n unless team_namespace_exists?\n executor.execute(\"kubectl create ns concourse-#{team_name}\")\n end\n\n unless secret_exists?\n executor.execute(\"kubectl -n concourse-#{team_name} create secret generic kubectl-conf --from-file=$KUBECONFIG\")\n end\n set_kube_context(cluster)\n end",
"def create_consumer(username, email, password)\n add_consumer(username, email, password)\n end",
"def generate(password)\n BCrypt::Password.create(secret + password).to_s\n end",
"def generate_temporary_password\n\n pw = Algol.password_salt\n # puts \">> User: generating a temporary password '#{pw}' <<\"\n update!({ password: User.encrypt(pw), auto_password: true })\n\n # expire all current/old temp passwords that weren't used\n pending_notices.all({ type: 'password' }).each { |n| n.expire! }\n\n notices.create({ type: 'password', data: pw })\n end",
"def change_mongo_password_for!( instance )\n process_data =\n systemu \\\n command( instance ),\n :cwd => ansible_deploy_dir\n \n Ansible::Process.for_systemu *process_data\n end",
"def generate_ssh_key_ruby(type=\"RSA\", bits = 2048, comment = \"OpenShift-Key\")\n key = RHC::Vendor::SSHKey.generate(:type => type,\n :bits => bits,\n :comment => comment)\n ssh_dir = RHC::Config.ssh_dir\n priv_key = RHC::Config.ssh_priv_key_file_path\n pub_key = RHC::Config.ssh_pub_key_file_path\n\n if File.exists?(priv_key)\n say \"SSH key already exists: #{priv_key}. Reusing...\"\n return nil\n else\n unless File.exists?(ssh_dir)\n FileUtils.mkdir_p(ssh_dir)\n File.chmod(0700, ssh_dir)\n end\n File.open(priv_key, 'w') {|f| f.write(key.private_key)}\n File.chmod(0600, priv_key)\n File.open(pub_key, 'w') {|f| f.write(key.ssh_public_key)}\n\n ssh_add\n end\n pub_key\n end",
"def gen_hostname(boxname)\n \"#{ENV['USER']}-#{(0...3).map { (65 + rand(26)).chr }.join.downcase}-#{boxname}\"\nend",
"def create_credentials\n post_url = URI(\"http://#{FBPi::Settings.meshblu_url}/devices\")\n res = Net::HTTP.post_form(post_url, {})\n json = JSON.parse(res.body).deep_symbolize_keys\n File.open(credentials_file, 'w+') { |file| file.write(json.to_yaml) }\n load_credentials\n json\n end",
"def create_ftp\n # generate password for ftp\n (password && password.length > 0) ? (ftppasswd = password[0..7]) : (ftppasswd = 'nextdeploy')\n\n bash_cmd = \"sudo /usr/local/bin/./nextdeploy-addftp #{gitpath.shellescape}\"\n\n # take a lock for project action\n begin\n open(\"/tmp/project#{id}.lock\", File::RDWR|File::CREAT) do |f|\n f.flock(File::LOCK_EX)\n\n Rails.logger.warn(\"#{bash_cmd} xxxxxxx\")\n system(\"#{bash_cmd} #{ftppasswd.shellescape}\")\n end\n\n rescue\n raise Exceptions::NextDeployException.new(\"Lock on create_ftp for #{name} failed\")\n end\n\n true\n end",
"def mkdir_p(path)\n cmd 'mkdir', '-p', path\nend",
"def create(name, write_private)\n new_key = OpenSSL::PKey::RSA.generate(1024)\n new_public = new_key.public_key.to_pem\n new_private = new_key.to_pem\n File.open(File.join(@keystore, \"#{name}.pub\"), 'w') { |f| f.puts new_public }\n File.open(File.join(@keystore, \"#{name}.key\"), 'w') { |f| f.puts new_key } if write_private\n new_key\n end",
"def generate\n bits = generate_password_bits\n puts bits.to_s(2)\n\n coordinates = bits_to_coordinates(bits)\n puts coordinates.inspect\n\n coordinates\n end",
"def new_login_conf_password_field\n $tracer.trace(__method__)\n #unit_test_no_generate: new_login_conf_password_field, input.className(create_ats_regex_string(\"ats-confirmpwdfield\"))\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-confirmpwdfield\")), __method__, self)\n end",
"def create_secret_text(**args)\n\t\t\t\t\tjson_body = {\n\t\t\t\t\t\t'' => '3',\n\t\t\t\t\t\tcredentials: args.merge(\n\t\t\t\t\t\t\t'$class' => 'org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl'\n\t\t\t\t\t\t)\n\t\t\t\t\t}.to_json\n\t\t\t\t\tcreate_(\"json=#{::CGI.escape json_body}\")\n\t\t\t\tend",
"def createkey(hostname, pupmodule, pubfolder, prvfolder)\n return 'Already there' if\n File.exist?(\"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\")\n key = SelfSignedCertificate.new(hostname)\n FileUtils.mkdir_p \"#{pubfolder}/#{pupmodule}/\"\n FileUtils.mkdir_p \"#{prvfolder}/#{hostname}/#{pupmodule}/\"\n open \"#{pubfolder}/#{pupmodule}/#{hostname}.pub.pem\", 'w' do\n |io| io.write key.pub end\n open \"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\", 'w' do\n |io| io.write key.crt end\n open \"#{prvfolder}/#{hostname}/#{pupmodule}/#{hostname}.priv.pem\", 'w' do\n |io| io.write key.priv end\n 'OK'\nend",
"def write_user_credentials(username, password)\n File.open(credentials_path, 'a') do |users|\n users.write(Psych.dump(\"#{username}\": encrypt_password(password)))\n end\n clean_yaml\nend",
"def make_salt\n\t secure_hash(\"#{Time.now.utc}--#{password}\")\n\tend",
"def generate_password\n [*('a'..'z'), *('A'..'Z'), *('0'..'9')].sample(8).join\n end",
"def copyKey (ip, username)\n \n puts \"Connecting to #{ip} with User -> #{username}.....\"\n\n # Magic Command - the mirror to ssh-copy-id\n system \"cat ~/.ssh/id_rsa.pub | ssh #{username}@#{ip} 'mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys'\"\n end",
"def generate(opts)\n if opts\n if opts[:ssid] and opts[:password]\n o, s = Open3.capture2(\"#{AIRPORT} -P --ssid #{opts[:ssid]} --password #{opts[:password]}\")\n if s.success?\n @psk = o.strip\n else\n raise WillowRunError.new(\"Unable to generate psk with SSID: #{opts[:ssid]} and PASSWORD: #{opts[:password]}\")\n end\n else\n raise WillowRunError.new(\"Unable to generate psk, requires both an ssid and password; only got: #{opts}.\")\n end\n else\n raise WillowRunError.new(\"Unable to generate psk, requires both an ssid and password.\")\n end\n @psk\n end",
"def password=(new_password); end",
"def generate_password!(model:, **)\n model.password = SecureRandom.urlsafe_base64(8)\n end",
"def login_command_for_windows\n create_rdp_doc\n\n LoginCommand.new(\"mstsc\", rdp_doc_path)\n end",
"def password\n ENV['DESK_PASSWORD']\n end",
"def create(r10k_url)\n begin\n setup_repos_dir(repos_dir)\n @control_repo = setup_control_repo(r10k_url, options[:src_target])\n # get modules we are interested in\n rescue InvalidBranchName => e\n logger.error(e.message)\n exit 1\n end\n\n module_names.each do | mod_name |\n puts \"## #{mod_name} ##\".yellow\n begin\n mod = puppetfile.find_mod(mod_name)\n setup_module_repo(mod)\n rescue Rugged::CheckoutError => e\n logger.fatal(e.message)\n exit 1\n rescue InvalidModuleNameException => e\n logger.error(e.message)\n value = nil\n loop do\n print \"Do you want to create a new entry in the Puppetfile for the module named #{mod_name}?(y/n): \".yellow\n value = gets.downcase.chomp\n break if value =~ /y|n/\n end\n next if value == 'n'\n mod = setup_new_module(mod_name)\n setup_module_repo(mod)\n end\n end\n @control_repo.checkout_branch(name)\n puppetfile.write_to_file\n logger.info(\"Committing Puppetfile changes to r10k-control branch: #{name}\")\n committed = puppetfile.commit(\"Sandbox Creation for #{name} environment\")\n # no need to push if we didn't commit anything\n if committed\n logger.info(\"Pushing new environment branch: #{name} to upstream\")\n puppetfile.push('upstream', name, true, false)\n end\n logger.info(\"Sandbox created successfully\")\n return self\n end",
"def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end",
"def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end",
"def createkey(hostname, pupmodule, pubfolder, prvfolder, subject, ca_key_file,\nca_crt_file, passphrase)\n return 'Already there' if\n File.exist?(\"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\")\n ca_key = OpenSSL::PKey::RSA.new File.read(ca_key_file), passphrase\n ca_cert = OpenSSL::X509::Certificate.new File.read ca_crt_file\n c=SignedCertificate.new(ca_key, ca_cert, subject)\n FileUtils.mkdir_p \"#{pubfolder}/#{pupmodule}/\"\n FileUtils.mkdir_p \"#{prvfolder}/#{hostname}/#{pupmodule}/\"\n #open \"#{pubfolder}/#{pupmodule}/#{hostname}.pub.pem\", 'w' do\n #|io| io.write c.key.public_key.to_pem end\n #open \"#{pubfolder}/#{pupmodule}/#{hostname}.csr.pem\", 'w' do\n #|io| io.write c.csr.to_pem end\n open \"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\", 'w' do\n |io| io.write c.cert.to_pem end\n open \"#{prvfolder}/#{hostname}/#{pupmodule}/#{hostname}.priv.pem\", 'w' do\n |io| io.write c.key.to_pem end\n 'OK'\nend",
"def action_create\n if current_resource.exists? && correct_config?\n Chef::Log.debug(\"#{new_resource} exists - skipping\")\n else\n converge_by(\"Create #{new_resource}\") do\n executor.groovy! <<-EOH.gsub(/ ^{12}/, '')\n import hudson.model.*\n import hudson.slaves.*\n import jenkins.model.*\n import jenkins.slaves.*\n\n props = []\n availability = #{convert_to_groovy(new_resource.availability)}\n usage_mode = #{convert_to_groovy(new_resource.usage_mode)}\n env_map = #{convert_to_groovy(new_resource.environment)}\n labels = #{convert_to_groovy(new_resource.labels.sort.join(\"\\s\"))}\n\n // Compute the usage mode\n if (usage_mode == 'normal') {\n mode = Node.Mode.NORMAL\n } else {\n mode = Node.Mode.EXCLUSIVE\n }\n\n // Compute the retention strategy\n if (availability == 'demand') {\n retention_strategy =\n new RetentionStrategy.Demand(\n #{new_resource.in_demand_delay},\n #{new_resource.idle_delay}\n )\n } else if (availability == 'always') {\n retention_strategy = new RetentionStrategy.Always()\n } else {\n retention_strategy = RetentionStrategy.NOOP\n }\n\n // Create an entry in the prop list for all env vars\n if (env_map != null) {\n env_vars = new hudson.EnvVars(env_map)\n entries = env_vars.collect {\n k,v -> new EnvironmentVariablesNodeProperty.Entry(k,v)\n }\n props << new EnvironmentVariablesNodeProperty(entries)\n }\n\n // Launcher\n #{launcher_groovy}\n\n // Build the slave object\n slave = new DumbSlave(\n #{convert_to_groovy(new_resource.name)},\n #{convert_to_groovy(new_resource.description)},\n #{convert_to_groovy(new_resource.remote_fs)},\n #{convert_to_groovy(new_resource.executors.to_s)},\n mode,\n labels,\n launcher,\n retention_strategy,\n props\n )\n\n // Create or update the slave in the Jenkins instance\n nodes = new ArrayList(Jenkins.instance.getNodes())\n ix = nodes.indexOf(slave)\n (ix >= 0) ? nodes.set(ix, slave) : nodes.add(slave)\n Jenkins.instance.setNodes(nodes)\n EOH\n end\n end\n end",
"def create_new_salt\n self.password_salt = [Array.new(6){rand(256).chr}.join].pack(\"m\").chomp\n end",
"def security_create_right(data)\n plist = CFPropertyList::List.new\n plist.value = CFPropertyList.guess(data)\n tmp = Tempfile.new('puppet_macauthdb')\n begin\n plist.save(tmp.path, CFPropertyList::List::FORMAT_XML)\n tmp.close\n cmds = [:security, \"authorizationdb\", \"write\", resource[:name]]\n execute(cmds, :failonfail => false, :combine => false, \n :stdinfile => tmp.path.to_s)\n rescue Errno::EACCES => e\n raise Puppet::Error.new(\"Cannot save right to #{tmp.path}: #{e}\")\n ensure\n tmp.unlink\n end\n end",
"def make_keys!\n root_dir = SAFE_KEYS_DIR\n object_id = self.id\n pass = self.password \n raise Safe::KeygenError if object_id.nil? || pass.nil?\n dir_class = root_dir + \"/#{self.class.to_s.tableize}/\"\n dir = dir_class + \"#{object_id}/\"\n if File.exists?(root_dir) && File.directory?(root_dir)\n Dir.mkdir(dir_class) unless File.exists?(dir_class)\n Dir.mkdir(dir) unless File.exists?(dir)\n gen_keypair(dir, pass)\n else\n Dir.mkdir(root_dir)\n Dir.mkdir(dir_class)\n Dir.mkdir(dir)\n gen_keypair(dir, pass)\n end \n end",
"def cobbler_root_password\n require 'json'\n require 'mixlib/shellout'\n\n vault_command =\n Mixlib::ShellOut.new('sudo',\n 'knife', 'vault', 'show',\n 'os', 'cobbler',\n '-F', 'json',\n '-p', 'all',\n '-m', 'client')\n\n vault_command.run_command\n\n vault_command.invalid! 'Could not retrieve cobbler password!' unless vault_command.status.success?\n\n JSON.parse(vault_command.stdout)['root-password']\nend",
"def test_secret\n assert pass = Argon2::Password.create('mypassword', secret: \"A secret\")\n skip(\"The secret isn't kept on the Argon2::Password instance\")\n assert_equal pass.secret, \"A secret\"\n end"
] |
[
"0.66190594",
"0.6164644",
"0.6129946",
"0.6126131",
"0.6086274",
"0.59366596",
"0.58915704",
"0.57576907",
"0.5739757",
"0.5707239",
"0.56688786",
"0.56563675",
"0.5602771",
"0.5543264",
"0.55344844",
"0.5452343",
"0.544418",
"0.5443664",
"0.5443664",
"0.54362905",
"0.5429178",
"0.54287964",
"0.5414664",
"0.5405786",
"0.5347902",
"0.5347685",
"0.53293097",
"0.5292381",
"0.52613604",
"0.52504516",
"0.5248531",
"0.5224905",
"0.5218987",
"0.52123857",
"0.520911",
"0.5205365",
"0.5198767",
"0.5192332",
"0.5186063",
"0.5180346",
"0.51271594",
"0.51042014",
"0.50991315",
"0.5095299",
"0.5088176",
"0.5087726",
"0.5069726",
"0.5069272",
"0.5069272",
"0.5069272",
"0.5069272",
"0.5062256",
"0.5057614",
"0.5057614",
"0.5045389",
"0.50430447",
"0.5037245",
"0.50357527",
"0.5029974",
"0.502155",
"0.5020928",
"0.5014439",
"0.50114244",
"0.5010523",
"0.5008546",
"0.5007374",
"0.5002236",
"0.49914953",
"0.4965234",
"0.4960394",
"0.4960267",
"0.4958839",
"0.4958542",
"0.49529916",
"0.49519092",
"0.49410444",
"0.49378598",
"0.49377096",
"0.49352288",
"0.49335834",
"0.49335322",
"0.49231988",
"0.49228305",
"0.4916334",
"0.49024802",
"0.48980552",
"0.48915002",
"0.48905003",
"0.48859304",
"0.48798326",
"0.48786592",
"0.4877983",
"0.4872498",
"0.4872498",
"0.4868106",
"0.48664403",
"0.4860237",
"0.48589393",
"0.48564824",
"0.48535866",
"0.48520875"
] |
0.0
|
-1
|
Check if a given encrypted password matches a given plaintext word when the same crytographic operation is performed on it.
|
def check_password(encrypted_password, plaintext_password, strip = true)
plaintext_password.strip! if strip # sometimes passwords have trailing spaces
if plaintext_password.crypt(encrypted_password[0, 2]) == encrypted_password
true
else
false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_pw pw\n (encrypt pw) == (self[:password])\n end",
"def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end",
"def password_match?(login_password)\n\t\tencrypted_password == encrypt(login_password)\t\n\tend",
"def matches?(crypted, *tokens)\n encrypt(*tokens) == crypted\n end",
"def password_match? password\n\t\tBCrypt::Password.new(@password) == password\n\tend",
"def match_password(login_password=\"\")\n password == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def encryptor_matches?(crypted, encryptor, attempted_password, check_against_database)\n encryptor_args = encrypt_arguments(attempted_password, check_against_database)\n encryptor.matches?(crypted, *encryptor_args)\n end",
"def matches?(crypted, *tokens)\n encrypt(*tokens) == crypted\n end",
"def matches?(crypted, *tokens)\n encrypt(*tokens) == crypted\n end",
"def matches?(crypted, *tokens)\n encrypt(*tokens.compact) == crypted\n end",
"def cdb_verify_password(given_password)\n encrypt_password(given_password) == @password\n end",
"def match_password_basic(p)\n puts \"p: #{p}\"\n puts \"password: #{password}\"\n p == password\n end",
"def has_password?(password)\n encrypted_password == encrypt(password)\n end",
"def matches_password(login_password)\n passhash == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def valid_password?(plain)\n password == hash_crypt(plain.to_s) \n end",
"def match_password(password, password_cofirmation)\n return (password==password_cofirmation) ? true : false\n end",
"def hasSamePassword?(submittedPassword)\n encrypted_password == encryptUsingSalt(submittedPassword)\n end",
"def has_password?( submitted_password )\n encrypted_password == encrypt( submitted_password )\n end",
"def check(password, crypted)\n hash, salt = unserialize(crypted)\n\n self.hash(password, salt) == hash\n end",
"def passwords_match?\n context.user.password == context.password\n end",
"def authenticated?(cleartext_secret)\n Password.new(crypted_secret) == cleartext_secret\n end",
"def has_password?(submitted_password)\n password == encrypt(submitted_password)\n end",
"def password_match?( password=\"\")\n hashedPassword == Admin.hash_with_salt(password, salt)\n end",
"def has_password?(submitted_password)\r\n encrypted_password == encrypt(submitted_password)\r\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def compare_pass (pass)\r\n return self.encrypted_password == sha_hash(\"#{pass}--#{self.salt}\")\r\n end",
"def has_password?(submitted_password)\n\tpassword == encrypt(submitted_password) \n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def valid_password?(password, encrypted_password)\n\treturn false if encrypted_password.blank?\n\tbcrypt = ::BCrypt::Password.new(encrypted_password)\n pepper = \"39dd46bfe0dee2d2f5b98862b6b8bf24b736ee877efd5df95f48cf6ca5310b72d267f216d6138684de626297f2927ed7e99106058013e5d66d0b8ff3af8a234a\"\n\tpassword1 = ::BCrypt::Engine.hash_secret(\"#{password}#{pepper}\", bcrypt.salt)\n\tputs password1\n\tpassword = ::BCrypt::Engine.hash_secret(\"#{password}#{SecureRandom.hex(64)}\", bcrypt.salt)\n\tputs password\n\tputs encrypted_password\n\tstr = [password, nil].flatten.compact.join\n\tsecure_compare(Digest::MD5.hexdigest(str), encrypted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def valid_pass?(test_pass)\n Encrypt::Password.validatePassword test_pass, password\n end",
"def check_password(password_provided)\n BCrypt::Engine.hash_secret(password_provided, self.password_salt) == self.password\n end",
"def password_match?(entered_password = '')\n password == User.hash_with_salt(entered_password, salt)\n end",
"def check_password(password)\n return false unless key\n key == self.class.hash_password(password, key.split('|', 2).first)\n end",
"def has_password?(submitted_password)\n # compare encrypted_password with the encrypted version of submitted_password\n encrypted_password == encrypt(submitted_password)\n end",
"def compare(crypted_string, plain_string)\n BCrypt::Password.new(crypted_string).is_password?(plain_string)\n rescue BCrypt::Errors::InvalidHash\n false\n end",
"def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end",
"def has_password?(submitted_password)\n # Compare encrypted password with the encrypted version of\n # Submitted password\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(password_soumis)\n # Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end",
"def has_password?(password_soumis)\n\t\t# Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n\t encrypted_password == encrypt(submitted_password)\n end",
"def test_contain_password11\n result = contains_password?(\"passwrd1*\")\n assert(result, \"'passwrd1*' should be valid because it doesn't contain 'password'\")\n end",
"def has_password?(submitted_password)\n #Compare encrypted_password with the encrypted version of \n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def authenticated?(password)\n crypted_password == encrypt(password)\n end",
"def test_contain_password12\n result = contains_password?(\"password1\")\n refute(result, \"'password1' should not be valid because it contains 'password'\")\n end",
"def check_password(pass)\n hash = calc_hash(pass)\n\n return false if hash.nil?\n crypt_pass == hash\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def matches?( crypted, *tokens )\n crypted == join_tokens( tokens )\n end",
"def has_password?(submitted_password)\n self.password == encrypt(submitted_password)\n end",
"def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end",
"def valid_password?(pass)\n crypted = send(sorcery_config.crypted_password_attribute_name)\n return crypted == pass if sorcery_config.encryption_provider.nil?\n\n # Ensure encryption provider is using configured values\n self.class.set_encryption_attributes\n\n salt = send(sorcery_config.salt_attribute_name) unless sorcery_config.salt_attribute_name.nil?\n\n sorcery_config.encryption_provider.matches?(crypted, pass, salt)\n end",
"def check_password(check_char, pos_1, pos_2, password)\n (password.chars[pos_1 -1] == check_char) ^ (password.chars[pos_2 -1] == check_char) \nend",
"def check(creds)\n creds[1].crypt(password) == password\n end",
"def has_password?(submitted_password)\n #compare encrypted_password with the encrypted version of submitted password.\n password == submitted_password\n end",
"def check_password(password, hash)\n BCrypt::Password.new(hash) == password\n end",
"def validate_password(challenge)\n actual = BCrypt::Password.new(password_digest)\n actual == challenge\n end",
"def has_password?(submitted_password)\n\t # Compare encrypted_password with the encrypted version of\n\t # submitted_password.\n\t encrypted_password == encrypt(submitted_password)\n\tend",
"def has_password?(a_password)\n self.encrypted_password == encrypt(a_password)\n end",
"def has_password?(submitted_password)\n # Return true if the user's password matches the submitted password.\n # Compare encrypted_password with the encrypted version of submitted_password\n encrypted_password == encrypt(submitted_password) \n end",
"def password_check\n return self.encrypted_password==BCrypt::Engine.hash_secret(self.password_verify, self.salt)\n end",
"def valid_password?(password); end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def authenticated?(pass)\n encrypted_password == User.encrypt(pass, salt)\n end",
"def has_password? (submitted_password)\n password_digest == encrypt(submitted_password)\n end",
"def valid?(password_with_scheme)\n tokens = password_with_scheme.match(/(?<first_position>\\d+)-(?<second_position>\\d+) (?<letter>\\w): (?<password>\\w+)/)\n password = tokens[:password]\n letter = tokens[:letter]\n first_letter = password[tokens[:first_position].to_i - 1]\n second_letter = password[tokens[:second_position].to_i - 1]\n # ^ is exclusive or\n return (first_letter == letter) ^ (second_letter == letter)\nend",
"def has_password?(submitted_password)\n self.encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # compare encrypted_password with the encrypted version of\n # the submitted password.\n\tencrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n\tencrypted_password == encrypt(submitted_password)\nend",
"def has_password?(submitted_password)\n\t\t# Compare encrypted password with the encrypted version of the submitted password\n\t\tencrypted_password == encrypt(submitted_password)\n\tend",
"def valid_password?(password)\n V1::Auth::Encryptor.compare(encrypted_password, password)\n end",
"def has_password?(submitted_password)\n \t\t# Compare encrypted_password with the encrypted version of\n \t\t# submitted_password.\n\t\tencrypted_password == encrypt(submitted_password)\n \tend",
"def is_password(password)\n if password.downcase == \"password\"\n puts \"Password cannot be the word password\"\n else \n puts \"Acceptable\"\n end\nend",
"def has_password?(submitted_password)\n\t# Compare encrypted_password with the encrypted version of\n\t# submitted_password.\n\t\tencrypted_password == encrypt(submitted_password)\n\tend",
"def password_is?(password)\n ENCRYPT.hexdigest(password + self.salt) == self.encrypted_password\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of # submitted_password.\n encrypt(submitted_password) == encrypted_password\n end",
"def test_password_matches_custom_password\n user = User.named(\"user\", :password => \"verysecret\")\n assert(!user.password_matches?(\"user\"))\n assert(user.password_matches?(\"verysecret\"))\n end"
] |
[
"0.7631796",
"0.7580656",
"0.7446075",
"0.72147113",
"0.7204275",
"0.72013867",
"0.71478826",
"0.7133652",
"0.70869166",
"0.7079702",
"0.7067759",
"0.7041514",
"0.70401305",
"0.70184577",
"0.7016748",
"0.7013209",
"0.70012885",
"0.6973615",
"0.69602156",
"0.6937418",
"0.69373083",
"0.69160277",
"0.6901252",
"0.68633145",
"0.684831",
"0.684831",
"0.684831",
"0.684831",
"0.684831",
"0.684831",
"0.684831",
"0.684831",
"0.684831",
"0.684831",
"0.684831",
"0.684831",
"0.684831",
"0.68309516",
"0.68309516",
"0.6811116",
"0.6798089",
"0.67761236",
"0.67757255",
"0.67753196",
"0.67753196",
"0.676701",
"0.6761602",
"0.67612803",
"0.6760478",
"0.6758429",
"0.675398",
"0.6748785",
"0.6748785",
"0.6746452",
"0.6732177",
"0.67218876",
"0.6720108",
"0.67151237",
"0.67023283",
"0.6690482",
"0.66753906",
"0.667312",
"0.6672552",
"0.6672552",
"0.6672552",
"0.6672552",
"0.6672552",
"0.6672552",
"0.6672552",
"0.6667358",
"0.6667358",
"0.66642207",
"0.6661519",
"0.6653886",
"0.66523033",
"0.6646106",
"0.66423184",
"0.66407853",
"0.66338813",
"0.6626009",
"0.6614492",
"0.6592127",
"0.6582436",
"0.6555917",
"0.6533736",
"0.65317535",
"0.65298814",
"0.65293026",
"0.6521683",
"0.65203273",
"0.65017486",
"0.64989346",
"0.6476576",
"0.64677954",
"0.6451682",
"0.644465",
"0.6444447",
"0.6443968",
"0.64418805",
"0.6428549"
] |
0.7100315
|
8
|
GET /joineds GET /joineds.json
|
def index
@joineds = Joined.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def users\n channel = Channel.find(params[:id])\n users = ChannelJoined.where(channel_id: params[:id])\n return json_response({\n users: users.map{|j| j.user}\n })\n end",
"def user_joined\n user = User.find_by!(id: params[:user_id])\n return json_response({\n \"joined\": ChannelJoined.exists?({\n channel_id: params[:id],\n user_id: params[:user_id]\n })\n })\n end",
"def index\n @teams = Team.joins('LEFT OUTER JOIN clubs on teams.club_id = clubs.id').select('teams.*, clubs.name as club_name')\n\n render json: @teams\n end",
"def joined_members\n client.api.get_room_joined_members(id)[:joined].map do |mxid, data|\n User.new(client, mxid.to_s,\n display_name: data.fetch(:display_name, nil),\n avatar_url: data.fetch(:avatar_url, nil))\n end\n end",
"def index\n if current_user\n @joined_event = []\n @joined = EventUser.where(user_id: current_user.id)\n @joined.each do |x|\n @joined_event << Event.find(x.event_id)\n end\n\n @events = []\n @joined_event_id = []\n @joined.each do |y|\n @joined_event_id << y.event_id\n end\n Event.all.each do |x|\n if @joined_event_id.include? x.id\n # do nothing\n else\n @events << x\n end\n end\n else\n @events = Event.all\n end\n respond_to do |format|\n format.json\n format.html\n end\n end",
"def joins\n @joins\n end",
"def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end",
"def set_joined\n @joined = Joined.find(params[:id])\n end",
"def join\n circle_id = params[:circle][:circle_id]\n circle_url = File.join(SITE_URL, \"circles/#{circle_id}\")\n\n joined = CircleUser.where(circle_id: circle_id, user_id: current_user.id).first_or_initialize\n\n respond_to do |format|\n if not joined.persisted?\n joined.save\n Circle.update_counters(params[:circle][:circle_id], people_count: 1)\n User.update_counters(current_user.id, circle_count: 1)\n mod = 1\n else\n joined.delete\n Circle.update_counters(params[:circle][:circle_id], people_count: -1)\n User.update_counters(current_user.id, circle_count: -1)\n mod = -1\n end\n format.json { render json: {'status' => mod, 'circle_url' => circle_url}, status: :created }\n end\n end",
"def has_joined\n @username = params[:username]\n server = params[:serverId]\n\n sessions = Session.joins(:user).where(\n serverid: server,\n users: { username: @username }\n )\n if sessions.empty?\n render json: { error: 'Bad login', errorMessage: 'Bad login' }\n return\n else\n user = sessions.first.user\n @uuid = sessions.first.uuid\n @textures = gen_texdata(@uuid, user.username, user, request.host)\n end\n end",
"def users_joined\n raise Pundit::NotAuthorizedError unless Api::V0::StatisticsPolicy.new(@user, :statistics).users_joined?\n\n scoped = User.unscoped.where.not(confirmed_at: nil)\n if @user.can_super_admin? && params[:org_id].present?\n scoped = scoped.where(org_id: params[:org_id])\n else\n scoped = scoped.where(org_id: @user.org_id)\n end\n\n if params[:range_dates].present?\n r = {}\n params[:range_dates].each_pair do |k, v|\n r[k] = scoped\n .where('created_at >=?', v['start_date'])\n .where('created_at <=?', v['end_date']).count\n end\n respond_to do |format|\n format.json { render(json: r.to_json) }\n format.csv { \n send_data(CSV.generate do |csv|\n csv << [_('Month'), _('No. Users joined')]\n total = 0\n r.each_pair{ |k,v| csv << [k,v]; total+=v }\n csv << [_('Total'), total]\n end, filename: \"#{_('users_joined')}.csv\") } \n end\n else\n scoped = scoped.where('created_at >= ?', Date.parse(params[:start_date])) if params[:start_date].present?\n scoped = scoped.where('created_at <= ?', Date.parse(params[:end_date])) if params[:end_date].present?\n @users_count = scoped.count\n respond_with @users_count\n end\n end",
"def index\n render json: current_org.users\n end",
"def index\n @accounts = current_user.person.linked_in_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end",
"def joined_guilds\r\n @cache.get(:guilds, lifetime: DList::CACHE_LIFETIME) do\r\n DList._get('/users/me/guilds', @token)\r\n end\r\n end",
"def joined\n meta(joined: true)\n end",
"def join \n\n #Check if user exists\n user = User.find_by!(id: params[:user_id])\n\n if (ChannelJoined.exists?({ channel_id: params[:id], user_id: params[:user_id]}))\n json_response({\n \"joined\": true\n })\n else\n joined = ChannelJoined.create!(user_id: params[:user_id], channel_id: params[:id])\n json_response(joined.channel)\n end\n \n \n end",
"def create\n @joined = Joined.new(joined_params)\n\n respond_to do |format|\n if @joined.save\n format.html { redirect_to @joined, notice: 'Joined was successfully created.' }\n format.json { render :show, status: :created, location: @joined }\n else\n format.html { render :new }\n format.json { render json: @joined.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index_attending\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.attended_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def index\n @course = params[:course_id]\n @students = Student.left_join_enrolls @course\n puts @students.as_json\n end",
"def fetch\n conversation_users = paginate ConversationUser.where(conversation_id: params[:conversation_id])\n\n render json: conversation_users.to_json(:include => :user)\n end",
"def index\n puts \"<><><><><><><><><><><><><><><><><><><><><>\"\n p params\n puts \"<><><><><><><><><><><><><><><><><><><><><>\"\n # @journeys = current_user.journeys\n @journeys = User.find_by_id(params[:user_id]).journeys\n render json: @journeys.to_a\n end",
"def show\n @creator = User.find_by(id: @game.creator_id)\n @joined_users_name = Array.new\n @game.user_games.each do |joined_users|\n @this = User.find_by(id: joined_users.user_id)\n @joined_users_name << @this.nickname\n end\n end",
"def participatingtournaments_feed\n tournaments= getpartipatingtournaments\n tournamentslist = tournaments.map do |t|\n { :tournament_id=>t.id, :title=> t.name, :start => t.start_date }\n end\n\n render :json=> tournamentslist.to_json\n end",
"def resumes_joining\n\t @resumes = ReqMatch.where(:status => \"JOINING\")\n\t\trender \"resumes/joining\"\n\tend",
"def index\n @followships = Follower.all\n render json: @followships\n end",
"def index\n @leads = Lead.upcoming\n .includes(:updates, :agents, :agent)\n .order(created_at: :desc)\n .page(params[:page])\n .per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leads }\n end\n end",
"def index\n @matches = @current_user.matches.includes(:matched_with_user) + @current_user.matched_with_users.includes(:user)\n options = {include: [:user, :matched_with_user]}\n render json: serializer.new(@matches, options), include: ['user', 'matched_with_user']\n end",
"def index\n @owners = Owner.all\n render json: @owners, include: [], adapter: :json\n end",
"def index\n respond_with Relationships.all\n end",
"def index\n @games_leaderboards = Games::Leaderboard.all\n\n render json: @games_leaderboards\n end",
"def index\n @relationships = @relationships.order(created_at: :desc).page(params[:page])\n\n respond_to do |format|\n format.html { @relationships = @relationships.includes(:follower, :followed) }\n format.json {}\n end\n end",
"def index\n @leagues = League.includes(:teams)\n Rails.logger.debug \"********************************************************\"\n @leagues.each do |league|\n Rails.logger.debug league.inspect\n Rails.logger.debug league.teams.inspect\n end\n Rails.logger.debug \"********************************************************\" \n end",
"def index\n @guests = Guest.all.order(:last_name)\n respond_with(@guests) do |format|\n format.to_json { @guests.to_json(:include => [:party, :group]) }\n end\n end",
"def list\n render json: User.all\n end",
"def joins\n []\n end",
"def users_joined?\n true\n end",
"def owned\n @relations = @user.owned.paginate(page: params[:page], per_page: 10)\n respond_to do |format|\n format.html\n format.amp\n format.json\n format.js\n end\n end",
"def lasids\n render json: Student.all.pluck(:local_id) # not just active students\n end",
"def show\n @events = Event.all\n @has_joined = nil\n if !current_user.nil?\n @has_joined = Sailing.joins(:travelling_parties => {:party_registers => :user}).find_by(:id => params[:id], \"users.id\" => current_user.id)\n end\n end",
"def index\n @leagues = League.all\n render json: @leagues, status: :ok\n end",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def index\n if (params[:redirect] == \"on\")\n sql = <<-SQL\n WITH src AS (SELECT id, daughters(id)\n FROM kine WHERE owner_id = #{params[:search_owner]})\n SELECT json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n else\n @daughters = Daughter.all\n end\n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def joins\n []\n end",
"def index\n game = Game.all\n\n render json: game, include: :teams\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def all_followships\n followships = User.find(params[:user_id]).followships\n render :json => followships\n end",
"def getConversations\n @conversations = Conversation.all.select(\"name\").map(&:name)\n\n respond_to do |format|\n format.json {render :json => {:conversations => @conversations}}\n end\n end",
"def rooms\n response = self.class.get(@api.user_joined_rooms_config[:url],\n :query => { :auth_token => @token }.merge(@api.user_joined_rooms_config[:query_params]),\n :headers => @api.headers\n )\n ErrorHandler.response_code_to_exception_for :user, user_id, response\n User.new(@token, response.merge(:api_version => @api.version))\n end",
"def index\n @maps = current_user.owned_maps\n respond_with @maps, :include => :waypoints\n end",
"def index\n ends = End.find_each\n render json: ends\n end",
"def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end",
"def network_joins(id)\n response = request(:get, \"/settings/hypervisor_zones/#{id}/network_joins.json\")\n response.collect { |i| i['network_join'] }\n end",
"def lasids\n render json: Student.pluck(:local_id)\n end",
"def index\n # Vudo - Need to remove soft-deleted matchups\n @matchups = Matchup.includes(:home_team, :away_team).all\n render :json => @matchups, :include => [:home_team, :away_team]\n end",
"def all\n @users = User.only(:id, :name, :about_me, :avatar_file_name, :avatar_updated_at).not_in(:id => current_user.follow_ids).not_in(:id => [current_user])\n\n respond_to do |format|\n format.html\n format.json { render :json => { :users => @users.as_json(:json => 'wall') }}\n end\n end",
"def index\n @my_ministries = MyMinistry.all\n @ministries = Ministry.find(:all, order: \"id\")\n @coworkers = Coworker.all\n person_count = 0\n @coworkers.each do |coworker|\n if coworker.ministries.any?\n person_count += 1\n end\n end\n @joined_ministry_person_count = person_count\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_ministries }\n end\n end",
"def list_relationships\n end",
"def findFollowees\n @user = User.find(params[:id])\n @followees = @user.followees.all\n render json: @followees, status: :ok\n end",
"def users\n get('get_users')\n end",
"def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end",
"def joined?\n meta[:joined].equal?(true)\n end",
"def index\n @users = User.all\n if name = params[:name]\n @users = User.joins(:university).where(universities: {name: name})\n end\n render json: @users\n end",
"def join_for(user)\n joins.find_by_user_id(user)\n end",
"def all\n render :json => User.all_names\n end",
"def index\n @join_user_to_assistants = JoinUserToAssistant.all\n end",
"def index\n @people = Person.all\n respond_to do |format|\n format.json { \n render json: @people, :include => [:roles => { include: [:privileges] } ]\n }\n end\n end",
"def index\n @game = Game.find(params[:game_id])\n @participants = @game.joinable_participants_for_user(current_user)\n end",
"def friend_search()\n users = User.all.map {|u| u.email }.concat( Candidate.all.map {|u| u.email } )\n render :json => users\n end",
"def users\n get(:users)['Users'].map do |details|\n User.new(details['Url'], party: self, details: details)\n end\n end",
"def index\n\t\t@participants = Participant.all\n\n\t\trender json: @participants\n\tend",
"def index\n @teams = @olympiad.teams.includes(:registrations, :users, :posts).order(:name)\n end",
"def follower\n @users = User.find(params[:id]).followers\n render json: @users\n end",
"def index\n gon.yourID = current_user.id\n current_user.game == nil ? @games = Game.all : @games = Game.find(current_user.game.id)\n @team1 = @games.team1.users if @games.try :team1\n @team2 = @games.team2.users if @games.try :team2\n respond_to do |format|\n format.html\n format.json { render :json => { :games => @games.to_json(:include => [:users]),\n :user => current_user.game,\n :will => current_user.will,\n :team1 => @team1,\n :team2 => @team2 }\n }\n end\n end",
"def index\n render json: Lobby.all.as_json( only: [:id, :name] )\n end",
"def fetch\n follows = Follow.where(follower_id: params[:user_id])\n paginate json: follows.to_json(:include => :following)\n end",
"def index\n @lendings = Lending.all\n end",
"def index\n @members = Member.members\n @participants = Member.participants\n @invited_count = Member.count\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def index\n @warriors = Warrior.all\n render :json => @warriors, :include => [:skills, :equipment_lists,]\n\n end",
"def index\n json_response(User.all) \n end",
"def teams\n render json: @team_query\n end",
"def index\n professors = Professor.includes(:courses).all\n\n render json: professors.to_json(include: :courses)\n end",
"def index\n @users_meetings = UsersMeeting.all\n end",
"def index\n\t\tmembers = Member.where(team_id: params[:team_id]).all\n\t\trespond_with members\n\tend",
"def list\n slugs = Slug.all\n result = slugs.collect{ |x|\n\n {\n 'name' => x.name }\n }\n\n render json: {available_slugs: result}\n end",
"def index\n @likes = target.likes.includes(:author => :profile)\n @people = @likes.map(&:author)\n\n respond_to do |format|\n format.all { render :layout => false }\n format.json { render :json => @likes.as_api_response(:backbone) }\n end\n end",
"def user_relationship\n if request.xhr?\n organization_id = params[\"organization_id\"]\n per_page = params[:iDisplayLength] || Settings.per_page\n page = params[:iDisplayStart] ? ((params[:iDisplayStart].to_i/per_page.to_i) + 1) : 1\n params[:iSortCol_0] = 1 if params[:iSortCol_0].blank?\n sort_field = SORT_MAP_RELATIONSHIP[params[:iSortCol_0].to_i]\n # @users = User.get_all_users_except_id(current_user.id, page, per_page, params[:sSearch], sort_field + \" \" + params[:sSortDir_0],organization_id)\n @users = User.get_user_to_relationship(page, per_page, params[:sSearch], sort_field + \" \" + params[:sSortDir_0])\n render :json => @users\n return\n end\n end",
"def index\n @recipients = Recipient.all\n # render json: @recipients\n end",
"def show\n respond_to do |format|\n people = @mob.user_idz.split(',').map{|i| User.find(i).name }.join(', ')\n format.json { render json: @mob.attributes.merge(people: people, users: @mob.users, date: Time.now.strftime('%-m/%-d/%Y')) }\n end\n end",
"def index\n @projects = Project.includes(:participants).all\n\n render json: @projects, include: :participants, status: 200\n end",
"def index\n if params[:meeting_id] && params[:team_id]\n @passages = Passage.includes(:team, :meeting).where(\n 'meetings.id' => params[:meeting_id],\n 'teams.id' => params[:team_id]\n ).to_a\n else\n @passages = []\n end\n render status: 200, json: @passages\n end",
"def index\n @player_relationships = PlayerRelationship.all\n end",
"def users\n\t\trespond_with User.all\n\tend",
"def list\n get('users')['users']\n end",
"def index\n @instructors = Instructor.all\n # render json: @instructors.to_json\n render json: @instructors.to_json(only: [:first_name, :last_name, :region, :photo, :email, :bio, :instagram, :experience, :user_id],\n include: [schedules: { only: [:title, :start, :end, :instructor_id, :workout_id]}])\n end",
"def index\n @colleagues = Colleague.all\n end",
"def index\n @colleagues = Colleague.all\n end",
"def index\n @colleagues = Colleague.all\n end",
"def index\n @admins = Admin.all\n\n render json: @admins\n end",
"def index\n @games = Game.all \n @users = User.all \n @current_user_joined = false \n \n end"
] |
[
"0.61768925",
"0.61329937",
"0.59698355",
"0.59334886",
"0.5906871",
"0.5827686",
"0.581064",
"0.5772694",
"0.57302773",
"0.57184124",
"0.5696679",
"0.569448",
"0.56850386",
"0.5662305",
"0.5612134",
"0.5599845",
"0.5598919",
"0.5598491",
"0.55726105",
"0.5572074",
"0.55675316",
"0.5553425",
"0.5545631",
"0.55397093",
"0.55254394",
"0.5501425",
"0.5492472",
"0.5490805",
"0.54875654",
"0.54844606",
"0.54635346",
"0.5460626",
"0.54517186",
"0.54512995",
"0.5428008",
"0.54133165",
"0.5409001",
"0.5384418",
"0.53814113",
"0.5380892",
"0.53799534",
"0.5375993",
"0.5372171",
"0.53498983",
"0.53477526",
"0.5346646",
"0.53312844",
"0.5325796",
"0.53231895",
"0.5317566",
"0.5317117",
"0.5314799",
"0.531325",
"0.5306628",
"0.52986175",
"0.52870387",
"0.5285896",
"0.5276404",
"0.5276157",
"0.52675307",
"0.5258789",
"0.52561975",
"0.5254392",
"0.5253461",
"0.5251968",
"0.52509767",
"0.5248738",
"0.52486765",
"0.5245921",
"0.5242096",
"0.52404153",
"0.5235329",
"0.5232214",
"0.523078",
"0.5228305",
"0.522763",
"0.5226229",
"0.5223371",
"0.52207005",
"0.5219275",
"0.5216506",
"0.5216349",
"0.52140266",
"0.52077997",
"0.5204671",
"0.5198816",
"0.51943886",
"0.5189866",
"0.5189356",
"0.5188663",
"0.5188095",
"0.518748",
"0.51873475",
"0.5187312",
"0.5177974",
"0.517791",
"0.517791",
"0.517791",
"0.5173576",
"0.5173135"
] |
0.7064796
|
0
|
GET /joineds/1 GET /joineds/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @joineds = Joined.all\n end",
"def user_joined\n user = User.find_by!(id: params[:user_id])\n return json_response({\n \"joined\": ChannelJoined.exists?({\n channel_id: params[:id],\n user_id: params[:user_id]\n })\n })\n end",
"def set_joined\n @joined = Joined.find(params[:id])\n end",
"def join\n circle_id = params[:circle][:circle_id]\n circle_url = File.join(SITE_URL, \"circles/#{circle_id}\")\n\n joined = CircleUser.where(circle_id: circle_id, user_id: current_user.id).first_or_initialize\n\n respond_to do |format|\n if not joined.persisted?\n joined.save\n Circle.update_counters(params[:circle][:circle_id], people_count: 1)\n User.update_counters(current_user.id, circle_count: 1)\n mod = 1\n else\n joined.delete\n Circle.update_counters(params[:circle][:circle_id], people_count: -1)\n User.update_counters(current_user.id, circle_count: -1)\n mod = -1\n end\n format.json { render json: {'status' => mod, 'circle_url' => circle_url}, status: :created }\n end\n end",
"def index\n @teams = Team.joins('LEFT OUTER JOIN clubs on teams.club_id = clubs.id').select('teams.*, clubs.name as club_name')\n\n render json: @teams\n end",
"def users\n channel = Channel.find(params[:id])\n users = ChannelJoined.where(channel_id: params[:id])\n return json_response({\n users: users.map{|j| j.user}\n })\n end",
"def index\n render json: current_org.users\n end",
"def joined_members\n client.api.get_room_joined_members(id)[:joined].map do |mxid, data|\n User.new(client, mxid.to_s,\n display_name: data.fetch(:display_name, nil),\n avatar_url: data.fetch(:avatar_url, nil))\n end\n end",
"def create\n @joined = Joined.new(joined_params)\n\n respond_to do |format|\n if @joined.save\n format.html { redirect_to @joined, notice: 'Joined was successfully created.' }\n format.json { render :show, status: :created, location: @joined }\n else\n format.html { render :new }\n format.json { render json: @joined.errors, status: :unprocessable_entity }\n end\n end\n end",
"def has_joined\n @username = params[:username]\n server = params[:serverId]\n\n sessions = Session.joins(:user).where(\n serverid: server,\n users: { username: @username }\n )\n if sessions.empty?\n render json: { error: 'Bad login', errorMessage: 'Bad login' }\n return\n else\n user = sessions.first.user\n @uuid = sessions.first.uuid\n @textures = gen_texdata(@uuid, user.username, user, request.host)\n end\n end",
"def join \n\n #Check if user exists\n user = User.find_by!(id: params[:user_id])\n\n if (ChannelJoined.exists?({ channel_id: params[:id], user_id: params[:user_id]}))\n json_response({\n \"joined\": true\n })\n else\n joined = ChannelJoined.create!(user_id: params[:user_id], channel_id: params[:id])\n json_response(joined.channel)\n end\n \n \n end",
"def show\n @creator = User.find_by(id: @game.creator_id)\n @joined_users_name = Array.new\n @game.user_games.each do |joined_users|\n @this = User.find_by(id: joined_users.user_id)\n @joined_users_name << @this.nickname\n end\n end",
"def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end",
"def index\n if current_user\n @joined_event = []\n @joined = EventUser.where(user_id: current_user.id)\n @joined.each do |x|\n @joined_event << Event.find(x.event_id)\n end\n\n @events = []\n @joined_event_id = []\n @joined.each do |y|\n @joined_event_id << y.event_id\n end\n Event.all.each do |x|\n if @joined_event_id.include? x.id\n # do nothing\n else\n @events << x\n end\n end\n else\n @events = Event.all\n end\n respond_to do |format|\n format.json\n format.html\n end\n end",
"def index\n @accounts = current_user.person.linked_in_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end",
"def index\n puts \"<><><><><><><><><><><><><><><><><><><><><>\"\n p params\n puts \"<><><><><><><><><><><><><><><><><><><><><>\"\n # @journeys = current_user.journeys\n @journeys = User.find_by_id(params[:user_id]).journeys\n render json: @journeys.to_a\n end",
"def index_attending\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.attended_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def index\n @games_leaderboards = Games::Leaderboard.all\n\n render json: @games_leaderboards\n end",
"def fetch\n conversation_users = paginate ConversationUser.where(conversation_id: params[:conversation_id])\n\n render json: conversation_users.to_json(:include => :user)\n end",
"def index\n @course = params[:course_id]\n @students = Student.left_join_enrolls @course\n puts @students.as_json\n end",
"def joined\n meta(joined: true)\n end",
"def show\n respond_to do |format|\n people = @mob.user_idz.split(',').map{|i| User.find(i).name }.join(', ')\n format.json { render json: @mob.attributes.merge(people: people, users: @mob.users, date: Time.now.strftime('%-m/%-d/%Y')) }\n end\n end",
"def index\n @followships = Follower.all\n render json: @followships\n end",
"def show\n @events = Event.all\n @has_joined = nil\n if !current_user.nil?\n @has_joined = Sailing.joins(:travelling_parties => {:party_registers => :user}).find_by(:id => params[:id], \"users.id\" => current_user.id)\n end\n end",
"def users_joined\n raise Pundit::NotAuthorizedError unless Api::V0::StatisticsPolicy.new(@user, :statistics).users_joined?\n\n scoped = User.unscoped.where.not(confirmed_at: nil)\n if @user.can_super_admin? && params[:org_id].present?\n scoped = scoped.where(org_id: params[:org_id])\n else\n scoped = scoped.where(org_id: @user.org_id)\n end\n\n if params[:range_dates].present?\n r = {}\n params[:range_dates].each_pair do |k, v|\n r[k] = scoped\n .where('created_at >=?', v['start_date'])\n .where('created_at <=?', v['end_date']).count\n end\n respond_to do |format|\n format.json { render(json: r.to_json) }\n format.csv { \n send_data(CSV.generate do |csv|\n csv << [_('Month'), _('No. Users joined')]\n total = 0\n r.each_pair{ |k,v| csv << [k,v]; total+=v }\n csv << [_('Total'), total]\n end, filename: \"#{_('users_joined')}.csv\") } \n end\n else\n scoped = scoped.where('created_at >= ?', Date.parse(params[:start_date])) if params[:start_date].present?\n scoped = scoped.where('created_at <= ?', Date.parse(params[:end_date])) if params[:end_date].present?\n @users_count = scoped.count\n respond_with @users_count\n end\n end",
"def index\n @leagues = League.all\n render json: @leagues, status: :ok\n end",
"def lasids\n render json: Student.all.pluck(:local_id) # not just active students\n end",
"def index\n @leagues = League.includes(:teams)\n Rails.logger.debug \"********************************************************\"\n @leagues.each do |league|\n Rails.logger.debug league.inspect\n Rails.logger.debug league.teams.inspect\n end\n Rails.logger.debug \"********************************************************\" \n end",
"def joined_guilds\r\n @cache.get(:guilds, lifetime: DList::CACHE_LIFETIME) do\r\n DList._get('/users/me/guilds', @token)\r\n end\r\n end",
"def lasids\n render json: Student.pluck(:local_id)\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def rooms\n response = self.class.get(@api.user_joined_rooms_config[:url],\n :query => { :auth_token => @token }.merge(@api.user_joined_rooms_config[:query_params]),\n :headers => @api.headers\n )\n ErrorHandler.response_code_to_exception_for :user, user_id, response\n User.new(@token, response.merge(:api_version => @api.version))\n end",
"def index\n @owners = Owner.all\n render json: @owners, include: [], adapter: :json\n end",
"def update\n respond_to do |format|\n if @joined.update(joined_params)\n format.html { redirect_to @joined, notice: 'Joined was successfully updated.' }\n format.json { render :show, status: :ok, location: @joined }\n else\n format.html { render :edit }\n format.json { render json: @joined.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list\n render json: User.all\n end",
"def index\n @guests = Guest.all.order(:last_name)\n respond_with(@guests) do |format|\n format.to_json { @guests.to_json(:include => [:party, :group]) }\n end\n end",
"def show\n @leader = Leader.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leader }\n end\n end",
"def identities\n render json: current_user.identities\n end",
"def index\n render json: Lobby.all.as_json( only: [:id, :name] )\n end",
"def join_for(user)\n joins.find_by_user_id(user)\n end",
"def network_joins(id)\n response = request(:get, \"/settings/hypervisor_zones/#{id}/network_joins.json\")\n response.collect { |i| i['network_join'] }\n end",
"def follower\n @users = User.find(params[:id]).followers\n render json: @users\n end",
"def index\n @matches = @current_user.matches.includes(:matched_with_user) + @current_user.matched_with_users.includes(:user)\n options = {include: [:user, :matched_with_user]}\n render json: serializer.new(@matches, options), include: ['user', 'matched_with_user']\n end",
"def destroy\n @joined.destroy\n respond_to do |format|\n format.html { redirect_to joineds_url, notice: 'Joined was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n gon.yourID = current_user.id\n current_user.game == nil ? @games = Game.all : @games = Game.find(current_user.game.id)\n @team1 = @games.team1.users if @games.try :team1\n @team2 = @games.team2.users if @games.try :team2\n respond_to do |format|\n format.html\n format.json { render :json => { :games => @games.to_json(:include => [:users]),\n :user => current_user.game,\n :will => current_user.will,\n :team1 => @team1,\n :team2 => @team2 }\n }\n end\n end",
"def show\n @user = User.includes(:watched_houses).find(params[:id])\n render json: { user: @user, watched_houses: @user.watched_houses }\n end",
"def index\n if (params[:redirect] == \"on\")\n sql = <<-SQL\n WITH src AS (SELECT id, daughters(id)\n FROM kine WHERE owner_id = #{params[:search_owner]})\n SELECT json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n else\n @daughters = Daughter.all\n end\n end",
"def index\n #since trainers is conncected to gym\n #find the gym where the id of gym is equal to the trainer\n #SO THIS WILL TARGET SPECEFIC PEOPLE WHOS GYM.ID IS EQUAL TO TRAINER gym_id\n @gym=Gym.find(params[:gym_id])\n @trainers=Trainer.where(gym_id: @gym.id)\n render json: @trainers, include: :clients, status: :ok\n end",
"def index\n game = Game.all\n\n render json: game, include: :teams\n end",
"def index\n @users = User.all\n if name = params[:name]\n @users = User.joins(:university).where(universities: {name: name})\n end\n render json: @users\n end",
"def index\n @my_ministries = MyMinistry.all\n @ministries = Ministry.find(:all, order: \"id\")\n @coworkers = Coworker.all\n person_count = 0\n @coworkers.each do |coworker|\n if coworker.ministries.any?\n person_count += 1\n end\n end\n @joined_ministry_person_count = person_count\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_ministries }\n end\n end",
"def show\n if user_signed_in?\n @join = Join.where(user_id: current_user.id, escape_id: params[:id])\n else\n @join = []\n end\n end",
"def index\n json_response(User.all) \n end",
"def create\n @joined_user = JoinedUser.new(joined_user_params)\n\n respond_to do |format|\n if @joined_user.save\n format.html { redirect_to @joined_user, notice: 'Joined user was successfully created.' }\n format.json { render :show, status: :created, location: @joined_user }\n else\n format.html { render :new }\n format.json { render json: @joined_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @members = Member.members\n @participants = Member.participants\n @invited_count = Member.count\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end",
"def index\n @leads = Lead.upcoming\n .includes(:updates, :agents, :agent)\n .order(created_at: :desc)\n .page(params[:page])\n .per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leads }\n end\n end",
"def index\n @warriors = Warrior.all\n render :json => @warriors, :include => [:skills, :equipment_lists,]\n\n end",
"def index\n @recipients = Recipient.all\n # render json: @recipients\n end",
"def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end",
"def resumes_joining\n\t @resumes = ReqMatch.where(:status => \"JOINING\")\n\t\trender \"resumes/joining\"\n\tend",
"def index\n @people = Person.all\n respond_to do |format|\n format.json { \n render json: @people, :include => [:roles => { include: [:privileges] } ]\n }\n end\n end",
"def index\n ### WHAT IF ANOTHER USER IS TRYING TO LOOK AT\n # ANOTHER USER'S COLLECTION?\n #\n @collections = @current_user.collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def index\n respond_with Relationships.all\n end",
"def index\n\t\t@participants = Participant.all\n\n\t\trender json: @participants\n\tend",
"def index\n # @teams = Team.all\n \n redirect_to \"/members\"\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @teams }\n # end\n end",
"def owned\n @relations = @user.owned.paginate(page: params[:page], per_page: 10)\n respond_to do |format|\n format.html\n format.amp\n format.json\n format.js\n end\n end",
"def show\n @user = User.find_by_id(params[:id])\n\n if @user\n render json: @user.to_json(include: [:games]), status: 200\n else\n render json: {error: \"User not found\"}, status: 404\n end\n end",
"def show\n render json: @games_leaderboard\n end",
"def index\n ends = End.find_each\n render json: ends\n end",
"def index_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def show\n @story = Story.all(:include => :role, :conditions => {:stories => { :id => params[:id] } })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end",
"def index\n @relationships = @relationships.order(created_at: :desc).page(params[:page])\n\n respond_to do |format|\n format.html { @relationships = @relationships.includes(:follower, :followed) }\n format.json {}\n end\n end",
"def index\n @admins = Admin.all\n\n render json: @admins\n end",
"def joins\n @joins\n end",
"def users_joined?\n true\n end",
"def show\n team = Team.find(params[:id])\n image_url = team.image.url\n members = team.members.select(:name, :surname)\n member_names = []\n members.each do |m|\n member_names.push(m.name + \" \" + m.surname)\n end\n team = team.attributes\n\n team[:members] = member_names\n team[:image] = image_url\n render json: team\n end",
"def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end",
"def show\n @enrolled = Enrolled.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enrolled }\n end\n end",
"def participatingtournaments_feed\n tournaments= getpartipatingtournaments\n tournamentslist = tournaments.map do |t|\n { :tournament_id=>t.id, :title=> t.name, :start => t.start_date }\n end\n\n render :json=> tournamentslist.to_json\n end",
"def index\n @identities = Identity.all\n\n render json: @identities\n end",
"def all\n render :json => User.all_names\n end",
"def show\n @user = User.find(params[:id])\n gon.user_id = @user.id\n gon.conversations = @user.conversations.select(\"name\").map(&:name)\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def get_user_relationships_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"relationships\"] = user.get_relationship_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def index\n @teams = Team.all\n render :json => @teams\n end",
"def index\n # Vudo - Need to remove soft-deleted matchups\n @matchups = Matchup.includes(:home_team, :away_team).all\n render :json => @matchups, :include => [:home_team, :away_team]\n end",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relationships }\n end\n end",
"def index\n render json: Users.all\n end",
"def index\n @game = Game.find(params[:game_id])\n @participants = @game.joinable_participants_for_user(current_user)\n end",
"def index\n @teams = Team.all\n render json: @teams\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def index\n @maps = current_user.owned_maps\n respond_with @maps, :include => :waypoints\n end",
"def getConversations\n @conversations = Conversation.all.select(\"name\").map(&:name)\n\n respond_to do |format|\n format.json {render :json => {:conversations => @conversations}}\n end\n end",
"def index\n\t\tmembers = Member.where(team_id: params[:team_id]).all\n\t\trespond_with members\n\tend",
"def leaderboard\n get(\"/user/#{@user_id}/friends/leaderboard.json\")\n end",
"def join\n @person = Person.find(params[:person_id])\n @group = Group.find(params[:id])\n begin\n @person.join_group(@group.id, session[:cookie])\n flash[:notice] = [ :you_have_joined_to_group, @group.title(session[:cookie]) ]\n rescue RestClient::RequestFailed => e\n flash[:error] = message_from_error(e)\n end\n redirect_to group_path(params[:id])\n end",
"def index\n @announcements = Announcement.all\n render json: @announcements, include: [:member => {only: [:first_name, :last_name, :id]}]\n end",
"def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end",
"def join\n payload = { \"id\" => id }.to_json\n data = client.post \"#{api_prefix}/user/#{client.user.id}/rooms\", payload\n\n self\n end"
] |
[
"0.67032146",
"0.6174915",
"0.6073189",
"0.59284824",
"0.5924489",
"0.58915406",
"0.5827733",
"0.5800685",
"0.57807183",
"0.57568157",
"0.5742195",
"0.5738427",
"0.572748",
"0.57067174",
"0.5691861",
"0.55379844",
"0.5535582",
"0.5505199",
"0.5478197",
"0.5476489",
"0.5422311",
"0.5407845",
"0.5387898",
"0.5359587",
"0.5342472",
"0.5338102",
"0.5337045",
"0.5336751",
"0.53293866",
"0.5325918",
"0.5324123",
"0.53201705",
"0.53198636",
"0.5316635",
"0.5311869",
"0.53073233",
"0.5304202",
"0.5299042",
"0.5288333",
"0.5286563",
"0.5276739",
"0.5267508",
"0.5262265",
"0.5259626",
"0.5255774",
"0.5250341",
"0.52453417",
"0.5243121",
"0.5242103",
"0.5241753",
"0.52329654",
"0.52300316",
"0.52298754",
"0.52267325",
"0.5222962",
"0.52220803",
"0.5213379",
"0.5213055",
"0.5210751",
"0.52106595",
"0.52057004",
"0.5205055",
"0.52027094",
"0.5196603",
"0.5195494",
"0.5188504",
"0.5186641",
"0.518427",
"0.51818246",
"0.5180525",
"0.5180494",
"0.5178035",
"0.51685536",
"0.51672775",
"0.5166168",
"0.5160166",
"0.5156275",
"0.5154675",
"0.51527095",
"0.51472175",
"0.5145541",
"0.5145219",
"0.5143577",
"0.51427054",
"0.5131285",
"0.5125886",
"0.5125347",
"0.51238126",
"0.5119143",
"0.5119088",
"0.51186216",
"0.5118348",
"0.511176",
"0.5108868",
"0.51079214",
"0.51036173",
"0.5100742",
"0.50999",
"0.5095972",
"0.50930077",
"0.50927234"
] |
0.0
|
-1
|
POST /joineds POST /joineds.json
|
def create
@joined = Joined.new(joined_params)
respond_to do |format|
if @joined.save
format.html { redirect_to @joined, notice: 'Joined was successfully created.' }
format.json { render :show, status: :created, location: @joined }
else
format.html { render :new }
format.json { render json: @joined.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @joined_user = JoinedUser.new(joined_user_params)\n\n respond_to do |format|\n if @joined_user.save\n format.html { redirect_to @joined_user, notice: 'Joined user was successfully created.' }\n format.json { render :show, status: :created, location: @joined_user }\n else\n format.html { render :new }\n format.json { render json: @joined_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @joineds = Joined.all\n end",
"def set_joined\n @joined = Joined.find(params[:id])\n end",
"def joined_params\n params.require(:joined).permit(:order_id, :user_id)\n end",
"def join\n circle_id = params[:circle][:circle_id]\n circle_url = File.join(SITE_URL, \"circles/#{circle_id}\")\n\n joined = CircleUser.where(circle_id: circle_id, user_id: current_user.id).first_or_initialize\n\n respond_to do |format|\n if not joined.persisted?\n joined.save\n Circle.update_counters(params[:circle][:circle_id], people_count: 1)\n User.update_counters(current_user.id, circle_count: 1)\n mod = 1\n else\n joined.delete\n Circle.update_counters(params[:circle][:circle_id], people_count: -1)\n User.update_counters(current_user.id, circle_count: -1)\n mod = -1\n end\n format.json { render json: {'status' => mod, 'circle_url' => circle_url}, status: :created }\n end\n end",
"def user_joined\n user = User.find_by!(id: params[:user_id])\n return json_response({\n \"joined\": ChannelJoined.exists?({\n channel_id: params[:id],\n user_id: params[:user_id]\n })\n })\n end",
"def update\n respond_to do |format|\n if @joined.update(joined_params)\n format.html { redirect_to @joined, notice: 'Joined was successfully updated.' }\n format.json { render :show, status: :ok, location: @joined }\n else\n format.html { render :edit }\n format.json { render json: @joined.errors, status: :unprocessable_entity }\n end\n end\n end",
"def join \n\n #Check if user exists\n user = User.find_by!(id: params[:user_id])\n\n if (ChannelJoined.exists?({ channel_id: params[:id], user_id: params[:user_id]}))\n json_response({\n \"joined\": true\n })\n else\n joined = ChannelJoined.create!(user_id: params[:user_id], channel_id: params[:id])\n json_response(joined.channel)\n end\n \n \n end",
"def create_or_join\n res = Conversation.create_or_join(uuid: conversation_params[:uuid])\n serializer = ConversationSerializer.new(res[:conversation])\n render json: serializer.serializable_hash.merge(user_index: res[:user_index])\n end",
"def create\n @join = Join.new(user_id: current_user.id, event_id: params[:event_id])\n if @join.save\n redirect_to \"/events\"\n else\n redirect_to \"/events\"\n end\n end",
"def join\n @person = Person.find(params[:person_id])\n @group = Group.find(params[:id])\n begin\n @person.join_group(@group.id, session[:cookie])\n flash[:notice] = [ :you_have_joined_to_group, @group.title(session[:cookie]) ]\n rescue RestClient::RequestFailed => e\n flash[:error] = message_from_error(e)\n end\n redirect_to group_path(params[:id])\n end",
"def destroy\n @joined.destroy\n respond_to do |format|\n format.html { redirect_to joineds_url, notice: 'Joined was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def join\n @event = Event.find(params[:event_id])\n if (params[:type] == \"invite\")\n @uids = params[:uids]\n @uid_array = []\n @uid_array = @uids.split(\",\")\n\n @motlee_users = []\n @non_motlee_users = []\n\n @uid_array.each do |uid|\n motlee_user = User.where(:uid => uid).first\n\n if motlee_user.nil?\n token = params[:access_token]\n event_id = params[:event_id]\n Resque.enqueue(ProcessNewUserInvite, token, event_id, uid) \n else\n # User is already a part of Motlee\n # Add user to array of Motlee users\n @motlee_users << uid\n \n # Now we check to see if the user has already been added to the event\n @attendee = Attendee.where(\"user_id = ? AND event_id = ?\", motlee_user.id, params[:event_id]).first\n if @attendee.nil?\n # If user has not been added, create new Attendee object\n @attendee = Attendee.create(:user_id => motlee_user.id, :event_id => params[:event_id], :rsvp_status => 1)\n if (motlee_user.id != current_user.id)\n Resque.enqueue(AddEventNotification, motlee_user.id, params[:event_id], current_user.id)\n end\n end\n end\n end \n else\n @attendee = Attendee.create(:user_id => current_user.id, :event_id => @event.id, :rsvp_status => 1)\n end\n # Render a response so the devices are happy\n @event.update_attributes(:updated_at => Time.now)\n render :json => @event.as_json({:methods => [:owner, :attendee_count], \n :include => {:photos => {:include => {:comments => {}, :likes => {}}}, \n :people_attending => {:only => [:id, :uid, :name, :sign_in_count]}}})\n end",
"def join\r\n if @trip.participants.include?(current_person)\r\n redirect_to(@trip, :notice => \"You are already a participant in the #{@trip.name}.\")\r\n return\r\n elsif @trip.organizers.include?(current_person) && request.post?\r\n @trip.participants << current_person\r\n redirect_to(manage_membership_trip_url(@trip), :notice => \"You are now a participant in the #{@trip.name}.\")\r\n else\r\n @token = params[:token]\r\n invitation = Invitation.find_by_token(@token)\r\n if invitation.nil?\r\n redirect_to(person_root_url, :error => \"The invitation link you followed is invalid.\")\r\n return\r\n end\r\n \r\n if request.post?\r\n invitation.accept(current_person)\r\n redirect_to(manage_membership_trip_url(@trip), :notice => \"You are now a participant in the #{@trip.name}.\")\r\n end\r\n end\r\n end",
"def join\n if request.post?\n if !@group.users.include?(current_user)\n @group.users << current_user\n flash[:success] = \"Thanks! Your membership must now be approved by an admin of #{@group.name}.\"\n\n #SEND OUT NOTIFICATION EMAILS\n @group.admins.each do |admin|\n Notifier.pending_user(admin, @group, current_user).deliver\n end\n\n redirect_to @group\n else\n flash[:error] = \"Error requesting to join #{@group.name}. Please try again.\"\n redirect_to @group\n end\n else #it fell back to GET (no js)\n flash[:error] = \"Please enable javascript to join.\"\n redirect_to @group\n end\n end",
"def create_team_member\n clinics = params[:clinics].split(\", \")\n\n team_member = TeamMember.create(\n email: params[:email],\n first_name: params[:first_name],\n last_name: params[:last_name],\n user: params[:user],\n status: \"Active\",\n role: params[:role]\n )\n\n clinics.each do |clinic|\n Clinic.find(clinic).team_members << team_member\n end\n\n render json: team_member, include: ['clinics']\n end",
"def join\n @reservation = Reservation.find(params[:reservation_id])\n Dining.create(reservation: @reservation, member: current_member)\n Reservationrequest.where(reservation_id: @reservation.id, member_id: @reservation.members.last.id).destroy_all\n flash[:notice] = \"You joined #{@reservation.members.first.first_name} #{@reservation.members.first.last_name}'s reservation.\"\n redirect_to member_reservations_path\n end",
"def users_joined?\n true\n end",
"def join\n course = Course.where(join_token: params[:course][:join_token]).first\n\n if course and not current_user.courses.include? course\n current_user.courses << course\n current_user.add_role :student, course\n course.assignments.each { |assignment| assignment.create_submissions_for_students }\n\n flash[:notice] = \"Successfully joined class\"\n redirect_to course_path(course.id)\n else\n flash[:notice] = \"Failed to join class\"\n redirect_to :back\n end\n end",
"def create\n successes = []\n (params[:invitations].split(',') || []).each do |name|\n name.strip!\n invitation = @game.invitations.build(:twitter_login => name, :invited_by => current_user)\n successes << name if invitation.save\n # TODO: send actual invitations as DMs from the user??\n # TODO: verify that the listed people are actually followers of the user?\n end\n flash[:notice] = \"Invitations have been sent to the #{successes.length} people you selected\"\n redirect_to(game_path(@game))\n end",
"def create\n @join_user_to_assistant = JoinUserToAssistant.new(join_user_to_assistant_params)\n\n respond_to do |format|\n if @join_user_to_assistant.save\n format.html { redirect_to @join_user_to_assistant, notice: 'Join user to assistant was successfully created.' }\n format.json { render :show, status: :created, location: @join_user_to_assistant }\n else\n format.html { render :new }\n format.json { render json: @join_user_to_assistant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def join\n @session = Session.where(unique_id: params[:id])\n @player = Player.new(\n name: params[:name],\n picture_url: params[:picture_url]\n )\n @session.players.push(@player)\n @session.save\n\n render status: :success\n end",
"def create\n @gradework = Gradework.new(gradework_params)\n\n if params.has_key?(:students) and params[:students] != [\"\"]\n students = params[:students]\n @gradework.users << User.find(students)\n end\n\n if params.has_key?(:juries) and params[:juries] != [\"\"]\n juries = params[:juries]\n @gradework.users << User.find(juries)\n end\n\n if params.has_key?(:directors) and params[:directors] =! \"\"\n directors = params[:directors]\n @gradework.users << User.find(directors)\n end\n\n respond_to do |format|\n if @gradework.save!\n format.html { redirect_to @gradework, notice: 'La tesis se creó correctamente' }\n format.json { render :show, status: :created, location: @gradework }\n else\n format.html { redirect_to @gradework, notice: 'La tesis no se pudo crear correctamente' }\n format.json { render json: @gradework.errors, status: :unprocessable_entity }\n end\n end\n end",
"def joined_members\n client.api.get_room_joined_members(id)[:joined].map do |mxid, data|\n User.new(client, mxid.to_s,\n display_name: data.fetch(:display_name, nil),\n avatar_url: data.fetch(:avatar_url, nil))\n end\n end",
"def join\n unless @user && @kroog && @kroog.open? && current_actor.can_follow?\n flash[:warning] = \"Error: The specified circle does not exist or cannot be joined\".t\n respond_to do |format|\n format.html do\n redirect_to(:controller => 'kroogi', :action => 'join_circles', :id => params[:id])\n end\n format.js {render :update do |page|; page << 'document.location.reload(false);'; end}\n end\n return\n end\n\n # Add the relationship directly -- no invite intermediary\n Relationship.create_kroogi_relationship(:followed => @user.id, :follower => current_actor.id, :relationshiptype_id => @kroog.relationshiptype_id, :expires_at => Time.end, :skip_activity_message => true)\n\n flash[:success] = \"You have joined the %s circle of %s\" / [@user.circle_name(params[:circle].to_i), @user.login]\n PublicQuestionHelper::set_question_artist_id(@user, self, :force_show => true)\n respond_to do |wants|\n wants.html do\n redirect_to user_url_for(@user)\n end\n wants.js {}\n end\n end",
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def has_joined\n @username = params[:username]\n server = params[:serverId]\n\n sessions = Session.joins(:user).where(\n serverid: server,\n users: { username: @username }\n )\n if sessions.empty?\n render json: { error: 'Bad login', errorMessage: 'Bad login' }\n return\n else\n user = sessions.first.user\n @uuid = sessions.first.uuid\n @textures = gen_texdata(@uuid, user.username, user, request.host)\n end\n end",
"def users_joined\n raise Pundit::NotAuthorizedError unless Api::V0::StatisticsPolicy.new(@user, :statistics).users_joined?\n\n scoped = User.unscoped.where.not(confirmed_at: nil)\n if @user.can_super_admin? && params[:org_id].present?\n scoped = scoped.where(org_id: params[:org_id])\n else\n scoped = scoped.where(org_id: @user.org_id)\n end\n\n if params[:range_dates].present?\n r = {}\n params[:range_dates].each_pair do |k, v|\n r[k] = scoped\n .where('created_at >=?', v['start_date'])\n .where('created_at <=?', v['end_date']).count\n end\n respond_to do |format|\n format.json { render(json: r.to_json) }\n format.csv { \n send_data(CSV.generate do |csv|\n csv << [_('Month'), _('No. Users joined')]\n total = 0\n r.each_pair{ |k,v| csv << [k,v]; total+=v }\n csv << [_('Total'), total]\n end, filename: \"#{_('users_joined')}.csv\") } \n end\n else\n scoped = scoped.where('created_at >= ?', Date.parse(params[:start_date])) if params[:start_date].present?\n scoped = scoped.where('created_at <= ?', Date.parse(params[:end_date])) if params[:end_date].present?\n @users_count = scoped.count\n respond_with @users_count\n end\n end",
"def join!(user)\n # It loads up all the user because in the case where the chat is saved but the chat_participations have not been saved,\n # this is the only way to ensure we don't have duplicates.\n return if self.chat_participations.map(&:user_id).include?(user.id)\n self.chat_participations.create!(:user => user)\n end",
"def create\n @join = Join.find_by(user_id: current_user.id, hike_id: params[:id])\n if @join\n redirect_to :back\n else\n @join = Join.create(user_id:current_user.id, hike_id:params[:id])\n redirect_to :back\n end\n end",
"def joinsquad\n if params[:id].to_i != @logged_in_registration.id.to_i\n flash[:error] = \"Error! Trying to sign someone else up into a squad?\"\n redirect_to root_url\n elsif @logged_in_registration.squad != nil\n flash[:error] = \"Error! You cannot change your squad.\"\n redirect_to root_url\n elsif !@current_game.has_begun?\n if params[:squadid].eql?(\"new\")\n @squad = Squad.new({\n :name => params[:new_squad_name],\n :leader_id => @logged_in_registration.id,\n :game_id => @current_game.id\n })\n if @squad.save()\n @logged_in_registration.update_attribute(:squad, @squad)\n redirect_to registration_url(@logged_in_registration)\n end\n else\n squad = Squad.find(params[:squadid])\n if squad.can_be_joined?\n @logged_in_registration.update_attribute(:squad, squad)\n redirect_to registration_url(@logged_in_registration)\n else\n flash[:error] = \"This squad cannot be joined.\"\n redirect_to squads_url()\n end\n end\n else\n flash[:error] = \"You cannot join a squad after the game has started\"\n redirect_to root_url\n end\n end",
"def join\n payload = { \"id\" => id }.to_json\n data = client.post \"#{api_prefix}/user/#{client.user.id}/rooms\", payload\n\n self\n end",
"def join\n user = User.find_by_id(params[:user_id])\n code = params[:code].to_s\n\n # if code matches a trip code in db, create UserTrip item, otherwise, return error code\n if trip = Trip.find_by_rand_code(code)\n ut = UserTrip.new()\n ut.user_id = user.id\n ut.trip_id = trip.id\n ut.save!\n render json: trip, status: 201\n else\n render json: {errors: user.errors}, status: 404\n end\n end",
"def create\n @user = User.find(params[:user_id])\n if @user.is_member?(@group)\n render_error(404, request.path, 20100, \"User is already a member.\")\n else\n if @user.join!(@group)\n render json: { result: 1,\n group_id: @group.id,\n group_name: @group.name,\n user_count: @group.users.count }\n else\n render json: {result: 0}\n end\n end\n end",
"def create\n @club = Club.new(club_params)\n \n respond_to do |format|\n if @club.save\n @club.users.push(User.find_by(email: @club.captain_email))\n @club.rolls.find_by(user_id: User.find_by(email: @club.captain_email).id).update(relation: \"captain\")\n \n \n format.html { redirect_to @club, notice: 'Club was successfully created.' }\n format.json { render :show, status: :created, location: @club }\n else\n format.html { render :new }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end",
"def join\n \n #TODO add player to hunt\n #player = User.find(params[:id])\n redirect_to hunt_player_path()\n end",
"def join(person)\n members.push(person);\n end",
"def joinGroup\n id = params[:id]\n line = \"https://gtcollab.herokuapp.com/api/groups/\" + id + \"/join/\"\n \n require \"net/http\"\n require \"uri\"\n\n parsed_url = URI.parse(line)\n\n http = Net::HTTP.new(parsed_url.host, parsed_url.port)\n http.use_ssl = true\n\n req = Net::HTTP::Post.new(parsed_url.request_uri)\n\n req.add_field(\"authorization\", $token)\n\n response = http.request(req)\n response.inspect\n\n redirect_to course_path(params[:course_id], :name => params[:name], :joined => params[:joined])\n end",
"def join\n if (not @event.users.include? current_user)\n EventUser.create(user: current_user, event: @event)\n redirect_to events_path, notice: \"You are now participating.\"\n else\n ev = EventUser.find_by user: current_user, event: @event\n ev.destroy\n redirect_to events_path, notice: \"Removed you from the event.\"\n end\n end",
"def follow_artist\n relationship = Relationship.create(params.require(:relationship).permit(:follower_id, :followed_id))\n render json: relationship\n end",
"def create\n linked_account_ids = post_params.delete(:linked_account_ids)\n linked_accounts = current_user.linked_accounts.where(id: linked_account_ids)\n save_successful = create_multiple_from_linked_accounts(linked_accounts)\n\n # @post = Post.new(post_params)\n\n respond_to do |format|\n if save_successful\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_invite\n if idea_posting.users.exists?(current_user.id)\n @joinrequest = Joinrequest.new\n respond_to do |format|\n format.html \n format.json {redirect_to @joinrequest}\n end\n end\n end",
"def join\n pids = get_player_list(@match).map{|p| p.try(:id)} # list of player ids\n status = false\n if can_join(pids) #if possible, join\n status = join_now(@match, current_user.id)\n done = [\"joined\", \"success\"]\n elsif pids.include?(current_user.id) #if already joined, then leave\n status = leave_now(@match, current_user.id, @host)\n done = [\"left\", \"warning\"]\n if !get_player_list(@match).any? #if there is no more players in match, then destroy\n destroy\n return\n end\n end\n\n respond_to do |format|\n if status and @match.save\n format.html { redirect_to @match, notice: ['You have succesfully ' + done[0] + ' the match.', \"alert alert-dismissible alert-\" + done[1]] }\n else\n format.html { redirect_to @match, notice: ['Sorry, your request could not be processed.', \"alert alert-dismissible alert-danger\"] }\n end\n end\n end",
"def create\n hour = params[:duration][0].to_i * 60\n minute = params[:duration][-10..-9].to_i\n movie_party = MovieParty.new(user_id: current_user[:id], movie_title: movie_params[:movie], duration: hour + minute, date: params[:date].values.join('/'), start_time: params[:start_time].values.join(':'))\n friends_ids = params[:friend].keys.map(&:to_i)\n return unless movie_party.save\n\n friends_ids.each do |number|\n movie_party.party_users.create!({ movie_party_id: movie_party.id, user_id: number })\n end\n redirect_to('/dashboard')\n end",
"def join\n @room = Room.find(params.require(:room_id))\n if @room&.add_user(current_user)\n success\n else\n not_found\n end\n end",
"def create\n logger.debug { \"message #{params}\" }\n @game_set = GameSet.new(game_set_params)\n @game_set.first_team = Team.new(game_set_params[:first_team_attributes])\n @game_set.second_team = Team.new(game_set_params[:second_team_attributes])\n logger.debug @game_set.second_team.users\n respond_to do |format|\n if @game_set.save\n format.html { redirect_to game_sets_url, notice: 'Game set was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game_set }\n else\n format.html { render action: 'new' }\n format.json { render json: @game_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Code refactoring that use the relationship between person and Entry Sets\n @entry_set = @current_user.person.entry_sets.build(params[:entry_set])\n\n respond_to do |format|\n if @entry_set.save\n format.json { render json: @entry_set, status: :created, location: @entry_set }\n else\n format.json { render json: @entry_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_group\n name_param = params[:name]\n description_param = params[:description]\n members_param = params[:members] || []\n maillists_param = params[:maillists] || []\n leader_id_param = params[:leader_id]\n join_type_param = params[:join_type]\n\n if name_param.nil? || name_param.blank?\n render json: { field: 'name', error: 'You must provide a name for your space' }, status: :bad_request\n return\n end\n\n unless group_name_is_unique? name_param\n render json: { field: 'name', error: \"A Space named \\\"#{name_param}\\\" already exists\" }, status: :bad_request\n return\n end\n\n if description_param.nil? || description_param.blank?\n render json: { field: 'description', error: 'No description specified' }, status: :bad_request\n return\n end\n\n if join_type_param.nil? || join_type_param.blank?\n render json: { field: 'join_type', error: 'No join_type specified' }, status: :bad_request\n return\n end\n\n if (!params[:maillist].empty? && !maillist_is_valid?(params[:maillist]))\n render json: { field: 'maillist', error: \"\\\"#{params[:maillist]}\\\" is not a valid maillist\" }, status: :bad_request\n return\n end\n\n # concat maillist members into the members array so they get added for the initial load\n members_param.concat maillist_members(params[:maillist]) unless params[:maillist].empty?\n\n # filter out non-canvas users\n members = members_param.map do | member |\n pseudonym = Pseudonym.active.by_unique_id member\n pseudonym.first.user unless pseudonym.empty?\n end\n members.compact.uniq!\n\n if @current_user.account.site_admin?\n if leader_id_param && !leader_id_param.blank?\n leader = User.find_by_id(leader_id_param)\n if leader.nil?\n render json: { error: \"Can't find user specified for leader\" }, status: :bad_request\n return\n end\n else\n leader = @current_user\n end\n else\n # if a non-admin is creating the group then\n # the leader is that user and that id is used to determine who \"owns\"\n # the group and can make changes to it\n leader = @current_user\n end\n\n if join_type_param == 'free_to_join'\n join_type = 'parent_context_auto_join'\n elsif join_type_param == 'request'\n join_type = 'parent_context_request'\n elsif join_type_param == 'invite_only'\n join_type = 'invitation_only'\n else\n render json: { field: 'join_type', error: 'Invalid join_type value. Valid: request, free_to_join, invite_only' }, status: :bad_request\n return\n end\n\n group = @domain_root_account.groups.create( name: name_param,\n group_category: CanvasSpaces.GroupCategory,\n leader: leader,\n join_level: join_type,\n description: description_param )\n group.add_user(leader)\n group.save\n members.each { |member| group.add_user(member) } unless members.empty?\n\n add_maillist = set_maillist_for_space(group.id, params[:maillist]) unless params[:maillist].empty?\n\n render json: group.as_json(only: [ :id, :name, :description, :leader_id, :created_at ],\n include_root: false)\n .merge({ size: 0, join_type: join_type_param }), status: :ok\n end",
"def join\n @club = Club.find(params[:id])\n authorize @club\n @club.club_memberships.create! user_id: current_user.id\n redirect_to action: :show\n end",
"def participatingtournaments_feed\n tournaments= getpartipatingtournaments\n tournamentslist = tournaments.map do |t|\n { :tournament_id=>t.id, :title=> t.name, :start => t.start_date }\n end\n\n render :json=> tournamentslist.to_json\n end",
"def create\n @joining_form = JoiningForm.new(joining_form_params)\n\n respond_to do |format|\n if @joining_form.save\n format.html { redirect_to @joining_form, notice: 'Joining form was successfully created.' }\n format.json { render :show, status: :created, location: @joining_form }\n else\n format.html { render :new }\n format.json { render json: @joining_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index_attending\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.attended_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end",
"def create\n respond_to do |format|\n begin\n if params[\"skills_user\"][\"user_id\"]\n skill_id = params[\"skills_user\"][\"skill_id\"]\n user_ids = params[\"skills_user\"][\"user_id\"].reject{ |c| c.empty? }\n user_ids.each do |user_id|\n SkillsUser.create(skill_id: skill_id, user_id: user_id)\n end\n format.html { redirect_to skills_users_path, notice: 'Skills user was successfully created.' }\n end\n rescue\n format.html { render :new }\n format.json { render json: @skills_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def joined?\n meta[:joined].equal?(true)\n end",
"def index\n if current_user\n @joined_event = []\n @joined = EventUser.where(user_id: current_user.id)\n @joined.each do |x|\n @joined_event << Event.find(x.event_id)\n end\n\n @events = []\n @joined_event_id = []\n @joined.each do |y|\n @joined_event_id << y.event_id\n end\n Event.all.each do |x|\n if @joined_event_id.include? x.id\n # do nothing\n else\n @events << x\n end\n end\n else\n @events = Event.all\n end\n respond_to do |format|\n format.json\n format.html\n end\n end",
"def join_group\n @disc_group = DiscussionGroup.find(params[:id])\n @join = DiscussionGroupUser.new(:discussion_group_id => @disc_group.id, :user_id => @login_user.id, :is_member => 1)\n if @join.save\n respond_to do |format|\n format.js\n end\n else\n render :text=>\"Fail\"\n end\n end",
"def create\n @form = Leagues::JoinLeagueForm.run(join_league_params.merge(current_user: current_user))\n respond_to do |format|\n if @form.valid?\n format.html { redirect_to @form.league, notice: 'League was successfully joined.' }\n format.json { render :show, status: :created, location: @league }\n else\n flash[:danger] = @form.errors[:base]&.first\n format.html { render :new }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def join\n @game = Game.find(params[:id])\n @game.assign_team(current_user)\n redirect_to \"/games/#{@game.id}\"\n end",
"def join\n\t\t@event = Event.find(params[:id])\n\n\t\tparams[:user_id] = current_user.id unless admin? && params[:user_id]\n\n\t\t@attendance = Attendance.new\n\t\t@attendance.event_id = @event.id\n\t\t@attendance.user_id = params[:user_id]\n\t\tif @attendance.save\n\t\t\tredirect_to @event, notice: \"Joined!\"\n\t\telse\n\t\t\tredirect_to root_path, alert: \"WTF did you just try to do.\"\n\t\tend\n\tend",
"def join\n if logged_in?\n @group_wanted = Group.find(params[:id]) # later change to params[:name]\n @country_wanted = Country.find(@group_wanted.country_id, :limit => 1)\n #match = current_user.countries.find(@country_wanted.id)\n #unless current_user.has_country?(@country_wanted.id) #countries.find(@country_wanted.id)\n #@matches = current_user.countries\n @match = Country.find_by_sql([\"SELECT * FROM countries_users WHERE user_id = ? AND country_id = ?\", current_user.id, @country_wanted.id])\n if @match.empty? #current_user.countries.find(@country_wanted.id).nil? #current_user.has_country?(@country_wanted.id) \n flash[:notice] = \"Joined!\"\n current_user.groups << @group_wanted # add group\n current_user.countries << @country_wanted # add country\n redirect_to '/perfil'\n else\n flash[:error] = \"You're either already subscribed to a group in the same country or in the same group.\"\n redirect_to :action => 'index'\n end \n end \n end",
"def create\n @creator.works << Work.where(id: work_ids)\n if @creator.save\n render json: @creator, status: :created, location: @creator\n else\n render json: @creator.errors, status: :unprocessable_entity\n end\n end",
"def create\n @league_user = LeagueUser.new(params[:league_user_params])\n # params[:league_id] because :league_id is the name of the value being passed into the form\n @league_user.league = League.find(params[:league_id])\n @league_user.user = current_user\n respond_to do |format|\n if @league_user.save\n format.html { redirect_to league_url(@league_user.league, :notice => \"Successfully joined #{@league_user.league.name}\") }\n format.json { render :show, status: :ok, location: @league }\n else\n format.html { redirect_to(@league_user.league, :notice => \"Something went wrong!\") }\n format.json { render json: @league_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #create venues trought users controller\n end",
"def add_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows << @followed\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end",
"def create\n @list = List.new(params[:list])\n Grade.all.each do |g|\n @list.posts.build(gname: g.name, tname: g.teacher_name)\n end\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def join\n if !current_user\n flash[:notice] = t(:join_dream)\n elsif @camp.users.include?(current_user)\n flash[:notice] = t(:join_already_sent)\n else\n flash[:notice] = t(:join_dream)\n @camp.users << @user\n end\n redirect_to @camp\n end",
"def create\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n # create team\n team = Team.create(name: params[:team_name], course: $selected_course)\n\n # add students to teams\n student_ids = params[:student_ids]\n student_ids.each do |student_id|\n StudentTeam.create(student_id: student_id, team: team)\n end\n\n render json: { success: true }\n end",
"def create\n #to update all parameters of Member\n @member = Member.new(params[:member])\n \n #to do entry in member_event\n params[:events][:id].each do |e|\n if !e.empty?\n @member.member_events.build(:event_id => e)\n \n end\n end\n #to do entry in member_group\n params[:group_events][:id].each do |e|\n if !e.empty?\n @member.member_groups.build(:group_event_id => e)\n end\n end\n\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_follows\n\t#params[:id] is user who follows \n\t#params[:follows_id] is user to be followed\n\t\n\t#make follower\n\t@follower = User.find(params[:id])\n\t\n\t#make followed\n\t@followed = User.find(params[:follows_id])\n\t\n\tif \n\t\t@follower.follows << @followed\n\t\thead :no_content\n\telse\n\t\trender json: @follower.errors, status: :unprocessable_entity\n\tend\nend",
"def create\n @team = Team.new(params[:team])\n if @team.save\n # the current user should join the team\n current_user.join!(@team)\n flash[:success] = \"New team created\"\n redirect_to @team\n else\n @title = \"Create a Team\"\n render :action => :new\n end\n end",
"def create\n logged_in_log_in_or_create_user\n @challenge_participant = @challenge.challenge_participants.build(user_id: @user.id)\n respond_to do |format|\n begin\n if @challenge_participant.save\n format.html { redirect_to :root, notice: \"You successfully joined #{@challenge.name}.\" }\n format.json { render :show, status: :created, location: @challenge_participant }\n else\n format.html { render :new }\n format.json { render json: @challenge_participant.errors, status: :unprocessable_entity }\n end\n rescue\n @challenge_participant = ChallengeParticipant.where(user_id: @user.id, challenge_id: @challenge.id).first\n format.html { redirect_to :root, notice: \"You have already joined this challenge.\" }\n format.json { render :show, status: :created, location: @challenge_participant }\n end\n end\n end",
"def create\n requestor = User.where(email: @requestor)\n target = User.where(email: @target)\n\n if requestor.exists? && !target.exists?\n render json: { success: false, message: \"Target Email not found\" }\n\n elsif !requestor.exists? && target.exists?\n render json: { success: false, message: \"Requestor Email not found\" }\n\n elsif !requestor.exists? && !target.exists?\n render json: { success: false, message: \"Both Email not found\" }\n\n else\n if @requestor != @target || @target != @requestor\n user = User.find_by_email @requestor\n aim = User.find_by_email @target\n user.subscribes.create target_id: aim.id\n render json: { success: true }\n else\n render json: { success: false, message: \"You can't subscribe yourself\" }\n end\n\n end\n end",
"def to_users\n message = AssignTasksToUsers.new(params).perform\n json_response({message: message}, :created)\n end",
"def assigning_tutor\n unless params[:student_ids].empty?\n @students = Student.where(id: params[:student_ids])\n tutor = User.find(params[:user_id])\n\n @students.each do |s|\n s.assign_tutor(tutor)\n end\n message = {message: @students.size.to_s + ' students have been assigned a new tutor.'}\n else\n message = {message: 'No student ids were received.'}\n end\n render json: message\n end",
"def index\n puts \"<><><><><><><><><><><><><><><><><><><><><>\"\n p params\n puts \"<><><><><><><><><><><><><><><><><><><><><>\"\n # @journeys = current_user.journeys\n @journeys = User.find_by_id(params[:user_id]).journeys\n render json: @journeys.to_a\n end",
"def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end",
"def create\n @workshop = Workshop.new(workshop_params)\n puts \"====================================\"\n puts params['trainers']\n puts \"====================================\"\n trainers = params['trainers'].map do |id|\n Trainer.find(id)\n end\n @workshop.trainers << trainers\n\n\n respond_to do |format|\n if @workshop.save\n format.html { redirect_to @workshop, notice: 'Workshop was successfully created.' }\n format.json { render :show, status: :created, location: @workshop }\n else\n format.html { render :new }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def follow\r\n @relationship = Relationship.create(follower_id: current_user.id, followed_id: params[:followed_id])\r\n @relationship.create_activity key: 'relationship.follow', owner: current_user, recipient: User.find(params[:followed_id])\r\n\r\n if @relationship.save\r\n render json: @relationship\r\n else\r\n render json: { error: \"Relationship creating error\" }, status: :unprocessable_entity\r\n end\r\n end",
"def create\n @relationship = current_user.relationships.build(relationship_params)\n\n respond_to do |format|\n if @relationship.save\n format.html { redirect_to @relationship, notice: 'Relationship was successfully created.' }\n format.json { render :show, status: :created, location: @relationship }\n else\n format.html { render :new }\n format.json { render json: @relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def joined\n meta(joined: true)\n end",
"def join\n @plan = current_user.plans.create(:itinerary_id => params[:itinerary_id], :child_id => current_user.id, :parent_id => params[:parent_id])\n respond_to do |format|\n if @plan.save\n format.html { redirect_to(itineraries_path, :notice => 'Plan was successfully created.') }\n else\n format.html { redirect_to(itineraries_path, :notice => 'There was an error in joining this itinerary') }\n end\n end\nend",
"def follow(other)\n active_relationships.create(followed_id: other.id)\nend",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n\n invited_users = InvitedUser.where(email: @user.email)\n invited_users.each do |invited_user|\n Message.create(sender_id: 1, receiver_id: invited_user.inviter.id, title: \"Your friend has just joined\", content: \"I have just joined to TennisBuddy World! Thank you for inviting me. #{@user.full_name}\")\n end\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@owner = Prover.find(params[:owner])\n\t\t@owner.follow(Prover.find(params[:follows]))\n\n\t\trespond_to do |format|\n\t\t\tif @owner.follow(Prover.find(params[:follows]))\n\t\t\t\tformat.html { render :json => {prover_id: @owner.id, following_id: params[:follows]}.to_json }\n\t\t\telse\n\t\t\t\tformat.html { render :json => {it: \"BROKE\"}.to_json, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def resumes_joining\n\t @resumes = ReqMatch.where(:status => \"JOINING\")\n\t\trender \"resumes/joining\"\n\tend",
"def users\n channel = Channel.find(params[:id])\n users = ChannelJoined.where(channel_id: params[:id])\n return json_response({\n users: users.map{|j| j.user}\n })\n end",
"def follow!(followed)\n self.relationships.create!(:followed_id => followed.id)\n end",
"def index\n @my_ministries = MyMinistry.all\n @ministries = Ministry.find(:all, order: \"id\")\n @coworkers = Coworker.all\n person_count = 0\n @coworkers.each do |coworker|\n if coworker.ministries.any?\n person_count += 1\n end\n end\n @joined_ministry_person_count = person_count\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_ministries }\n end\n end",
"def create\n @event = Event.new(event_params)\n @event.host_id = current_user.id\n\n\n respond_to do |format|\n if @event.save\n\n @event.users << User.find(@event.host_id)\n unless params[:users].nil?\n params[:users].each do |u|\n @event.users << User.find(u)\n end\n end\n\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n @users = User.all\n end\n end\n end",
"def create\n @leader = Leader.new(leader_params)\n\n respond_to do |format|\n if @leader.save\n format.html { redirect_to departments_url, notice: \"Leader was successfully created.\" }\n format.json { render :show, status: :created, location: @leader }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @leader.errors, status: :unprocessable_entity }\n end\n end\n end",
"def join\n @event = Event.find(params[:event_id])\n @e = @event.user_to_events.build(:user_id => current_user.id,\n :event_id => \"#{@event.id}\",\n :owner_id => \"#{@event.user_id}\" )\n\n respond_to do |format|\n if @e.save\n @total_attendence = UserToEvent.find(\"#{@e.id}\").event.update_attributes(:no_of_guests_attending => (@event.no_of_guests_attending)+1)\n format.html { redirect_to(@event, :notice => 'Request has been sent to the meal owner.') }\n format.xml { head :ok }\n else\n format.html { redirect_to(event_path(@event), :notice => 'Something has gone wrong , please try again.') }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def users(name, args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&name#{name}\"\n path = __method__.to_s\n http_post(path, query)\n end",
"def create\n\n @house = House.new(params[:house])\n @house.users_ids = current_user.id\n\n if @house.save\n redirect_to thanks_houses_url\n else\n render :new\n end\n\n end",
"def create\n\n # Create new saved list table entry\n @saved_list = SavedList.new\n\n # Store attributes\n @saved_list.login_id = params[:login_id]\n @saved_list.list_name = params[:list_name]\n @saved_list.saved_user_list = true\n @saved_list.date_saved = params[:date_saved]\n\n # Save the saved list\n respond_to do |format|\n if @saved_list.save\n\n # Create new user saved list entries for all users in list\n @user_ids = params[\"user_ids\"]\n @user_ids.each do |user_id|\n SavedListUser.create(saved_list_id: @saved_list.id, user_id: user_id)\n end\n\n format.html { redirect_to @saved_list, notice: 'Saved list was successfully created.' }\n format.json { render :show, status: :created, location: @saved_list }\n else\n format.html { render :new }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @mission = Mission.new(mission_params)\n \n #assign users to mission\n if params[:user_ids].present?\n user = params[:user_ids].delete_if{ |x| x.empty? }\n @mission.users << User.find(params[:user_ids]) \n end\n \n \n respond_to do |format|\n if @mission.save\n format.html { redirect_to [:admin, @mission], notice: 'Mission was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mission }\n else\n format.html { render action: 'new' }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calendar = Calendar.new(params[:calendar])\n @calendar.update_attribute :user_id, current_user.id\n\n params[:doors].each_value do |door|\n @calendar.doors.build(door)\n end\n\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }\n format.json { render json: @calendar, status: :created, location: @calendar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teams_sponsor = TeamsSponsor.new(teams_sponsor_params)\n\n respond_to do |format|\n if @teams_sponsor.save\n format.html { redirect_to @teams_sponsor, notice: 'Teams sponsor was successfully created.' }\n format.json { render :show, status: :created, location: @teams_sponsor }\n else\n format.html { render :new }\n format.json { render json: @teams_sponsor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def join\n @group = Group.find(params[:id])\n \n if group_user = GroupUser.first(:conditions => ['group_id = ? AND user_id = ?', @group.id, current_user.id])\n if ['cancelled', 'invite_declined'].include?(group_user.status)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n elsif group_user.status == 'approved'\n flash[:error] = 'You are already member of this group.'\n else\n flash[:error] = 'You cannot join this group.'\n end\n else\n group_user = GroupUser.create(:group_id => @group.id, :user_id => current_user.id, :role_id => Role.find_by_name('User').id)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n end\n \n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def join\n @group = Group.find(params[:id])\n \n if group_user = GroupUser.first(:conditions => ['group_id = ? AND user_id = ?', @group.id, current_user.id])\n if ['cancelled', 'invite_declined'].include?(group_user.status)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n elsif group_user.status == 'approved'\n flash[:error] = 'You are already member of this group.'\n else\n flash[:error] = 'You cannot join this group.'\n end\n else\n group_user = GroupUser.create(:group_id => @group.id, :user_id => current_user.id, :role_id => Role.find_by_name('User').id)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n end\n \n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @league = League.new(league_params)\n\n respond_to do |format|\n if @league.save\n\n (0..(@league.size-1)).each_with_index do |i|\n fantasy_team = @league.fantasy_teams.create(owner: \"Team #{i+1}\", pick_number: i+1)\n picks = []\n\n (1..@league.roster_size).each do |round|\n offset = round % 2 == 1 ? i + 1: @league.size - i\n pick = (round-1)*@league.size + offset\n @league.draft_picks.create(number: pick, fantasy_team: fantasy_team)\n end\n\n puts \"Team #{i} gets picks #{fantasy_team.draft_picks.map(&:number)}\\n\"\n end\n\n format.html { redirect_to @league, notice: 'League was successfully created.' }\n format.json { render :show, status: :created, location: @league }\n else\n format.html { render :new }\n format.json { render json: @league.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6444366",
"0.61074233",
"0.6028494",
"0.5714968",
"0.5658462",
"0.55792785",
"0.55047023",
"0.5489245",
"0.5450283",
"0.54474396",
"0.53643554",
"0.5343089",
"0.53148615",
"0.5305037",
"0.5304981",
"0.53048575",
"0.530181",
"0.52460873",
"0.52226734",
"0.52113134",
"0.520321",
"0.5185737",
"0.5174127",
"0.51694876",
"0.5160994",
"0.51582175",
"0.51529497",
"0.51446897",
"0.51323706",
"0.51313084",
"0.5125836",
"0.512178",
"0.51167166",
"0.5115974",
"0.51079637",
"0.5088121",
"0.508244",
"0.5072238",
"0.50606054",
"0.5020393",
"0.5004881",
"0.50035286",
"0.49981976",
"0.49834007",
"0.49800608",
"0.49796027",
"0.49463946",
"0.4936262",
"0.49268964",
"0.49237487",
"0.49180523",
"0.4913018",
"0.49071783",
"0.49045992",
"0.48906305",
"0.48895583",
"0.48863548",
"0.48793495",
"0.4870842",
"0.48524344",
"0.48500878",
"0.48444608",
"0.48443896",
"0.48431873",
"0.483619",
"0.48318762",
"0.48271152",
"0.48268327",
"0.48203644",
"0.48195496",
"0.48191735",
"0.48126447",
"0.48075014",
"0.48040205",
"0.48017263",
"0.47987825",
"0.4797962",
"0.47957402",
"0.4794747",
"0.47853714",
"0.47767472",
"0.47637165",
"0.4758199",
"0.47564316",
"0.4756187",
"0.4753881",
"0.4752824",
"0.47518206",
"0.4748839",
"0.47421524",
"0.4738601",
"0.47333148",
"0.4728714",
"0.4727112",
"0.47256735",
"0.4717035",
"0.47131437",
"0.47117624",
"0.47117624",
"0.4708871"
] |
0.71221226
|
0
|
PATCH/PUT /joineds/1 PATCH/PUT /joineds/1.json
|
def update
respond_to do |format|
if @joined.update(joined_params)
format.html { redirect_to @joined, notice: 'Joined was successfully updated.' }
format.json { render :show, status: :ok, location: @joined }
else
format.html { render :edit }
format.json { render json: @joined.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_many\n if @users.update_all(user_params)\n render json: @users, status: :ok, location: users_url\n else\n render json: @users.errors, status: :unprocessable_entity\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n # this action is not provided for partyroles\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relationship.errors }, status: 422\n end\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def put_relation(args)\n\tapi_url = \"#{@base_url}/#{args[:coll_A]}/#{args[:key_A]}/relation/\" +\n\t \"#{args[:relation]}/#{args[:coll_B]}/#{key_B}\"\n\tputs do_the_put_call( url: api_url, user: @user, json: '{}')\nend",
"def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n new_properties = params[:d]\n profile = Profile[params[:id]]\n profile.update_with(new_properties)\n\n respond_with(profile) do |format|\n format.json { render json: profile.stripped }\n end\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def update!(**args)\n @annotated_relationship = args[:annotated_relationship] if args.key?(:annotated_relationship)\n @annotations = args[:annotations] if args.key?(:annotations)\n @collections = args[:collections] if args.key?(:collections)\n @entity_join = args[:entity_join] if args.key?(:entity_join)\n @id = args[:id] if args.key?(:id)\n @mrf = args[:mrf] if args.key?(:mrf)\n end",
"def update\n errors = {}\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if params[:person]\n begin\n if @person.json_update_attributes(params[:person])\n render_json :entry => @person.to_hash(@user, @client) and return\n end\n rescue NoMethodError => e\n errors = e.to_s\n end\n end\n\n render_json :status => :bad_request, :messages => @person.errors.full_messages\n @person = nil\n end",
"def update_for_current\n\n # 1) find recipient\n recipient = Recipient.find(params[:id])\n\n # 2) update first / last name\n first_name = params[:first_name]\n last_name = params[:last_name]\n recipient.update_columns(\n first_name: params[:first_name],\n last_name: params[:last_name]\n )\n\n puts params.inspect\n\n # 3) update recipient addresses\n \n # delete all addresses then insert\n recipient.addresses.delete_all\n addresses = params[:addresses]\n if addresses\n\n primary_set = false\n addresses.each do |address|\n address = recipient.addresses.new(\n first_name: first_name,\n last_name: last_name,\n street: address[:street],\n city: address[:city],\n suite: address[:suite],\n state: address[:state],\n zipcode: address[:zipcode],\n )\n if address.save\n unless primary_set\n address.set_primary\n primary_set = true\n end\n end\n end\n end\n\n # 4) save recipient occasions\n # our update will be to delete all occasions then create new ones\n \n recipient.occasions.delete_all # delete all then re-insert\n occasions = params[:occasions]\n if occasions\n occasions.each do |occasion|\n\n occasion_id = occasion[:recipient_occasion][:occasion_id]\n day = occasion[:recipient_occasion][:day]\n month = occasion[:recipient_occasion][:month]\n notes = occasion[:recipient_occasion][:notes]\n\n recipient.recipient_occasions.create(\n occasion_id: occasion_id,\n day: day,\n month: month,\n notes: notes\n )\n end\n end\n\n respond_to do |format|\n format.json { render json: recipient }\n end\n end",
"def update \n staff = Staff.find(params[:id])\n #assign new attributes\n staff.assign_attributes(staff_params)\n ## check for any validations \n if staff.valid?\n staff.save \n render json: staff\n else \n reder json: staff.errors.full_messages\n end \n\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_with []\n end",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n @leader = Leader.find(params[:id])\n\n respond_to do |format|\n if @leader.update_attributes(params[:leader])\n format.html { redirect_to @leader, notice: 'Leader was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @leader.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to_update({thing: @author})\n end",
"def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n course = Course.includes(:professors).find(params[:id])\n course.update!(course_params)\n \n course.professor_ids=(params[:professors])\n\n render json: course.to_json(include: :professors)\n end",
"def update\n group_ids = params[:group_id]\n org_id = params[:organization_id]\n @user = User.find_by_id(params[:user_id])\n current_group_ids = @user.user_group_ids\n\n respond_to do |format|\n if @user.update_attributes(full_name: params[:full_name], abbreviation: params[:abbreviation], email: params[:email], status: params[:status], staff_number: params[:employee_id], career_path: params[:career_path])\n\n is_logged = !@user.previous_changes.blank?\n if current_group_ids != group_ids\n @user.user_group_ids = group_ids\n format.json { render json: @user }\n end\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @student = Student.find(params[:student_id])\n @lunchdetention = @student.lunchdetentions.find(params[:id])\n\n respond_to do |format|\n if @lunchdetention.update_attributes(params[:lunchdetention])\n format.html { redirect_to :back, notice: 'lunchdetention was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lunchdetention.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n professor = Professor.find(params[:id])\n professor.update!(professor_params)\n\n render json: professor.to_json(include: :courses)\n end",
"def update\n\t\t @tree = current_user.trees.find(params[:tree_id])\n\n\t if @tree.nil?\n\t \trender json: { errors: [\"No such tree found\"], success: false }, status: :bad_request\n\t end\n\n\t @person = @tree.people.find(params[:id])\n\n \tif @person.nil?\n \t\trender json: { errors: [\"No such person found\"], success: false }, status: :bad_request\n \tend\n\n \tparams.delete :_id\n\n\t relations = {}\n\t\t \tmodified_people = []\n\n\t\t \tif params[:person][:spouses]\n\t\t \t\trelations[:spouses] = params[:person][:spouses]\n\t\t \t\tparams[:person].delete :spouses\n\t\t \tend\n\n\t\t \tif params[:person][:children]\n\t\t \t\trelations[:children] = params[:person][:children]\n\t\t \t\tparams[:person].delete :children\n\t\t \tend\n\n\t\t \tif params[:person][:parents]\n\t\t \t\trelations[:parents] = params[:person][:parents]\n\t\t \t\tparams[:person].delete :parents\n\t\t \tend\n\n \tif @person.update_attributes(params[:person])\n \t\tmodified_people << @person\n\n \t\trelations.each do |k,v|\n\t\t \t\tv.each do |p|\n\t\t \t\t\tputs \"RELATIONS\", relations\n\t\t \t\t\tputs \"HERE\", k, v, p\n\t\t \t\t\trelative = @tree.people.find(p)\n\t\t \t\t\tputs \"THERE\", relative[k], relative.to_json\n\t\t \t\t\trelative.send(k) << @person\n\t\t \t\t\trelative.save\n\t\t \t\t\tmodified_people << relative\n\t\t \t\tend\n\t\t \tend\n\n \trender json: { person: @person, people: modified_people }, status: :accepted\n \telse\n \trender json: { errors: @person.errors, success: false }, status: :unprocessable_entity\n \tend\n\t\t end",
"def update\n # given an array of people ids\n if params[:people] && params[:people].is_a?(Array)\n people = params['people'].collect{|id| Person.find_by id: id.to_i }.compact\n if people.size == params[:people].size\n seated_people = people.select{|p| p.seated && p.seat.table_id != @table.id}\n if seated_people.empty?\n seats = people.collect{|p| Seat.new table: @table, person: p}\n if TableRules.check_table(seats).empty?\n @table.seats = seats\n @table.save\n render json: @table\n else\n render json: {errors: \"Unable to seat those people in that order\"}, status: 422\n end\n else\n has_have = if seated_people.size > 1\n 'have'\n else\n 'has'\n end\n render json: {errors: \"#{seated_people.collect(&:name).sort.to_sentence} #{has_have} already been seated at another table\"}, status: 422\n end\n else\n render json: {errors: \"Non-existant people sent\"}, status: 422\n end\n else\n render json: {errors: 'Invalid parameters'}, status: 422\n end\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spawner = Spawner.find(params[:id])\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.update_attributes(spawner_params)\n format.html { redirect_to @spawner, notice: 'Spawner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n Rails.logger.debug(\"method=#{request.method}\")\n #replace the Race in the db with supplied values\n race = Race.find(params[:id])\n # # DEBUG: do not chain!! update returns true/false\n race.update(race_params)\n render json: race, status: :ok\n end",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update\n #@user = User.find(params[:id])\n \n if @trainer.update(trainer_params)\n render json: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\nend",
"def update\n render_json :status => :forbidden and return unless @collection.write?(@user, @client)\n if !params[:collection]\n render_json :status => :bad_request, :messages => \"Tried to update collection with no data.\" and return\n end\n @collection.update_attributes(params[:collection].slice(:metadata, :read_only, :title, :tags, :priv))\n render_json :entry => @collection.to_hash(@user, @client) and return\n end",
"def update_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if User.update(current_user.id, :game_id => params[:id])\n format.json { head :no_content }\n end\n end\n end",
"def update\n put :update\n end",
"def patch!\n request! :patch\n end",
"def update\n if singular_resource?\n entity = ConnecEntity.where(group_id: @group_id, entity_name: entities_key).first\n entity ||= ConnecEntity.create(group_id: @group_id, entity_name: entities_key)\n else\n entity = ConnecEntity.where(group_id: @group_id, entity_name: entities_key, uid: params[:id]).first\n end\n \n entity.document = (entity.document || {}).merge(params[entities_key])\n \n if entity\n if entity.save\n logger.info(\"INSPECT: #{entities_key} => #{process_entity(entity.reload).to_json}\")\n render json: { entities_key => process_entity(entity.reload) }\n else\n render json: { errors: process_errors(entity.errors.full_messages, 400, entity) }, status: :bad_request\n end\n else\n render json: { errors: process_errors([\"Resource not found\"], 404) }, status: :not_found\n end\n end",
"def update\n # @user_trick = UserTrick.find(params[:id])\n @user_trick.update(user_trick_params)\n render json: UserTrickSerializer.new(@user_trick).serialized_json\n end",
"def update\n if params[:users]\n user_ids = params[:users].keys\n user_ids.each do |id|\n @jam_circle.users << User.find(id)\n end\n end\n respond_to do |format|\n if @jam_circle.update(jam_circle_params)\n format.html { redirect_to @jam_circle }\n format.json { render :show, status: :ok, location: @jam_circle }\n else\n format.html { render :edit }\n format.json { render json: @jam_circle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opportunity_role = OpportunityRole.find(params[:id])\n\n\n\n @opportunity_role.update(opportunity_role_params)\n render json: @OpportunityRole_role\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @lending = Lending.find(params[:id])\n\n respond_to do |format|\n if @lending.update_attributes(params[:lending])\n format.html { redirect_to @lending, :notice => 'Lending was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lending.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n @person.skills.delete_all\n if params[:skillid]!= nil\n params[:skillid].each do |i| \n\t\t @person.skills << Skill.find_by_id(i)\n\t\tend\n\t\tend\n format.html { redirect_to @person }\n format.json { render :show, status: :ok, location: @person }\n else\n @groups=@person.group.organization.groups.all\n @skills=@person.group.skills.all\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(uid, params, membership)\n data = {\n initials: (params[4].nil? ? params[5][0] : params[4].tr('^a-zA-Z', '')),\n email: (params[3].nil? ? 'unknown@nieuwedelft.nl.invalid' : params[3]),\n gender: params[9] == 'Vrouw' ? 'F' : 'M',\n phone: params[14],\n mobile: params[2],\n phone_parents: params[24],\n address: [params[10], params[11], params[12]].join(' '),\n membership: membership,\n }\n begin\n unless params[15].nil?\n data[:dateofbirth] = Date.strptime(params[15], '%d-%m-%Y').strftime('%Y-%m-%d')\n end\n rescue\n $problems.write \"#{$index}, #{data[:firstname]} #{data[:lastname]}, Birthdate ignored\\n\"\n end\n patch(\"https://people.i.bolkhuis.nl/persons/#{uid}\", data)\n\n # Send payload to operculum\n put(\"https://operculum.i.bolkhuis.nl/person/#{uid}\", {\n nickname: params[8],\n study: params[16],\n alive: params[17].nil?,\n inauguration: params[25],\n resignation_letter: params[26],\n resignation: params[27],\n })\nend",
"def relationship_set_props id, data\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n 'Content-Type' => 'application/json',\n }\n\n put_request 'relationship/' + id + '/properties', data, headers\n end",
"def update!(**args)\n @people = args[:people] if args.key?(:people)\n end",
"def update\n begin\n @collection = Collection.find(params[:id])\n if params[:collection][:invite_only] && params[:invitations]\n @collection.invited_user_ids = params[:invitations][:user_ids] \n end\n @collection.assign_attributes(params[:collection])\n\n @collection.transaction do\n @collection.save!\n end\n\n render \"show\", handlers: [:rabl]\n \n rescue ActiveRecord::RecordInvalid => invalid\n render :json => @collection.errors.full_messages, status: 422\n end\n end",
"def update\n @witness = Witness.find(params[:id])\n\n respond_to do |format|\n if @witness.update_attributes(params[:witness])\n # commented so hosts font receive emails off season\n # if(params[:witness][:host_id].present?)\n # HostMailer.witness_assigned(\n # params[:witness][:host_id],\n # @witness.id,\n # I18n.locale\n # ).deliver\n\n #@host = Host.find(params[:witness][:host_id])\n #@host.update_attributes(assignment_time: Time.now.utc.localtime)\n #end\n\n\n \n format.json { render json: @witness, status: :created, location: @witness }\n else\n format.json { render json: @witness.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @json_schemas = args[:json_schemas] if args.key?(:json_schemas)\n @schema = args[:schema] if args.key?(:schema)\n end",
"def update\n logger.info('PUT Update:')\n logger.info(request_body)\n new_pub = hashed_request\n old_pub = Publication.find_by(id: params[:id])\n if old_pub.blank?\n head :not_found\n return\n elsif old_pub.deleted?\n head :gone\n return\n end\n if old_pub.harvested_pub? # only manually entered (i.e. non-harvested) publications may be updated with this method\n render json: {\n error: \"This record SulPubID #{old_pub.id} may not be modified. If you had originally entered details for the record, \" \\\n 'it has been superceded by a central record.'\n },\n status: :forbidden, format: 'json'\n return\n elsif !validate_or_create_authors(new_pub[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n logger.info(\"Update manual publication #{old_pub.inspect} with BibJSON:\")\n logger.info(request_body)\n old_pub.update_manual_pub_from_pub_hash(new_pub, request_body)\n old_pub.save!\n old_pub.reload\n logger.debug(\"resulting pub hash: #{old_pub.pub_hash}\")\n render json: old_pub.pub_hash, status: :accepted\n end",
"def test_update_name_destructive_merge\n old_name = agaricus_campestrus = names(:agaricus_campestrus)\n new_name = agaricus_campestris = names(:agaricus_campestris)\n new_versions = new_name.versions.size\n old_obs = old_name.namings[0].observation\n new_obs = new_name.namings.\n find { |n| n.observation.name == new_name }.observation\n\n params = {\n id: old_name.id,\n name: {\n text_name: agaricus_campestris.text_name,\n author: agaricus_campestris.author,\n rank: \"Species\",\n deprecated: agaricus_campestris.deprecated\n }\n }\n login(\"rolf\")\n\n # Fails because Rolf isn't in admin mode.\n put(:update, params: params)\n assert_redirected_to(emails_merge_request_path(\n type: :Name, old_id: old_name.id, new_id: new_name.id\n ))\n assert(Name.find(old_name.id))\n assert(new_name.reload)\n assert_equal(1, new_name.version)\n assert_equal(new_versions, new_name.versions.size)\n assert_equal(2, new_name.namings.size)\n assert_equal(agaricus_campestrus, old_obs.reload.name)\n assert_equal(agaricus_campestris, new_obs.reload.name)\n\n # Try again as an admin.\n make_admin\n put(:update, params: params)\n assert_flash_success\n assert_redirected_to(name_path(new_name.id))\n assert_no_emails\n assert_not(Name.exists?(old_name.id))\n assert(new_name.reload)\n assert_equal(1, new_name.version)\n assert_equal(new_versions, new_name.versions.size)\n assert_equal(3, new_name.namings.size)\n assert_equal(agaricus_campestris, old_obs.reload.name)\n assert_equal(agaricus_campestris, new_obs.reload.name)\n end",
"def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @household.update(household_params)\n\n params[:household][:household_members_attributes].each do |member|\n predecessor_name = member[1][:name]\n successor_name = member[1][:name_related]\n relationship_kind = member[1][:relationship]\n\n @household.add_household_member(@household.household_members.find_by_name(predecessor_name))\n @household.add_relationship(predecessor_name, successor_name, relationship_kind)\n #byebug\n end\n format.html { redirect_to @household, notice: 'Household was successfully updated.' }\n format.json { render :show, status: :ok, location: @household }\n else\n format.html { render :edit }\n format.json { render json: @household.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @enrolled = Enrolled.find(params[:id])\n\n respond_to do |format|\n if @enrolled.update_attributes(params[:enrolled])\n format.html { redirect_to @enrolled, notice: 'Enrolled was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enrolled.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n if @clientsOffers.update_attributes(params[:clientsOffers])\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end",
"def update\n @person.update_attributes(params[:person])\n respond_with(@person)\n end",
"def update\n @person = Person.find(params[:id])\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n\n path = people_path\n msg = 'Person was successfully updated.'\n if @participant\n path = participant_path(@participant, :anchor => \"relationships_tab\")\n msg = 'Person was successfully updated.'\n end\n if @provider\n path = provider_path(@provider)\n msg = \"Person was successfully updated for #{@provider}.\"\n end\n\n format.html { redirect_to(path, :notice => msg) }\n format.json { render :json => @person }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if !params[:roles].include?('president') && @member.has_role?(:president) && !Tenant.current.has_presidents\n format.html { redirect_to member_path(@member), notice: 'Please select other user as President.' }\n elsif @member.update(member_params)\n remove_roles\n add_roles(params[:roles])\n format.html { redirect_to member_path(@member), notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n @resource = Relation.find params[:id]\n @resource.update_attributes!(params[:relation])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def update\n @teams = Team.order(:name)\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to \"/retrospectives\", notice: \"Your profile was succesfully updated!\" }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n @player = Player.find(params[:player_id])\n if @player.access_key == params[:access_key] && (@team.leader_id == @player.id || @team.game.owner_id == @player.id) then\n @team.name = params[:name]\n @team.leader_id = params[:leader_id]\n\n respond_to do |format|\n if @team.save\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n else\n head :unauthorized\n end\n end",
"def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"def update\n redirect_to :owners #no permit\n end",
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n respond_to do |format|\n if @orphan.update(orphan_params)\n format.html { redirect_to @orphan, notice: 'Orphan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @orphan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cta = Cta.find(params[:id])\n params[:users].each do |p|\n @cta.cta_relations.first.users << UserGroup.find(p)\n end\n @user.user_groups.uniq!\n\n respond_to do |format|\n if @cta.update_attributes(params[:cta])\n format.html { redirect_to @cta, notice: 'Cta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end",
"def update\n @division = Division.find(params[:id])\n @division.players << Player.find(params[:player_id]) if params[:player_id]\n\n respond_to do |format|\n if @division.update_attributes(params[:division])\n format.html { redirect_to @division, notice: 'Division was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @division.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_or_update_profile_configuration(args = {}) \n id = args['profileId']\n temp_path = \"/profiles.json/{profileId}/configuration\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"profileId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n\n end",
"def update\n @admin_collaborator = Admin::Collaborator.find(params[:id])\n\n respond_to do |format|\n if @admin_collaborator.update_attributes(params[:admin_collaborator])\n format.html { redirect_to @admin_collaborator, notice: 'Collaborator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_collaborator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n UserComposite.new( user_params.merge(id: params[:id]) ).update!\n render json: StatusSerializer.new(:accepted), status: :accepted\n rescue ActiveRecord::RecordInvalid => ex\n render json: UserSerializer.new( ex.record ), status: :unprocessable_entity\n end",
"def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end",
"def update\n @elector = Elector.find(params[:id])\n\n if @elector.update(elector_params)\n head :no_content\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end",
"def update\n\n @gradework.users = []\n\n if params.has_key?(:students) and params[:students] != [\"\"]\n students = params[:students]\n @gradework.users << User.find(students)\n end\n\n if params.has_key?(:juries) and params[:juries] != [\"\"]\n juries = params[:juries]\n @gradework.users << User.find(juries)\n end\n\n if params.has_key?(:directors) and params[:directors] =! \"\"\n directors = params[:directors]\n @gradework.users << User.find(directors)\n end\n\n respond_to do |format|\n if @gradework.update(gradework_params)\n format.html { redirect_to @gradework, notice: 'La tesis se modificó correctamente' }\n format.json { render :show, status: :ok, location: @gradework }\n else\n format.html { redirect_to @gradework, notice: 'La tesis no se modificó correctamente' }\n #format.html { render :edit }\n format.json { render json: @gradework.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @gradework.users = []\n\n if params.has_key?(:students) and params[:students] != [\"\"]\n students = params[:students]\n @gradework.users << User.find(students)\n end\n\n if params.has_key?(:juries) and params[:juries] != [\"\"]\n juries = params[:juries]\n @gradework.users << User.find(juries)\n end\n\n if params.has_key?(:directors) and params[:directors] =! \"\"\n directors = params[:directors]\n @gradework.users << User.find(directors)\n end\n\n respond_to do |format|\n if @gradework.update(gradework_params)\n format.html { redirect_to @gradework, notice: 'La tesis se modificó correctamente' }\n format.json { render :show, status: :ok, location: @gradework }\n else\n format.html { redirect_to @gradework, notice: 'La tesis no se modificó correctamente' }\n #format.html { render :edit }\n format.json { render json: @gradework.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @<%= orm_instance.update(\"#{singular_table_name}_params\") %>\r\n format.html { redirect_to @<%= singular_table_name %>, notice: <%= \"'#{human_name} was successfully updated.'\" %> }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: <%= \"@#{orm_instance.errors}\" %>, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @interested_user = InterestedUser.find(params[:id])\n\n respond_to do |format|\n if @interested_user.update_attributes(params[:interested_user])\n format.html { redirect_to @interested_user, :notice => 'Interested user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interested_user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @collaborator = Collaborator.find(params[:id])\n\n respond_to do |format|\n if @collaborator.update_attributes(params[:collaborator])\n format.html { redirect_to @collaborator, notice: 'Collaborator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collaborator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_name_merge_one_with_observations\n old_name = names(:mergeable_no_notes) # mergeable, ergo no observation\n assert(old_name.observations.none?, \"Test needs a different fixture.\")\n new_name = names(:coprinus_comatus) # has observations\n assert(new_name.observations.any?, \"Test needs a different fixture.\")\n\n params = {\n id: old_name.id,\n name: {\n text_name: new_name.text_name,\n author: new_name.author,\n rank: old_name.rank,\n citation: \"\",\n deprecated: (old_name.deprecated ? \"true\" : \"false\")\n }\n }\n login(\"rolf\")\n put(:update, params: params)\n\n assert_flash_success\n assert_redirected_to(name_path(new_name.id))\n assert_no_emails\n assert(new_name.reload)\n assert_not(Name.exists?(old_name.id))\n end",
"def update\n respond_to do |format|\n if @pick.update_attributes(picks_params)\n format.html { redirect_to games_path, notice: 'Pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @leadership.update(leadership_params)\n format.html { redirect_to @leadership, notice: 'Leadership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @leadership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end"
] |
[
"0.5877153",
"0.5859266",
"0.5837319",
"0.58131534",
"0.5788771",
"0.577431",
"0.57514715",
"0.5746399",
"0.5690212",
"0.5656355",
"0.56281143",
"0.5618896",
"0.56096923",
"0.5593497",
"0.557431",
"0.5567187",
"0.5562077",
"0.5548357",
"0.5514905",
"0.5498466",
"0.5492607",
"0.5470946",
"0.54690063",
"0.5456742",
"0.5456244",
"0.54559904",
"0.5450654",
"0.5440775",
"0.54173803",
"0.5416828",
"0.5410654",
"0.540214",
"0.5397559",
"0.53940207",
"0.5391962",
"0.539161",
"0.53857285",
"0.53714615",
"0.5367777",
"0.5367003",
"0.53645194",
"0.53595495",
"0.53595495",
"0.53392017",
"0.5337054",
"0.5317228",
"0.5315554",
"0.5311289",
"0.5304493",
"0.53017586",
"0.5293135",
"0.5291015",
"0.5284674",
"0.5282397",
"0.52818877",
"0.52809423",
"0.52798337",
"0.52785265",
"0.52766025",
"0.52711433",
"0.52692217",
"0.52670556",
"0.52655387",
"0.52642494",
"0.52639806",
"0.5250726",
"0.524735",
"0.52469695",
"0.5242282",
"0.52409893",
"0.5240943",
"0.5239472",
"0.5231079",
"0.5231036",
"0.52291673",
"0.52197415",
"0.5218659",
"0.5213904",
"0.5213046",
"0.5210732",
"0.5207662",
"0.5205105",
"0.52044016",
"0.52038264",
"0.5201982",
"0.519211",
"0.5188727",
"0.51884925",
"0.5187531",
"0.5187531",
"0.51854",
"0.51840395",
"0.5176985",
"0.5175118",
"0.51743793",
"0.51730615",
"0.51727545",
"0.5166633",
"0.5166633",
"0.5166633"
] |
0.64423686
|
0
|
DELETE /joineds/1 DELETE /joineds/1.json
|
def destroy
@joined.destroy
respond_to do |format|
format.html { redirect_to joineds_url, notice: 'Joined was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @cord.destroy\n respond_to do |format|\n format.html { redirect_to cords_url, notice: t('cords.destroy.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @relation = Relation.find(params[:id])\n @relation.destroy\n\n respond_to do |format|\n format.html { redirect_to relations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @firend_relationship.destroy\n respond_to do |format|\n format.html { redirect_to user_firend_relationships_url, notice: 'Firend relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant.studysite.destroy_all\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @leadership.destroy\n respond_to do |format|\n format.html { redirect_to leaderships_url }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def delete\n sql = 'DELETE FROM members WHERE id = $1'\n values = [@id]\n SqlRunner.run(sql, values)\nend",
"def destroy\n @person.skills.delete_all\n \n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n clients_delete(@entity)\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to clients_path }\n format.json { render json: {success: true} }\n end\n end",
"def destroy\n @relation.destroy\n respond_to do |format|\n format.html { redirect_to relations_url, notice: 'Relation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @npc_relation.destroy\n respond_to do |format|\n format.html { redirect_to npc_relations_url, notice: 'Npc relation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lunch.destroy\n respond_to do |format|\n format.html { redirect_to lunches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unlimited.destroy\n respond_to do |format|\n format.html { redirect_to unlimiteds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bowling_association.record :destroy, current_user, selected_tournament\n @bowling_association.destroy\n\n respond_to do |format|\n format.html { redirect_to bowling_associations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: UserBoards.delete(params[\"id\"])\n end",
"def destroy\n @male_shot_put_head.destroy\n respond_to do |format|\n format.html { redirect_to male_shot_put_heads_url, notice: 'Male shot put head was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slashdot_posting.destroy\n respond_to do |format|\n format.html { redirect_to slashdot_postings_url }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def destroy\n user = User.find(params[:id])\n senator = Senator.find(params[:senator_id])\n user.senators.delete(senator)\n render json: user.senators\n end",
"def test_urls_cascade_delete\n\t\tres = DB.exec(\"SELECT person_id FROM urls WHERE id=8\")\n\t\tassert_equal '5', res[0]['person_id']\n\t\tDB.exec(\"DELETE FROM people WHERE id=5\")\n\t\tres = DB.exec(\"SELECT person_id FROM urls WHERE id=8\")\n\t\tassert_equal 0, res.ntuples\n\tend",
"def destroy\n @order_history_joint.destroy\n respond_to do |format|\n format.html { redirect_to order_history_joints_url }\n format.json { head :no_content }\n end\n end",
"def delete_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows.delete(@followed)\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end",
"def destroy\n @red.destroy\n respond_to do |format|\n format.html { redirect_to reds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @junction = Junction.find(params[:id])\n @junction.destroy\n\n respond_to do |format|\n format.html { redirect_to junctions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @enrolled = Enrolled.find(params[:id])\n @enrolled.destroy\n\n respond_to do |format|\n format.html { redirect_to enrolleds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patron_merge.destroy\n\n respond_to do |format|\n format.html { redirect_to(patron_merges_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @zombie_sighting = ZombieSighting.find(params[:id])\n @zombie_sighting.destroy\n\n respond_to do |format|\n format.html { redirect_to zombie_sightings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @same.destroy\n respond_to do |format|\n format.html { redirect_to sames_url, notice: 'Same was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Like.delete(params[\"id\"])\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @leader = Leader.find(params[:id])\n @leader.destroy\n\n respond_to do |format|\n format.html { redirect_to leaders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @through_table = ThroughTable.find(params[:id])\n @through_table.destroy\n\n respond_to do |format|\n format.html { redirect_to through_tables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @setor = Setor.find(params[:id])\n @setor.destroy\n\n respond_to do |format|\n format.html { redirect_to setors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @combine.destroy\n respond_to do |format|\n format.html { redirect_to combines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stundent = Stundent.find(params[:id])\n @stundent.destroy\n\n respond_to do |format|\n format.html { redirect_to stundents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @target.destroy\n respond_to do |format|\n format.html { redirect_to after_write_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pg_first.destroy\n respond_to do |format|\n format.html { redirect_to pg_firsts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consists_of.destroy\n respond_to do |format|\n format.html { redirect_to consists_ofs_url, notice: 'Consists of was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participation.destroy\n respond_to do |format|\n format.html { redirect_to trips_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medium_road = MediumRoad.find(params[:id])\n @medium_road.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_roads_url }\n format.json { head :no_content }\n end\n end",
"def deleteuser(del_id)\n db.execute(\"DELETE FROM users WHERE user_id=?\", del_id)\n db.execute(\"DELETE FROM listings WHERE user_id=?\", del_id)\nend",
"def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend",
"def destroy\n @normal.destroy\n respond_to do |format|\n format.html { redirect_to normals_url, notice: '과목 정보가 삭제되었습니다.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nightclub.destroy\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @match.destroy\n render json: {success: true}\n end",
"def destroy\n @mld_mate.destroy\n respond_to do |format|\n format.html { redirect_to mld_mates_url, notice: \"Mld mate was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_sql.destroy\n respond_to do |format|\n format.html { redirect_to my_sqls_url, notice: 'My sql was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relationship_status.destroy\n respond_to do |format|\n format.html { redirect_to relationship_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # find ALL servings associated with this purchase and delete them\n all_servings = Serving.where(purchase_id: @purchase.id)\n puts \"all servings associated with this purchase: #{all_servings}\"\n all_servings.destroy_all\n puts \"deleted servings\"\n @purchase.destroy\n puts \"deleted purchase\"\n render json: {status: 204, purchase: @purchase}\n end",
"def destroy\n @leader.destroy\n respond_to do |format|\n format.html { redirect_to leaders_url, notice: 'leader was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rock.destroy\n render json: {message: 'Pedra Excluida'}, status: :ok\n end",
"def destroy\n @csrelation.destroy\n respond_to do |format|\n format.html { redirect_to csrelations_url, notice: 'Csrelation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n\n end",
"def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end",
"def destroy\n @hit = Hit.find(params[:id])\n @hit.reactions.destroy_all\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forest.destroy\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relationship.destroy\n respond_to do |format|\n format.html { redirect_to relationships_url, notice: 'Relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relationship.destroy\n respond_to do |format|\n format.html { redirect_to relationships_url, notice: 'Relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @<%= singular_table_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n @<%= orm_instance.destroy %>\n\n respond_to do |format|\n format.html { redirect_to <%= index_helper %>_url }\n format.json { head :ok }\n end",
"def destroy\n @owner.destroy\n respond_to do |format|\n format.html { redirect_to owners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_merge.destroy\n respond_to do |format|\n format.html { redirect_to admin_merges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @through_reference = ThroughReference.find(params[:id])\n @through_reference.destroy\n\n respond_to do |format|\n format.html { redirect_to through_references_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n Partextra.where(participant_id: @participant.id).destroy_all\n Badge.where(participant_id: @participant.id).destroy_all\n end",
"def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend",
"def delete_follows\n\n\t@follower = User.find(params[:id])\n\t@followed = User.find(params[:follows_id])\n\n\t@follower.follows.delete(@followed)\n\t\thead :no_content\n\t\t\n\tend",
"def destroy\n @fullurl.destroy\n respond_to do |format|\n format.html { redirect_to fullurls_url, notice: 'Fullurl was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.65177274",
"0.642456",
"0.636255",
"0.634181",
"0.63154453",
"0.6282337",
"0.627812",
"0.622095",
"0.6188782",
"0.61783826",
"0.6159404",
"0.6153933",
"0.61359674",
"0.6122363",
"0.6118371",
"0.61158764",
"0.6099251",
"0.60958564",
"0.6086497",
"0.6072789",
"0.60579747",
"0.6055328",
"0.6052332",
"0.6051051",
"0.60489",
"0.6048739",
"0.60484576",
"0.6043439",
"0.6041115",
"0.6040283",
"0.60388863",
"0.60358304",
"0.60316086",
"0.60288876",
"0.6025403",
"0.60185647",
"0.6009496",
"0.6005161",
"0.6002347",
"0.59979105",
"0.5993287",
"0.59907746",
"0.59853846",
"0.59789574",
"0.5978243",
"0.59712106",
"0.59691685",
"0.5962465",
"0.59614617",
"0.59590524",
"0.5958786",
"0.5955901",
"0.5955096",
"0.5954653",
"0.5952092",
"0.5950669",
"0.59497786",
"0.59482694",
"0.5946829",
"0.5946829",
"0.5944074",
"0.5943211",
"0.5941746",
"0.59413016",
"0.59407496",
"0.5940197",
"0.59365004",
"0.5933482",
"0.59333867",
"0.59325176",
"0.5925218",
"0.59251535",
"0.5924543",
"0.5924021",
"0.59234804",
"0.5922078",
"0.59211487",
"0.5918778",
"0.59186506",
"0.5917784",
"0.59138674",
"0.5909371",
"0.59092546",
"0.5908624",
"0.59081495",
"0.59057504",
"0.59049386",
"0.59049386",
"0.5904837",
"0.5895803",
"0.5892748",
"0.58895886",
"0.5889159",
"0.5888906",
"0.58885384",
"0.5888522",
"0.5888148",
"0.58878046",
"0.58860266",
"0.5884378"
] |
0.7089706
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_joined
@joined = Joined.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def default_action; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def call\n setup_context\n super\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] |
[
"0.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.5330087",
"0.5311993",
"0.5297402",
"0.5296789",
"0.52957207",
"0.52596015",
"0.5245442",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5235431",
"0.5231888",
"0.5226663",
"0.52220625",
"0.5217086",
"0.52137345",
"0.5208314",
"0.5205469",
"0.5175606",
"0.5174914",
"0.5173361",
"0.51662856",
"0.5161792",
"0.51572216",
"0.5153063",
"0.5152982",
"0.5152632",
"0.51435786",
"0.5139829",
"0.51346594",
"0.511372",
"0.511372",
"0.51136476",
"0.51083213",
"0.5108011",
"0.5091935",
"0.5089297",
"0.5081576",
"0.50807106",
"0.50656676",
"0.50548106",
"0.50537366",
"0.505074",
"0.505074",
"0.5033361",
"0.5025158",
"0.5020441",
"0.5015611",
"0.50142473",
"0.5000281",
"0.50001067",
"0.49989453",
"0.4989465",
"0.4989465",
"0.4985425",
"0.49805096",
"0.49795893",
"0.49783278",
"0.49676263",
"0.49656346",
"0.49579078",
"0.4955427",
"0.49554235",
"0.49536413",
"0.49523768",
"0.49457142",
"0.49433607",
"0.4933641",
"0.49320185",
"0.49265638",
"0.49262375",
"0.49259067",
"0.4922456",
"0.49201223",
"0.49165115",
"0.49158815",
"0.49151883",
"0.49149552",
"0.4914386"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def joined_params
params.require(:joined).permit(:order_id, :user_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Sets up group relations and scopes in this model. No extra columns are required in the model table.
|
def has_groups(options={})
return if has_groups?
class_eval {
include GroupedModel::GroupedInstanceMethods
def self.has_groups?
true
end
def self.visible
ungrouped
end
}
has_many :permissions, :as => :permitted
accepts_nested_attributes_for :permissions
has_many :groups, :through => :permissions
Group.define_retrieval_methods(self.to_s)
named_scope :visible_to, lambda { |reader|
conditions = "pp.group_id IS NULL"
if reader && reader.is_grouped?
ids = reader.group_ids
conditions = ["#{conditions} OR pp.group_id IS NULL OR pp.group_id IN(#{ids.map{"?"}.join(',')})", *ids]
end
{
:joins => "LEFT OUTER JOIN permissions as pp on pp.permitted_id = #{self.table_name}.id AND pp.permitted_type = '#{self.to_s}'",
:group => column_names.map { |n| self.table_name + '.' + n }.join(','),
:conditions => conditions,
:readonly => false
}
}
named_scope :ungrouped, lambda {
{
:select => "#{self.table_name}.*, count(pp.id) as group_count",
:joins => "LEFT OUTER JOIN permissions as pp on pp.permitted_id = #{self.table_name}.id AND pp.permitted_type = '#{self.to_s}'",
:having => "group_count = 0",
:group => column_names.map { |n| self.table_name + '.' + n }.join(','), # postgres requires that we group by all selected (but not aggregated) columns
:readonly => false
}
} do
def count
length
end
end
named_scope :grouped, lambda {
{
:select => "#{self.table_name}.*, count(pp.id) as group_count",
:joins => "LEFT OUTER JOIN permissions as pp on pp.permitted_id = #{self.table_name}.id AND pp.permitted_type = '#{self.to_s}'",
:having => "group_count > 0",
:group => column_names.map { |n| self.table_name + '.' + n }.join(','),
:readonly => false
}
} do
def count
length
end
end
named_scope :belonging_to, lambda { |group|
{
:joins => "INNER JOIN permissions as pp on pp.permitted_id = #{self.table_name}.id AND pp.permitted_type = '#{self.to_s}'",
:group => column_names.map { |n| self.table_name + '.' + n }.join(','),
:conditions => ["pp.group_id = ?", group.id],
:readonly => false
}
}
named_scope :find_these, lambda { |ids|
ids = ['NULL'] unless ids && ids.any?
{ :conditions => ["#{self.table_name}.id IN (#{ids.map{"?"}.join(',')})", *ids] }
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def groups\n @groups = init_groups\n end",
"def initialize\n @columns = { }\n @primary_keys = []\n @to_avoid = []\n @default_values = { }\n @associations = \n {\n :belongs_to => { },\n :has_one => { },\n :has_n => { }\n }\n end",
"def associate_records_to_groups\n put_isos_into_iso_group\n put_agents_into_iso_group\n put_merchants_into_iso_group\n end",
"def set_group_by(attributes)\n @group_by = GroupByClause.new(attributes)\n end",
"def initialize(*)\n super\n @relations = {}\n end",
"def all_groups\n return ancestors_base unless Group.supports_nested_groups?\n\n ancestors = base_and_ancestors_cte\n descendants = base_and_descendants_cte\n\n ancestors_table = ancestors.alias_to(groups_table)\n descendants_table = descendants.alias_to(groups_table)\n\n union = SQL::Union.new([model.unscoped.from(ancestors_table),\n model.unscoped.from(descendants_table)])\n\n relation = model\n .unscoped\n .with\n .recursive(ancestors.to_arel, descendants.to_arel)\n .from(\"(#{union.to_sql}) #{model.table_name}\")\n\n read_only(relation)\n end",
"def group_relations\n relations = EntityGroupRelationship.where(entity_id: self.id)\n relations.sort_by { |r| r[:position] }\n end",
"def setup_associations; end",
"def setup_groups_and_restaurants\n @restaurants = Restaurant.all(:order => 'name').collect { |r| [r.name, r.id] }\n @restaurants.unshift ['*Optimized', -1]\n @groups = current_user.groups(:order => 'name').collect { |g| [g.name, g.id]}\n end",
"def nested_set_scope\n raise \"called nested_set_scope\"\n options = {:order => quoted_left_column_name}\n scopes = Array(acts_as_nested_set_options[:scope])\n options[:conditions] = scopes.inject({}) do |conditions,attr|\n conditions.merge attr => self[attr]\n end unless scopes.empty?\n self.class.base_class.scoped options\n end",
"def setup\n @groups =\n Etsource::Fever.groups.map do |conf|\n Group.new(conf.name, self)\n end\n end",
"def set_group_order\n @group_order = GroupOrder.find(params[:id]).decorate\n end",
"def build_scope_from_columns\n self.scope\n end",
"def initialize(parent, model, relation_name, foreign_key)\n super(model)\n @parent, @relation_name, @foreign_key = parent, relation_name, foreign_key\n conditions.merge!(@foreign_key => @parent)\n end",
"def set_group_belonging\n #group_number = self.id % 4\n #self.update_attributes(group: group_number)\n self.update_attributes(group: 1)\n end",
"def with_group_members\n self\n end",
"def roomer_initialize_model!\n Roomer.register_model(self)\n @roomer_original_table_name = @table_name\n roomer_set_table_name_prefix\n roomer_ensure_table_name_prefix\n end",
"def load_groups\n @groups = Group.order(:name)\n end",
"def configure_relation\n end",
"def nested_set_scope(options = {})\n add_scope_conditions_to_options(options)\n\n self.class.base_class.default_scoped.nested_set_scope options\n end",
"def model_associations\n @model_associations ||= Prepares.model_associations\n end",
"def init_personal_group\n group = Group.new(_id: id, is_personal:true, name: email)\n group.save\n\n self.current_group = group\n groups << group\n end",
"def group_builder; end",
"def initialize_group_transform\n @parents_list = []\n @groups = Hash.new\n @parent_column = @query[\"group\"]\n @logs.select(@parent_column).group(@parent_column).order(@parent_column).each do |log|\n @groups[log[@parent_column]] = Hash.new\n @groups[log[@parent_column]][\"parent_values\"] = []\n @groups[log[@parent_column]][\"parent_values\"] << log[@parent_column]\n @groups[log[@parent_column]][\"child_values\"] = []\n @parents_list << log[@parent_column]\n end\n @parent_table_keys = []\n @parent_table_keys << @parent_column\n end",
"def setup_associations\n Optimizations::Associations::AssociationSet.new\n end",
"def add_constraints(scope)\n tables = construct_tables\n \n chain.each_with_index do |reflection, i|\n table, foreign_table = tables.shift, tables.first\n \n if reflection.source_macro == :has_and_belongs_to_many\n join_table = tables.shift\n \n scope = scope.joins(join(\n join_table,\n table[association_primary_key].\n eq(join_table[association_foreign_key])\n ))\n \n table, foreign_table = join_table, tables.first\n end\n \n if reflection.source_macro == :belongs_to\n if reflection.options[:polymorphic]\n key = reflection.association_primary_key(self.klass)\n else\n key = reflection.association_primary_key\n end\n \n foreign_key = reflection.foreign_key\n else\n key = reflection.foreign_key\n foreign_key = reflection.active_record_primary_key\n end\n \n # this is our addition\n table, key = maybe_split(table, key, reflection)\n foreign_table, foreign_key = maybe_split(foreign_table, foreign_key, reflection)\n # end\n \n if reflection == chain.last \n bind_val = bind scope, table.table_name, key.to_s, owner[foreign_key]\n scope = scope.where(table[key].eq(bind_val))\n \n if reflection.type\n value = owner.class.base_class.name\n bind_val = bind scope, table.table_name, reflection.type.to_s, value\n scope = scope.where(table[reflection.type].eq(bind_val))\n end\n else\n constraint = table[key].eq(foreign_table[foreign_key])\n \n if reflection.type\n type = chain[i + 1].klass.base_class.name\n constraint = constraint.and(table[reflection.type].eq(type))\n end\n \n scope = scope.joins(join(foreign_table, constraint))\n end\n \n # Exclude the scope of the association itself, because that\n # was already merged in the #scope method.\n scope_chain[i].each do |scope_chain_item|\n klass = i == 0 ? self.klass : reflection.klass\n item = eval_scope(klass, scope_chain_item)\n \n if scope_chain_item == self.reflection.scope\n scope.merge! item.except(:where, :includes)\n end\n \n scope.includes! item.includes_values\n scope.where_values += item.where_values\n scope.order_values |= item.order_values\n end\n end\n \n scope\n end",
"def apply_attributes_relationship!\n return unless attributes_groups\n\n self.calculator = ::Sheet::Calculator.new\n save_attributes_as_variables\n\n calculate_equipment_modifiers\n calculate_group_points\n calculate_based_attributes\n calculate_attributes_formula\n\n # TODO: remember to never modify the points of any attribute. Save\n # in separated fields and use the method `value` to sum them up\n\n # TODO: never let an attribute be based on another based attribute\n # Can it be based on a type=table group? To do that I need to parse the table\n # groups before everything, but the points will not be ready yet\n self\n end",
"def with_group\n self\n end",
"def default_prop_group_scope\n class_scope\n end",
"def model_relationships; end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.sectionGroup\"\n end",
"def save\n \n transaction do |transaction|\n check_usergroups! if self.usergroups and (not self.usergroups.empty?)\n super\n update_aspects\n transaction.commit\n end\n\n end",
"def roomer_reset\n roomer_set_table_name_prefix\n roomer_reset_table_name\n reset_column_information\n reset_associations\n end",
"def before_save\n prepare_attributes\n find_song_groups!\n end",
"def set_dataset_rel_and_attr\n @dataset.database = @database\n @dataset_id = @dataset.id\n organization = Organization.find_by_id(@organization_id)\n organization.datasets << @dataset\n @dataset.organization = organization\n end",
"def initialize_relationships\n @mappers.each do |mapper|\n @relationships.merge(mapper.relationships.find_dependent(@model))\n end\n\n @relationships.freeze\n end",
"def add_aggregate_model(model, *keys)\n # {{{\n add_foreign_key_to(model, *keys)\n @aggregate_klasses[model.table_name] = [ model, *keys ]\n @aggregates_tree[model.table_name] = model.__associations__.aggregates_tree\n # Required attributes of aggregated models are not \n # required in this model, as aggregated models are \n # referenced by their pkey only and have to exist \n # in DB already. \n # Thus, the foreign key to an aggregated model is\n # required only: \n keys.flatten.each { |attribute|\n @accessor.__attributes__.set_required(attribute)\n }\n inherit(model)\n end",
"def configure\n super\n create_has_many_through :subject\n end",
"def initialize(_, context = Ramom::Schema::Definition::Context.new)\n super\n infer_base_relations\n end",
"def with_group_owner\n self\n end",
"def setup_columns\n if inheritable?\n SimpleSet.new([primary_key, inheritance_column])\n else\n primary_key.blank? ? SimpleSet.new : SimpleSet.new([primary_key])\n end \n end",
"def save_groups\n self.groups.each { |c| if c.destroy_association? then c.destroy else c.save end }\n self.added_groups.each { |c| c.save unless c.nil? } unless self.added_groups.nil?\n end",
"def grouping_sets\n raise Error, \"GROUP BY GROUPING SETS not supported on #{db.database_type}\" unless supports_grouping_sets?\n clone(:group_options=>:\"grouping sets\")\n end",
"def relation\n adapter = self\n join_list = nil\n scope = @model_class.where(nil).where do\n expression, join_list = adapter.send(:build_accessible_by_expression, self)\n expression\n end\n\n add_joins_to_scope(scope, join_list)\n end",
"def initialize\n super\n @scope = ::Set.new\n end",
"def groups\n groups = []\n relations = self.group_relations\n relations.each do |r|\n groups.push r.group\n end\n groups\n end",
"def relations\n @relations ||= {}\n end",
"def ___set_includes\n ___upd_valid\n each_value do |item|\n next unless (ary = item.delete(:include))\n ary.each do |ref|\n item.get(:group) { Hashx.new }.update(self[ref][:group])\n end\n end\n end",
"def target_scope\n AssociationRelation.create(klass, self).merge!(klass.scope_for_association)\n end",
"def placement_groups\n @placement_groups ||= init_placement_groups\n end",
"def relation_scope\n if @scope\n @model_class.unscoped { @scope.send(resource_name).scope }\n else\n @model_class.unscoped\n end\n end",
"def reset_associations\n reflections.each_value do |r|\n r.instance_variable_set(:@quoted_table_name, nil)\n table_name = r.instance_variable_get(:@table_name)\n if (table_name)\n table_name = table_name.split(\".\").last\n klass = r.class_name.constantize\n schema_name = klass.tenanted? ? Roomer.current_tenant.try(:schema_name) : Roomer.shared_schema_name\n schema_name &&= schema_name.to_s\n schema_name ||= \"__no_tenant__\"\n table_name = \"#{schema_name}#{Roomer.schema_seperator}#{table_name}\"\n r.instance_variable_set(:@table_name, table_name)\n r.instance_variable_set(:@quoted_table_name, connection.quote_table_name(table_name))\n end\n end\n end",
"def create_associations\n self.associates.each do |associate|\n self.add_associated(associate)\n end\n end",
"def link!\n base = ::ActiveRecord::Associations::ClassMethods::JoinDependency.new(\n @model, [], nil\n )\n \n @fields.each { |field|\n field.model ||= @model\n field.columns.each { |col|\n field.associations[col] = associations(col.__stack.clone)\n field.associations[col].each { |assoc| assoc.join_to(base) }\n }\n }\n \n @attributes.each { |attribute|\n attribute.model ||= @model\n attribute.columns.each { |col|\n attribute.associations[col] = associations(col.__stack.clone)\n attribute.associations[col].each { |assoc| assoc.join_to(base) }\n }\n }\n end",
"def groups\n @groups ||= {}\n end",
"def set_group\n # byebug\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.with_attached_logo.includes(:conversations).friendly.find(params[:id])\n end",
"def prepare_select\n @group_items = GroupItem.all\n end",
"def initialize_db\n create_indexes_for_all_models\n end",
"def generate_fields_for(model, table)\n table.columns.each do |column|\n if column.options['references'] && parent_model = find_model(column.options['references'])\n model.add_relation(Model::Relation::BELONGS_TO, parent_model.name.underscore)\n #TODO: Look into if there is there a way to figure out a has_one relationship?\n parent_model.add_relation(Model::Relation::HAS_MANY, model.table_name)\n else\n model.add_field(column.name, column.type.to_s.classify, column.options)\n end\n end\n end",
"def collection_scope; end",
"def initialize model, logical_join, binding, from_record = nil, path = nil, reflection = nil, &blk\n @model = model\n @from = from_record\n @logical_join = logical_join\n @conditions = []\n @condition_blocks = []\n @reflection = reflection\n @path = [ path, reflection ].compact.flatten\n @binding = binding\n @order = []\n @negative = false\n @paginator = false\n @block = blk\n \n existing_methods = self.class.instance_methods(false)\n (model.column_names - existing_methods).each do |col|\n (class << self; self; end).class_eval do\n define_method(col.to_s.intern) do\n column(col)\n end\n end\n end\n (model.reflections.keys - existing_methods).each do |assn|\n (class << self; self; end).class_eval do\n define_method(assn.to_s.intern) do\n association(assn)\n end\n end\n end\n \n execute_block\n end",
"def set_group\n #@group = Group.find(params[:id])\n end",
"def groups\r\n @groups ||= fetch_groups\r\n end",
"def groups\n @groups ||= Groups.call(self)\n end",
"def groups\n @parent.groups(@filter)\n end",
"def init_groups\n @@client.describe_auto_scaling_groups.auto_scaling_groups\n end",
"def freeze\n associations\n super\n associations.freeze\n self\n end",
"def apply_standard_scope\n each_sort do |attribute, direction|\n @scope = resource.adapter.order(@scope, attribute, direction)\n end\n @scope\n end",
"def set_group\n data[:group]\n end",
"def up!(group)\n return if group.class != Group\n relationship = self.relation_for(group)\n return if relationship.nil?\n return if relationship.position == 0\n r = self.group_relations[relationship.position - 1]\n r.update_attribute(:position, relationship.position)\n relationship.update_attribute(:position, relationship.position - 1)\n end",
"def product_groups\n @product_groups ||= ProductGroupProxy.new(self)\n end",
"def group_params\n params.require(:group).permit(:owner_id, :parent_id, :name, :permissions)\n end",
"def init_placement_groups\n @@client.describe_placement_groups.placement_groups\n end",
"def default_param_group_scope\n @scope\n end",
"def on(group)\n @group = group\n self\n end",
"def scoped_collection\n super.preload(:gateway, :gateway_group, :routing_group, :routing_tag_mode, :vendor, :account, :statistic,\n :routeset_discriminator, network_prefix: %i[country network])\n end",
"def create_groups\n Group.create(name: \"MWF Morning\", days: [\"Monday\", \"Wednesday\", \"Friday\"], \n start_time: Time.local(2014, 8, 25, 8, 30, 0),\n end_time: Time.local(2014, 8, 25, 11, 30, 0)\n )\n Group.create(name: \"TTH Morning\", days: [\"Tuesday\", \"Thursday\"], \n start_time: Time.local(2014, 8, 25, 8, 30, 0),\n end_time: Time.local(2014, 8, 25, 11, 30, 0)\n )\n Group.create(name: \"Afternoon\", days: [\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\"], \n start_time: Time.local(2014, 8, 25, 12, 30, 0),\n end_time: Time.local(2014, 8, 25, 15, 30, 0)\n )\nend",
"def group_member_attribute\n super\n end",
"def namespace_scopes\n super\n end",
"def index\n @groups = policy_scope(Group)\n end",
"def after_create entity_group\n ueg=entity_group.user_entity_groups.build\n ueg.user=entity_group.creator\n ueg.save\n end",
"def initialize(model, name, options = {})\n super\n single = name.to_s.singularize\n @singular_name = options[:singular] || single.to_sym\n @attribute = options[:attribute] || single.foreign_key.to_sym\n @named_scope = options[:named_scope] || \"by_#{name}\".to_sym\n @model.named_scope @named_scope, lambda { |records| {:conditions => {@attribute => records}} }\n end",
"def set_groups_friends\n @friendships = current_user.friendships.all\n @friends = Array.new\n @friendships.each do |friendship|\n @friend = Hash.new\n @friend[:friend] = User.find(friendship.friend_id).name\n @friend[:id] = friendship.friend_id\n @friends.push(@friend)\n end\n @friends\n @groups=current_user.groups.all\n end",
"def configure\n create_belongs_to :subject, class_name_option(:subject)\n create_belongs_to :object, class_name_option(:object)\n end",
"def initialize(model, &block)\n @model = model\n @associations = {}\n @fields = []\n @attributes = []\n @conditions = []\n @groupings = []\n @options = {}\n @delta_object = nil\n \n initialize_from_builder(&block) if block_given?\n end",
"def relations \n @roots = Category.roots \n @categories = Category.has_children \n @expense_types = ExpenseType.all\n @payment_methods = PaymentMethod.all\n end",
"def set_group\n @group = Group.find_by(id: params[:id],user_id: current_handle_user.id)\n end",
"def finalize_associations!(relations:)\n super do\n associations.map do |definition|\n Memory::Associations.const_get(definition.type).new(definition, relations)\n end\n end\n end",
"def init_for_review\n self.food_groups_update ||= food_groups\n end",
"def group_through\n @group_through ||= reflect_on_association(group_through_identifier)\n end",
"def groups()\n\t\t\tend",
"def init\n ActiveRecord::Schema.define do\n create_table :students, force: true do |t|\n t.string :name\n t.belongs_to :organization\n end\n\n create_table :organizations, force: true do |t|\n t.string :name\n end\n\n create_table :projects, force: true do |t|\n t.string :title\n t.string :subcategory\n t.belongs_to :organization\n t.belongs_to :student\n end\n\n create_table :tags, force: true do |t|\n t.string :name\n t.string :tag_type\n t.belongs_to :project\n end\n end\nend",
"def find_groups\n @groups ||= Group.find(:all)\n end",
"def update_group_permissions \n if group_id.present?\n permissions = self.permissions\n # checking if user has permissions or not\n if permissions.present? && self.changed.include?('group_id')\n group_permissions = self.group.permissions\n if group_permissions.present? \n group_permissions.each do |p|\n if p.no_model_permission? \n permission = self.permissions.where(\"no_model_permission = ? AND subject_class = ? AND action = ?\",p.no_model_permission,p.subject_class,p.action).first_or_initialize \n else\n permission = self.permissions.where(\"no_model_permission = ? AND subject_class IS NULL AND action = ?\",p.no_model_permission,p.action).first_or_initialize \n end \n permission.actions_list = (permission.actions_list + p.actions_list).uniq \n permission.status = p.status\n permission.save\n end \n end\n else\n group_permissions = self.group.permissions\n if group_permissions.present?\n columns = (Permission.column_names) - [\"id\",\"resource_id\",\"resource_type\",'created_at','updated_at']\n # Creating all group permissions to user\n self.permissions.create( self.group.permissions.all(:select => columns.join(\",\") ).map(&:attributes) )\n end\n end\n end\n end",
"def group_through\n @group_through ||= self.class.group_through\n end",
"def create\n @group = Group.new(params[:group])\n\n #here we add the current user to the membership collection of the group\n @membership = @group.memberships.build(params[:membership])\n @membership.group = @group\n @membership.user = current_user\n @membership.initiator = false\n @membership.membership_status_id = 2\n \n #and here we set the current_user as the owner of the group\n @group_permission = @group.group_permissions.build(params[:group_permission])\n @group_permission.membership = @membership\n @group_permission.group_role = GroupRole.find_by_name('Owner')\n \n @group.metro_area = MetroArea.find(params[:metro_area_id])\n @group.state = (@group.metro_area && @group.metro_area.state) ? @group.metro_area.state : nil\n @group.country = @group.metro_area.country if (@group.metro_area && @group.metro_area.country)\n\n \n #current_user.track_activity(:created_a_group)\n \n# unless @user.is_in_group?(@group)\n# @user.memberships << @group\n# end\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n \n end",
"def delete_related_groups\n \n end",
"def group\n override_attr(:group, super)\n end",
"def build_group_body\n render_table data, options.to_hash\n end"
] |
[
"0.5691511",
"0.5637929",
"0.5628972",
"0.5460209",
"0.53210014",
"0.5306479",
"0.5296476",
"0.525185",
"0.52229434",
"0.51015556",
"0.5040195",
"0.50096405",
"0.49925354",
"0.4973446",
"0.49727598",
"0.4951639",
"0.49358112",
"0.49352038",
"0.49243206",
"0.48993593",
"0.48982418",
"0.48935378",
"0.48807365",
"0.48744363",
"0.48710287",
"0.4863101",
"0.48298126",
"0.48203316",
"0.48088533",
"0.4806635",
"0.48062846",
"0.47924778",
"0.47667763",
"0.4762943",
"0.47579584",
"0.4749566",
"0.47448468",
"0.47360972",
"0.47293687",
"0.4723065",
"0.4722333",
"0.47222993",
"0.47217295",
"0.47186756",
"0.4711218",
"0.47051314",
"0.46928734",
"0.46881476",
"0.46823397",
"0.46513677",
"0.46471146",
"0.46220276",
"0.46199074",
"0.46175456",
"0.46119165",
"0.46066502",
"0.4601027",
"0.45931068",
"0.45842606",
"0.4583239",
"0.4581573",
"0.4579207",
"0.45784512",
"0.4576427",
"0.4571279",
"0.45665032",
"0.45620516",
"0.45579198",
"0.45529172",
"0.45483115",
"0.45420855",
"0.45412925",
"0.45303544",
"0.45301703",
"0.45151824",
"0.451423",
"0.45131567",
"0.451179",
"0.4511524",
"0.45101386",
"0.4508681",
"0.45063612",
"0.45034528",
"0.45028248",
"0.44983402",
"0.44955185",
"0.44935384",
"0.44925052",
"0.44916478",
"0.44895846",
"0.4489517",
"0.44850647",
"0.44768503",
"0.4474055",
"0.44729975",
"0.44692573",
"0.4467914",
"0.44652173",
"0.44630432",
"0.4450527"
] |
0.53705025
|
4
|
I worked on this challenge [by myself, with: ]. 1. Initial Solution
|
def pad!(array, min_size, value = nil) #destructive
# Your code here
if min_size > array.length
array << value
return array
else
return array
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def solution4(input)\n end",
"def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend",
"def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(secondhalfstart..secondhalfend).each do |idx|\r\n half2 << n_string[idx].to_i\r\nend\r\n\r\nreturn true if half1.inject(:+) == half2.inject(:+)\r\nreturn false\r\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend",
"def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend",
"def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend",
"def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend",
"def solution(a, b)\n if a.length > b.length\n return (b + a + b).to_s\n else\n return (a + b + a).to_s\n end\nend",
"def decodeHalfway(input)\n sum = 0\n\n # Only have to loop through half the array since the numbers are being compared halfway around\n # Multiply each matching character by 2 to compensate for not looping through its pair\n input.chars[0..input.length/2 - 1].each_with_index do |char, i|\n sum += 2*char.to_i if char == input[i + input.length/2]\n end\n sum\nend",
"def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend",
"def solutions(a)\r\n\r\n ary = a.sort\r\n ary.each_with_index do |num, index|\r\n if ary[index+1] != num + 1 && index != ary.length-1\r\n return num + 1\r\n end\r\n end\r\n\r\nend",
"def is_happy(n)\n i = 0\n r = false\n destination = []\n while r == false\n n.to_s.split(\"\").each do |x|\n destination << ((x.to_i * x.to_i))\n end\n i = i + 1\n n = destination.inject(&:+)\n r = true if n == 1\n destination = []\n break if i == 1000\n end\n if r == true\n p r\n else\n p false\n end\nend",
"def solution(n)\n n.to_s.split(//).inject(1) { |a,d| a + d.to_i }\nend",
"def solution(a)\n number = a.to_s.chars\n first_arrays = []\n (number.length/2).times do\n first_arrays << number.shift\n first_arrays << number.rotate(number.length-1).shift\n number.pop\n end\n ( first_arrays + number ).join(\"\").to_i\nend",
"def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\nend",
"def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend",
"def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend",
"def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend",
"def isLucky(n)\n new_array = n.to_s.split(\"\")\n new_length = new_array.length\n\n a, b = [], []\n\n (0...new_length / 2).each { |x| a.push(new_array[x].to_i) }\n (new_length / 2...new_length).each { |y| b.push(new_array[y].to_i) }\n\n if a.inject(:+) == b.inject(:+)\n return true\n else\n false\n end\n\nend",
"def solution(a)\n # write your code in Ruby 2.2\n counts = {}\n missing = -1\n\n a.each do |a_i|\n counts[a_i] = counts[a_i].to_i + 1\n end\n\n (1..a.length).each do |i|\n if(counts[i].nil?)\n missing = i\n break\n end\n end\n\n if(missing == -1)\n missing = a.length + 1\n end\n\n missing\nend",
"def solution\n (2..(9**5 * 6)).select do |n|\n n.to_s.split(//).map do |d|\n d.to_i ** 5\n end.reduce(:+) == n\n end.reduce(:+)\nend",
"def input_string\n result = \"73167176531330624919225119674426574742355349194934\"\n result += \"96983520312774506326239578318016984801869478851843\"\n result += \"85861560789112949495459501737958331952853208805511\"\n result += \"12540698747158523863050715693290963295227443043557\"\n result += \"66896648950445244523161731856403098711121722383113\"\n result += \"62229893423380308135336276614282806444486645238749\"\n result += \"30358907296290491560440772390713810515859307960866\"\n result += \"70172427121883998797908792274921901699720888093776\"\n result += \"65727333001053367881220235421809751254540594752243\"\n result += \"52584907711670556013604839586446706324415722155397\"\n result += \"53697817977846174064955149290862569321978468622482\"\n result += \"83972241375657056057490261407972968652414535100474\"\n result += \"82166370484403199890008895243450658541227588666881\"\n result += \"16427171479924442928230863465674813919123162824586\"\n result += \"17866458359124566529476545682848912883142607690042\"\n result += \"24219022671055626321111109370544217506941658960408\"\n result += \"07198403850962455444362981230987879927244284909188\"\n result += \"84580156166097919133875499200524063689912560717606\"\n result += \"05886116467109405077541002256983155200055935729725\"\n result += \"71636269561882670428252483600823257530420752963450\"\n\n result\nend",
"def solution(s)\n if s.length.odd?\n center = s.length / 2\n if s[0...center] == s[center + 1..s.length].reverse\n return center \n end\n end\n -1\nend",
"def challenge; end",
"def minimumBribes(q)\n bribes = 0\n q.reverse.each_with_index do |n, i|\n if q[i] - (i + 1) > 2\n bribes = \"Too chaotic\"\n break\n end\n j = [0, q[i] - 2].max\n while j < i\n if q[j] > q[i]\n bribes += 1\n end\n j += 1\n end\n end\n puts bribes\nend",
"def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend",
"def solution(n)\n # write your code in Ruby 2.2\n a = n.to_s(2)\n arr = []\n if a[-1] == '1'\n arr = a.split('1')\n else\n arr = a.split('1')\n arr.pop\n end\n if arr.max.nil?\n 0\n else\n arr.max.length\n end\nend",
"def joltageDiff(input)\n # add my input device with rating +3\n input.append(input.max + 3)\n arr = input\n .sort\n .reverse\n \n diffs = arr\n .map.with_index{ |n, i|\n if i < arr.size - 1\n n - arr[i+1]\n end\n }\n diffs.pop # remove last element\n # puts diffs.sort\n counts = [0, 0, 0]\n counts[0] = diffs.select{ |n| n == 1 }.size + 1 # fuck knows why this is here.. #dirtyhack\n counts[1] = diffs.select{ |n| n == 2 }.size\n counts[2] = diffs.select{ |n| n == 3 }.size\n #puts counts\n return counts\nend",
"def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\nend",
"def solution(a)\n return 0 if a.length < 3\n a.sort!\n\n for i in 0..(a.length - 3)\n return 1 if a[i] + a[i + 1] > a[i + 2]\n end\n return 0\nend",
"def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend",
"def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend",
"def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend",
"def theLoveLetterMystery(s)\n chars = s.chars\n size = chars.length\n sum = 0\n ((size+1)/2..(size -1)).each do |i|\n num = chars[i].ord\n target_num = chars[size-1-i].ord\n sum += (num - target_num).abs\n end\n sum\nend",
"def isLucky(n)\n sum, sum2 = 0, 0\n arr = n.to_s.split(\"\")\n \n first_half = arr.take(arr.size / 2) \n second_half = arr.drop((arr.size / 2))\n first_half.each { |x| sum += x.to_i }\n second_half.each {|x| sum2 += x.to_i}\n \n sum == sum2\nend",
"def solution(roman)\n split = roman.split(\"\")\n last_value = 0\n split.reduce(0) do |final, char|\n current = CONVERSION[char.upcase]\n binding.pry\n if current >= last_value\n final += current\n else\n final -= current\n end\n binding.pry\n last_value = current\n final\n end\nend",
"def correct(element)\n result = nil\n element.downto(0).each do |j|\n i = element - j\n if j == element && j % 3 == 0\n result = Array.new(j, 5)\n elsif i % 5 == 0 && j % 3 == 0\n result = Array.new(j, 5) + Array.new(i, 3)\n elsif i == element && i % 5 == 0\n result = Array.new(i, 3)\n end\n\n break if result\n end\n\n if result.nil?\n puts -1\n else\n puts result.join()\n end\nend",
"def solution(a)\n # write your code in Ruby 2.2\n permutation = Array(1..a.size)\n # puts permutation\n return 1 if permutation - a == []\n 0\nend",
"def solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend",
"def solution(a)\r\n a.each do |num|\r\n if (a.count(num) % 2) != 0\r\n return num\r\n end\r\n end\r\nend",
"def formingMagicSquare(s)\r\n out = 100\r\n for i in 0...8 do\r\n cost = 0\r\n for j in 0...3 do\r\n for k in 0...3 do\r\n cost += ($magic_square[i][j][k] - s[j][k]).abs\r\n end\r\n end\r\n puts cost\r\n out = [out, cost].min\r\n end \r\n out\r\nend",
"def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend",
"def solve(str)\n idx = 0\n count = 0\n\n substr_1 = ''\n substr_2 = ''\n\n loop do\n substr_1 = str[0..idx]\n substr_2 = str[(idx + 1)..-1]\n\n substr_1.to_i.odd? ? count += 1 : nil \n substr_2.to_i.odd? ? count += 1 : nil \n \n idx += 1\n break if idx >= str.length\n end\n count\nend",
"def solve(s)\n answer = \"\"\n (0...s.length - 1).each do |idx|\n if s[idx] != s[idx + 1]\n answer += s[idx]\n end\n if idx == s.length - 2 && s[idx] == s[idx + 1]\n answer += s[idx]\n end\n end\n return answer\nend",
"def solution(a)\n return 1 if a.count == 0\n \n real_sum = a.inject(:+)\n expected_sum = (a.count + 1) * (a.count + 2) / 2.0\n (expected_sum - real_sum).to_i\nend",
"def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end",
"def solution(a)\n ans = 0\n for i in 1 .. (a.length - 1)\n ans += a[i]\n end \n ans\nend",
"def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend",
"def luhns(a)\n\tb = a.to_s[0..-2].reverse.split(\"\").to_a.map{|v|v.to_i}\n\t(b.each_index{|i|i.even? ? b[i]=b[i]*2>9?b[i]*2-9:b[i]*2:i=i}.inject(:+)+a)%10==0\nend",
"def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend",
"def solution(a)\n # write your code in Ruby 2.2\n numbers = Array(1..(a.size + 1))\n res = numbers - a\n res[0]\nend",
"def minimumBribes(q)\n bribe_count = 0\n # q.each_with_index do |person,i|\n i = q.size-1\n while i >= 0 do\n person = q[i]\n position = i+1\n offset = person - position\n\n if offset > 2\n puts \"Too chaotic\"\n return\n else\n j=[0,person-2].max\n while j < i do\n if q[j] > person\n bribe_count += 1\n else\n # break if j+1 == person\n end\n j+=1\n end\n end\n i-=1\n end\n puts bribe_count\nend",
"def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend",
"def solution(x, a)\n count = 1\n indices = []\n while count <= x\n indices << a.find_index(count)\n count += 1\n end\n\n if indices.include?(nil)\n -1\n else\n indices.sort.last\n end\nend",
"def pe52(startAt, endAt)\n (startAt..endAt).step(6).each do |x|\n bNum = x/6\n bNumCSort = bNum.to_s.chars.sort\n next if bNumCSort != x.to_s.chars.sort\n next if bNumCSort != (bNum*5).to_s.chars.sort\n next if bNumCSort != (bNum*4).to_s.chars.sort\n next if bNumCSort != (bNum*3).to_s.chars.sort\n next if bNumCSort != (bNum*2).to_s.chars.sort\n return bNum\n end\n false\nend",
"def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend",
"def solution(a)\n comp_array = (Array.new(a.length+1){ |index| index+1 })\n diff = comp_array - a\n p diff[0]\nend",
"def solution2(a)\n\n counts = Hash.new(0)\n\n a.each do |int|\n counts[int] += 1\n end\n\n non_divisors = []\n\n a.each do |int|\n div_count = 0\n for i in 1..int do\n div_count += counts[i] if int % i == 0\n end\n non_divisors << a.length - div_count\n end\n\n non_divisors\n\nend",
"def isLucky(n)\n a = n.to_s.split(\"\")\n full = a.count - 1\n half = a.count/2 - 1\n \n total_1 = 0\n total_2 = 0\n \n for i in 0..full\n if i > half\n total_2 += a[i].to_i\n else\n total_1 += a[i].to_i\n end\n end\n \n if total_1 == total_2\n true\n else\n false\n end\nend",
"def solution(n)\n siblings = n.to_s.chars.each_slice(1).to_a\n siblings.sort {|x,y| -(x <=> y)}.join.to_i\nend",
"def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend",
"def solution(a)\n\traise ArgumentError.new(\"a has to be non empty array of max size #{MAX_LEN}\") if !a.is_a? Array or a.empty? or a.length > MAX_LEN\n\tret = 0\n\t#puts a.inspect\n\tmy_h = Hash.new\n\ta.each do |e|\n\t\tif my_h.include? e\n\t\t\tmy_h[e] += 1\n\t\telse\n\t\t\tmy_h[e] = 1\n\t\tend\n\tend\n\n\tmy_h_sort = my_h.sort_by {|k, v| -v}\n\t# -> my_h_sort[value][occurances]\n\treturn 0 if my_h_sort.first[1] < a.size/2\n\tleader_val = my_h_sort.first[0]\n\n\tocc_array = Array.new\n\toccurances = 0\n\ta.each do |e|\n\t\toccurances += 1 if e == leader_val\n\t\tocc_array.push(occurances)\n\tend\n\t#puts occ_array.inspect\n\n\tfor idx in (0...a.length-1) do\n\t\tsum1 = occ_array[idx]\n\t\tsum2 = occ_array.last - occ_array[idx]\n\n\t\t# puts \"#{idx}+1 < #{sum1*2}\"\n\t\t# puts \"#{(a.length - idx -1)} < #{(sum2*2 )} \"\n\n\t\tif (idx+1) < sum1 * 2 && (a.length - idx - 1 ) < sum2 * 2\n\t\t\t## we have a leader\n\t\t\t#puts \"YEAH #{idx}\"\n\t\t\tret += 1\n\t\tend\n\t\t\t#puts \"-------- ret: #{ret}\"\n\tend\n\treturn ret\nend",
"def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend",
"def solution(a)\n # write your code in Ruby 2.2\n\n # sort a\n a = a.sort\n odd = 0\n\n # loop over the array\n (0..(a.length-1)).step(2) do |i|\n if((i+1 >= a.length) || ((i+1 < a.length) && (a[i] != a[i+1])))\n odd = a[i]\n break\n end\n end\n\n odd\nend",
"def solveProblem lst\n big = -1\n numbers = {}\n half = lst.length / 2\n lst.each do |i|\n if numbers.has_key?(i) then\n numbers[i] += 1\n else\n numbers[i] = 1\n end\n if numbers[i] > half then return i end\n end\n return big\nend",
"def solution4(a)\n left = 0\n right = a.size - 1\n distinct = 0\n\n while left <= right\n # puts \"left: #{left}, right: #{right}\"\n # puts \"a[l]: #{a[left]}, a[r]: #{a[right]}\"\n # puts \"distinct: #{distinct}\"\n if a[left].abs > a[right].abs\n begin\n left += 1\n end until a[left] != a[left - 1]\n elsif a[left].abs < a[right].abs\n begin\n right -= 1\n end until a[right] != a[right + 1]\n else\n begin\n left += 1\n end until a[left] != a[left - 1]\n begin\n right -= 1\n end until a[right] != a[right + 1] \n end\n\n distinct += 1\n end\n distinct\nend",
"def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend",
"def captcha(input)\n sum = 0\n 0.upto(input.length - 1) do |i|\n sum += input[i].to_i if input[i] == input[(i+1) % input.length]\n end\n sum\nend",
"def problem18(r) \n h = r.length\n sum = 0\n for i in 0..h-1 \n \n end\nend",
"def solution1(seeds)\n turn_map = {}\n seeds.each_with_index { |n, turn| turn_map[n] = [1, turn + 1, turn + 1] }\n last_number = seeds.last\n\n ((seeds.length+1)..2020).each do |turn|\n last_stats = turn_map[last_number]\n if last_stats[TIMES_SPOKEN] == 1\n zero = turn_map[0] || [0, turn, turn]\n zero[TIMES_SPOKEN] += 1\n zero[FIRST_SPOKEN] = zero[LAST_SPOKEN]\n zero[LAST_SPOKEN] = turn\n \n turn_map[0] = zero\n last_number = 0\n else\n age = last_stats[LAST_SPOKEN] - last_stats[FIRST_SPOKEN]\n\n num = turn_map[age] || [0, turn, turn]\n num[TIMES_SPOKEN] += 1\n num[FIRST_SPOKEN] = num[LAST_SPOKEN]\n num[LAST_SPOKEN] = turn\n \n turn_map[age] = num\n last_number = age\n end\n end\n\n last_number\nend",
"def solution a\n a.sort!\n until a.empty?\n answer = a.pop\n return answer if a.pop != answer\n end\nend",
"def solution(a)\n cars_going_east = [0]\n\n a.each do |direction|\n next_counter = direction.zero? ? cars_going_east.last + 1 : cars_going_east.last\n cars_going_east << next_counter\n end\n\n passings = 0\n a.each_with_index do |direction, index|\n passings += cars_going_east[index] if direction == 1\n end\n\n return -1 if passings > 1000000000\n passings\nend",
"def solution(a)\n candidate = a[0]\n count = 0\n index = 0\n a.each_with_index do |d, idx|\n count = candidate == d ? count += 1 : count -= 1\n if count == 0\n candidate = d\n count = 1\n index = idx\n end\n end\n a.count { |d| d == candidate } * 2 > a.length ? index : -1\nend",
"def decent_number(n)\n\tleft = 0\n\tright = 0\n\t(n+1).times do |i|\n\t\tleft = n - i \n\t\tright = n - left\n\t#\tputs \"#{left}%3 = #{left%3} | #{right}%5 = #{right%5}\"\n\t\tbreak if left % 3 == 0 && right % 5 == 0\n\tend\n\t#puts \"**l = #{left} r = #{right}\"\n\n\tif left % 3 == 0 && right % 5 == 0\n\t\tfives = \"5\"*left\n\t\tthrees = \"3\"*right\n\t\tputs fives+threes\n\telse\n\t\tputs -1\n\tend\nend",
"def solution(arr)\n zeros = 0\n pass_cars = 0\n\n (0...arr.size).each do |idx|\n arr[idx] == 0 ? zeros += 1 : pass_cars += zeros\n\n return -1 if pass_cars > 1000000000\n end\n\n pass_cars\nend",
"def isLucky(n)\n n = n.to_s.split('').map(&:to_i)\n n.shift(n.size/2).reduce(:+) == n.reduce(:+)\nend",
"def solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend",
"def solution(n)\n # write your code in Ruby 2.2\n a = Math.sqrt(n).floor\n a -= 1 while n % a != 0\n b = n / a\n (a + b) * 2\nend",
"def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend",
"def clever_octopus(arr)\n i = 0\n j = arr.length-1\n\n max = arr[0]\n while i != j\n if arr[i].length < arr[j].length\n max = arr[j]\n i += 1\n elsif arr[j].length <= arr[i].length\n max = arr[i]\n j -= 1\n end\n end\n max \nend",
"def solution(n)\n\tval = 0.0\n\tval += 1.0 unless n[0].zero?\n\tval += 2.0 unless n[1].zero?\n\tval += 4.0 unless n[2].zero?\n\tval += 8.0 unless n[3].zero?\n val\n\t\nend",
"def missingNumber(array)\n currentSum = array.inject(:+)\n n = array.length + 1\n expectedSum = n * (n + 1) / 2\n puts expectedSum - currentSum\nend",
"def solution(a)\n result = 0\n tmp_count = 0\n a.each_with_index do |val, idx|\n if val.zero?\n tmp_count += 1\n else\n result += tmp_count\n end\n end\n return result > 1000000000 ? -1 : result\nend",
"def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend",
"def slugish_octopus(arr) # quadratic\n largest = []\n arr.each_with_index do |e1, i1|\n arr.each_with_index do |e2, i2|\n if e1.length > e2.length\n largest = e1\n else\n largest = e2\n end\n end\n end\n largest.to_s\nend",
"def minimumBribes(q)\n cont = 0\n for i in (q.size-1).downto(2)\n #p \" (#{i}) ==> #{q}\"\n if !v(q,i)\n cont = \"Too chaotic\"\n break\n elsif q[i]-1 != i\n if q[i-1]-1 == i \n aux = q[i]\n q[i] = q[i-1]\n q[i-1] = aux\n else\n aux = q[i]\n q[i] = q[i-2]\n q[i-2] = q[i-1]\n q[i-1] = aux\n cont += 1 \n end\n cont += 1 \n end\n end\n printf \"%s\\n\", q[0] != 1 && cont != \"Too chaotic\" ? cont+1 : cont\nend",
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def minimumBribes(q)\r\n moves = 0\r\n r = (0..q.size-1).to_a\r\n\r\n until q == (1..q.size).to_a do\r\n q.map { |a| a - 1 }\r\n .reverse_each.with_index do |person, i|\r\n i = q.size - i - 1\r\n if person - i > 2\r\n puts \"Too chaotic\"\r\n return\r\n end\r\n\r\n if person > r[i] && person > q[person] -1\r\n moves += person - r[i]\r\n q = q - [person + 1]\r\n q.insert(person, person + 1)\r\n end\r\n end\r\n end\r\n\r\n puts moves\r\nend",
"def missing_number(nums)\n length = nums.length\n\n sum = (length * (length + 1)) / 2\n\n nums.each do |num|\n sum -= num\n end\n\n sum\nend",
"def solve_zero_vs_six_vs_nine\n return if @arr[1].nil? || @arr[4].nil?\n\n #p \"1,4: #{@arr[1]},#{@arr[4]}\"\n\n @words.filter{|x| x.length == 6 && @hash[x].nil?}.each{|w|\n if @arr[4].chars.all?{|c| w.chars.include?(c)}\n solved(9, w)\n elsif @arr[1].chars.all?{|c2| w.chars.include?(c2)}\n solved(0, w)\n else\n solved(6, w)\n end\n }\n end",
"def solution(a)\n return 0 if a.uniq.size != a.size\n \n max = a.size \n sum = (1 + max) * max / 2\n \n array_sum = a.inject(0, &:+) \n sum == array_sum ? 1 : 0 \nend",
"def problem_108(size = 1001)\n func = lambda do |a|\n if a.length == 1\n a[0]+1\n else\n m = a[0]\n (2*m+1) * func.call(a[1,a.length]) -m\n end\n end\n\n primes = Primes.upto(200)\n prime_number = lambda do |a|\n r = 1\n a.sort.reverse.each_with_index { |m,i| r *= primes[i] ** m }\n r\n end\n\n values = {}\n last = 0\n 1.upto(100).each do |nn|\n nn.groupings do |a|\n sols = func.call a\n ans = prime_number.call a\n# puts \"np=#{nn} sols=#{sols} ans=#{ans} => #{a.inspect}\"\n if values[sols]\n values[sols] = [values[sols],[ans,a]].min\n else\n values[sols] = [ans,a]\n end\n true\n end\n size.upto(size*5/4) do |num|\n if values[num]\n puts \"for np = #{nn} => #{num} => #{values[num].inspect}\"\n if last == values[num]\n puts \"factors = #{values[num][0].factors}\"\n return values[num][0] \n end\n last = values[num]\n break\n end\n end\n #values.sort.each do |k,v|\n # puts \"#{k} => #{v}\"\n #end\n end\n nil\nend",
"def solution\n 971 * (-61)\nend",
"def solution(a, b, k)\n # write your code in Ruby 2.2\n e = b / k\n s = (a-1) / k\n\n e - s\nend",
"def solve_two_vs_three_vs_five\n return if @arr[1].nil? || @arr[6].nil?\n\n #p \"1,6: #{@arr[1]},#{@arr[6]}\"\n\n @words.filter{|x| x.length == 5 && @hash[x].nil?}.each{|w|\n if @arr[1].chars.all?{|c| w.chars.include?(c)}\n solved(3, w)\n elsif w.chars.all?{|c2| @arr[6].chars.include?(c2)}\n solved(5, w)\n else\n solved(2, w)\n end\n }\n end",
"def funny string\n arr = string.chars\n count = 0\n arr.each_with_index do |x,xi|\n if xi > 0\n s1 = (x.ord - arr[xi-1].ord).abs\n s2 = (arr[-(xi+1)].ord - arr[-xi].ord).abs\n s1 == s2 ? count +=1 : break\n end\n end\n puts count == arr.size-1 ? 'Funny' : 'Not Funny'\nend",
"def solution(a)\n # write your code in Ruby 2.2\n a.sort!\n min =1\n a.each{|x|\n if (x==min)\n min = min+1\n end\n }\n return min\nend",
"def find_missing_letter(arr)\n #your code here\n result = 0\n base_arr = arr.join().codepoints\n base_arr.each_with_index do |item,index|\n if base_arr[index+1] != item + 1\n result = item + 1\n break\n end\n end\n result.chr\nend",
"def solution(a)\n # write your code in Ruby 2.2\n return 0 unless a[0]\n necklaces = create_necklaces(a)\n \n \n size = necklaces.length\n index = 0\n max = necklaces[index].length\n \n while index < size\n if necklaces[index].length > max\n max = necklaces[index].length\n end\n index += 1\n end\n \n return max\nend",
"def solution(a)\n left = 0\n right = a.sum\n a.each_with_index do |element, index|\n right -= element\n return index if left == right\n left += element\n end\n -1\nend"
] |
[
"0.6214657",
"0.60906076",
"0.60019654",
"0.59951097",
"0.59756225",
"0.59489906",
"0.5918387",
"0.5905622",
"0.5898738",
"0.5892188",
"0.58871514",
"0.5863911",
"0.5858467",
"0.5841975",
"0.58291435",
"0.5826497",
"0.5801665",
"0.5792341",
"0.578724",
"0.57863325",
"0.57785094",
"0.5775296",
"0.5774754",
"0.5769842",
"0.5767589",
"0.5751856",
"0.57455647",
"0.5739888",
"0.57386464",
"0.5728107",
"0.57229024",
"0.5718536",
"0.5716619",
"0.57160586",
"0.5714528",
"0.5706594",
"0.5704627",
"0.57046103",
"0.5685514",
"0.56571",
"0.56493074",
"0.5645051",
"0.5643277",
"0.5638484",
"0.56351984",
"0.56347114",
"0.5630633",
"0.5626176",
"0.5620612",
"0.56174284",
"0.5615227",
"0.5602286",
"0.5594222",
"0.5590965",
"0.5588001",
"0.55860645",
"0.5582631",
"0.55797786",
"0.55786103",
"0.55765957",
"0.55753285",
"0.5563175",
"0.5561997",
"0.55534047",
"0.5552483",
"0.5549858",
"0.5549218",
"0.55385035",
"0.5535917",
"0.55320084",
"0.5527953",
"0.5519967",
"0.55142355",
"0.5513436",
"0.5512269",
"0.5511399",
"0.5510244",
"0.5509666",
"0.5508961",
"0.5505893",
"0.5500628",
"0.54999596",
"0.5499632",
"0.5497515",
"0.54966617",
"0.5495827",
"0.5495635",
"0.54945",
"0.5491687",
"0.5491671",
"0.548978",
"0.54887366",
"0.5485648",
"0.5482606",
"0.54798436",
"0.547833",
"0.5476742",
"0.54748803",
"0.5474764",
"0.54733723",
"0.5472843"
] |
0.0
|
-1
|
GET /sales_forecasts GET /sales_forecasts.json
|
def index
per_page = 50
@service_centers = ServiceCenter.all
@show_all = params[:show_all]
@sc = params[:sc]
@status = params[:status]
@segment = params[:segment]
@sales_forecasts = select_sales_forecasts_with_sorting
@paginated_sales_forecasts = paginate(@sales_forecasts, per_page)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @forecast_72s = Forecast72.all\n end",
"def forecast(forecast_path)\r\n response = Curl.get(forecast_path) do |curl|\r\n curl.headers['Accept'] = 'application/json'\r\n end\r\n JSON.parse(response.body_str)\r\n end",
"def forecast(query)\n get_json(\"#{api_url}/forecast/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def show\n @forecast = Forecast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast }\n end\n end",
"def index\n @forecasts = @user.forecasts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @forecasts }\n end\n end",
"def set_sales_forecast\n @sales_forecast = SalesForecast.find(params[:id])\n end",
"def forecast\n render json: @current_user.forecast\n end",
"def index\n @forecast_msizes = ForecastMsize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forecast_msizes }\n end\n end",
"def forecast(latitude, longitude, options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/forecast/#{@api_key}/#{latitude},#{longitude}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200\n end",
"def index\n @forecast_wsizes = ForecastWsize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forecast_wsizes }\n end\n end",
"def index\n @expence_forecasts = ExpenceForecast.all\n end",
"def index\n @forecasts = Forecast.all\n @days = @forecasts.order(\"created_at desc\").pluck(:date).uniq\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end",
"def create\n @sales_forecast = SalesForecast.new(sales_forecast_params)\n\n respond_to do |format|\n if @sales_forecast.save\n format.html { redirect_to @sales_forecast, notice: 'Sales forecast was successfully created.' }\n format.json { render :show, status: :created, location: @sales_forecast }\n else\n format.html { render :new }\n format.json { render json: @sales_forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def forecast_array\n @forecast ||= HTTParty.get(\"http://api.openweathermap.org/data/2.5/forecast/daily?q=Seattle&cnt=3&units=imperial&mode=json\").parsed_response[\"list\"]\n end",
"def get_forecast_data\n result = RestClient.get(request_url)\n @xml = REXML::Document.new(result)\n end",
"def get_surf_data\n url = \"http://magicseaweed.com/api/#{ENV['MAGIC_SEAWEED_API_KEY']}/forecast/?spot_id=6128&units=UK\"\n uri = URI(url)\n\n response = Net::HTTP.get(uri)\n ActiveSupport::JSON.decode(response) if response != ''\n end",
"def weather\n # empty array dates is still fine, not a reason for 400 (happens for venues without courts)\n render json: {} and return if params.dig(:dates).blank?\n\n forecast = WeatherForecaster.call(venue, [*params.require(:dates)])\n json = forecast.transform_values do |value|\n value ? value.slice(*%w(icon temperature)) : nil\n end\n render json: json\n end",
"def get_forecast\n @forecast = ForecastIO.forecast( lat, lng )\n end",
"def index\n @monthly_finances = MonthlyFinance.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @monthly_finances }\n # end\n end",
"def index\n @day_forecasts = DayForecast.where(\"forecast_datetime >= ?\", Time.current.beginning_of_day)\n @half_forecasts = HalfForecast.where(point_date: Config.last.half_forecast_point_date)\n end",
"def index\n @sales = @saleService.all_to_json().as_json;\n end",
"def extended_forecast(query)\n get_json(\"#{api_url}/forecast10day/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def index\n @forecast_hours = ForecastHour.all\n end",
"def salesApi\n require 'uri'\n require 'net/http'\n require 'json'\n\n #Arrays for each category\n \n @frequency = Hash.new(0)\n\n url = URI(\"https://api.salesloft.com/v2/people.json\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n request[\"Authorization\"] = 'Bearer ' + ENV[\"API_KEY\"]\n\n response = http.request(request)\n \n @body = JSON.parse(response.body)['data']\n return @body\n end",
"def index\n @dji_forecasts = DjiForecast.all.order(\"created_at desc\").paginate(:page => params[:page], :per_page => 15)\n end",
"def forecasts\n convertions = [[:date, :to_date], [:low, :to_i], [:high, :to_i], [:code, :to_i], :day, :text]\n item_attribute('yweather:forecast').collect do |forecast|\n translate! do_convertions(forecast, *convertions)\n end\n end",
"def index\n @weather_station = WeatherStation.find(params[:weather_station_id])\n @meteo_data = []\n @meteo_data = @weather_station.meteo_datums.order('created_at desc').limit(100) unless @weather_station.blank?\n\n render 'api/v1/meteo_data/index', params: [@weather_station, @meteo_data]\n end",
"def index\n @sales = Sale.all\n\n render json: @sales\n end",
"def index\n\n require 'net/http'\n require 'json'\n\n @measures = Measure.all.order(\"created_at DESC\")\n weatherData\n\n end",
"def set_forecast\n @forecast = Forecast.find(params[:id])\n end",
"def set_forecast\n @forecast = Forecast.find(params[:id])\n end",
"def forecast(loc)\n\n url = \"#{@base_url}/#{FORECAST_QUERY}/q/#{loc[0]},#{loc[1]}.json\" \n\n result = JSON.parse(open(url).read)\n\n return nil if result['response']['error'] \n return nil unless result['current_observation']\n\n obs = result['current_observation']\n loc = result['current_observation']['observation_location']\n fc = result['forecast']['simpleforecast']\n\n # puts 'Fetching for ' + obs['station_id']\n \n weather = WeatherStation.find_or_create_by_station_id(obs['station_id'])\n\n location = ObservationLocation.new\n\n location.full = loc['full']\n location.city = loc['city']\n location.state = loc['state']\n location.country = loc['country']\n location.country_iso3166 = loc['country_iso3166']\n location.loc = [loc['latitude'].to_f,loc['longitude'].to_f]\n location.elevation = loc['elevation']\n \n weather.observation_location = location\n\n weather.forecasts.clear\n\n fc['forecastday'].each do |f|\n\n forecast = Forecast.new\n\n date = DateTime.strptime(f['date']['epoch'].to_s,'%s')\n\n forecast.date = date\n forecast.conditions = f['conditions']\n forecast.pop = f['pop']\n forecast.high_c = f['high']['celsius']\n forecast.high_f = f['high']['fahrenheit']\n forecast.low_c = f['low']['celsius']\n forecast.low_f = f['low']['fahrenheit']\n\n forecast.qpf_day_mm = f['qpf_day']['mm']\n forecast.qpf_day_in = f['qpf_day']['in']\n forecast.qpf_allday_mm = f['qpf_allday']['mm']\n forecast.qpf_allday_in = f['qpf_allday']['in']\n forecast.qpf_night_mm = f['qpf_night']['mm']\n forecast.qpf_night_in = f['qpf_night']['in']\n\n forecast.snow_day_mm = f['snow_day']['mm']\n forecast.snow_day_in = f['snow_day']['in']\n forecast.snow_allday_mm = f['snow_allday']['mm']\n forecast.snow_allday_in = f['snow_allday']['in']\n forecast.snow_night_mm = f['snow_night']['mm']\n forecast.snow_night_in = f['snow_night']['in']\n\n forecast.wind_max_kph = f['maxwind']['kph'] \n forecast.wind_max_mph = f['maxwind']['mph'] \n forecast.wind_max_dir = f['maxwind']['dir'] \n forecast.wind_max_degrees = f['maxwind']['degrees'] \n\n forecast.wind_ave_kph = f['avewind']['kph'] \n forecast.wind_ave_mph = f['avewind']['mph'] \n forecast.wind_ave_dir = f['avewind']['dir'] \n forecast.wind_ave_degrees = f['avewind']['degrees'] \n\n forecast.humidity_ave = f['avehumidity']\n forecast.humidity_min = f['minhumidity']\n forecast.humidity_max = f['maxhumidity']\n\n weather.forecasts << forecast\n\n end\n\n weather.observation_time_rfc822 = obs['observation_time_rfc822']\n weather.local_time_rfc822 = obs['local_time_rfc822']\n weather.weather = obs['weather']\n weather.temp_f = obs['temp_f']\n weather.temp_c = obs['temp_c']\n weather.relative_humidity = obs['relative_humidity']\n weather.precip_today_metric = obs['precip_today_metric']\n\n return weather\n\n end",
"def show\n @forecast = Forecast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @forecast }\n end\n end",
"def new\n @forecast = Forecast.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forecast }\n end\n end",
"def show\n @forecast_msize = ForecastMsize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast_msize }\n end\n end",
"def set_forecasting\n @forecasting = Forecasting.find(params[:id])\n end",
"def index\n \n @trends = Trend.order(\"as_of DESC\").limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trends }\n end\n\n end",
"def questions\n @response = self.class.get(\"/data/2.5/forecast\", @options)\n end",
"def update\n respond_to do |format|\n if @sales_forecast.update(sales_forecast_params)\n format.html { redirect_to @sales_forecast, notice: 'Sales forecast was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_forecast }\n else\n format.html { render :edit }\n format.json { render json: @sales_forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @forecast = Forecast.new(params[:forecast])\n\n respond_to do |format|\n if @forecast.save\n format.html { redirect_to @forecast, notice: 'Forecast was successfully created.' }\n format.json { render json: @forecast, status: :created, location: @forecast }\n else\n format.html { render action: \"new\" }\n format.json { render json: @forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n set_stations_initial_scope!\n\n sort_stations_by_given_distance!\n sort_stations_by_given_criteria!\n\n # Pagination:\n paginate_stations!\n\n # Associations 'current_forecasts' and 'last_measurement' are always eager\n # loaded... however, full data will only be included if using the 'include'\n # parameter:\n eager_load_associations!\n\n respond_to do |format|\n format.json { render json: @stations, fields: json_api_params[:fields], include: params[:include] }\n format.jsonapi { render json: @stations, fields: json_api_params[:fields], include: params[:include], key_transform: :dash }\n end\n end",
"def weather_forecast\n city = self.city\n state = self.state\n ForecastFacade.forecast(city, state)\n end",
"def show\n @forecast_wsize = ForecastWsize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast_wsize }\n end\n end",
"def index\n render json: WeatherDatum.all\n end",
"def create\n @forecast = Forecast.new(forecast_params)\n\n respond_to do |format|\n if @forecast.save\n format.html { redirect_to @forecast, notice: 'Forecast was successfully created.' }\n format.json { render :show, status: :created, location: @forecast }\n else\n format.html { render :new }\n format.json { render json: @forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def get_forecast!( params_hash={} )\n \n # Use last known search if no params given.\n params_hash[:location] ||= current_location\n params_hash[:days] ||= current_days\n \n # If it's a new forecast\n if params_hash[:location] != prev_location || params_hash[:days] != prev_days \n \n # Log the changes\n update_attributes( prev_location: current_location, prev_days: current_days, current_location: params_hash[:location], current_days: params_hash[:days] )\n \n end\n \n # Return forecast data\n self.class.get_forecast( params_hash )\n \n end",
"def index\n @service_schedules = ServiceSchedule.all\n\n render json: @service_schedules\n end",
"def series_get_all\n begin\n api = \"#{$config['sonarr']['api_url']}/series\"\n\n url = URI.parse(api)\n\n req = Net::HTTP::Get.new(url.path)\n req.add_field('Content-Type', 'application/json')\n req.add_field('X-Api-Key',$config['sonarr']['api_key'])\n\n res = Net::HTTP.new(url.host, url.port).start do |http|\n http.request(req)\n end\n\n json = JSON.parse(res.body)\n #if json.class.to_s == 'Array'\n # json.each do |row|\n # log_debug (\"#{row['title']}\")\n # end\n #end\n\n rescue => e\n log_debug \"failed #{e}\"\n end\n return json\n end",
"def brief_forecast(latitude, longitude, options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/brief_forecast/#{@api_key}/#{latitude},#{longitude}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200\n end",
"def index\n @weather_events = WeatherEvent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weather_events }\n end\n end",
"def show\n @weather = ForecastIO.forecast(@location.latitude, @location.longitude)\n @current_weather = @weather['currently']\n @forecast = @weather['daily']['data']\n end",
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def city_weather\n self.class.get(\"/data/2.5/forecast\", @options)\n end",
"def index\n @weather_station_alerts = WeatherStationAlert.all\n end",
"def index\n @financials = Financial.search(params, 50)\n end",
"def index\n @fundamental_daily_position_stats = Fundamental::DailyPositionStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_daily_position_stats }\n end\n end",
"def forecast(place)\n # add parenteses if a geoposition is provided\n if place =~ /^(-?\\d+\\.\\d+),\\s?(-?\\d+\\.\\d+)$/\n place = \"(#{place})\"\n end\n\n # make a query to the Yahoo! weather API\n response = @api.yql(\n get_yql_query(place, @options[:items].join(','))\n )\n\n # parse response to a simpler structure and return it\n formatted_response = transform_forecast_object(\n response.parsed_response['query']['results']['channel']\n )\n return formatted_response\n end",
"def index \n local = params[:local]\n \n if (local.to_s.empty?)\n render json: 'Not found', status: 404 \n else\n params = {:query => local, :access_key => \"f613d33c4f74fc5b648685dc3428d345\"}\n conn = Faraday.get(\"http://api.weatherstack.com/current\", params) do |req|\n req.headers['Content-Type'] = 'application/json'\n end\n render json: conn.body \n end\n end",
"def scrape\n\t\turi = URI.parse(@url)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\thttp.use_ssl = false\n\t\t#Make a GET request to the given url\n\t\tresponse = http.send_request('GET', @request_url)\n\t\t# Parse the response body\n\t\tforecast = JSON.parse(response.body)\n\t\tforecast[\"response\"][\"results\"].each do |article|\n\t\t\tif date_valid?(article[\"webPublicationDate\"])\n\t\t\t\tcreate_article(article[\"type\"], article[\"sectionId\"],\n\t\t\t\t\tarticle[\"webTitle\"], article[\"webPublicationDate\"],\n\t\t\t\t\tarticle[\"id\"], article[\"webUrl\"], article[\"apiUrl\"],\n\t\t\t\t\tarticle[\"sectionName\"])\n\t\t\tend\n\t\tend\n\t\t@articles\n\tend",
"def index\n @sales_histories = SalesHistory.all\n end",
"def index\n @search_logs = SearchLog.all\n require \"net/http\"\n require \"json\"\n require \"date\"\n @date = Date.today\n @year = params[:year] || @date.year\n year = @year.to_s \n @month = params[:month] || @date.month\n month = @month.to_s \n @day = params[:day] || @date.day\n dayy = @day.to_s \n @dateString = year + \"-\" + month + \"-\" + dayy \n currentDate = @date.to_s\n @zipCode = params[:q] || 20002\n zipCodeString = @zipCode.to_s\n @url = \"https://www.airnowapi.org/aq/forecast/zipCode/?format=application/json&zipCode=\"+ zipCodeString +\"&date=\"+ @dateString +\"&distance=25&API_KEY=E4115853-8D5F-498D-9233-69D2B8C7B6FC\"\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @output = JSON.parse(@response)\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financials }\n end\n end",
"def regional_forecast(location_id)\n query(\"txt/wxfcs/regionalforecast/json/#{location_id}\")\n end",
"def index\n @series = Serie.all\n end",
"def index\n @holidays = Holiday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holidays }\n end\n end",
"def index\n @tv_series = TvSerie.all\n end",
"def index\n json_response(Spot.all)\n end",
"def index\n weather_details\n @monthly_cashflow = MonthlyCashflow.new\n @monthly_cashflows = MonthlyCashflow.paginate(page: params[:page],per_page: 10)\n end",
"def index\n @pre_sales = PreSale.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pre_sales }\n end\n end",
"def destroy\n @sales_forecast.destroy\n respond_to do |format|\n format.html { redirect_to sales_forecasts_url, notice: 'Sales forecast was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @sales_productivities = SalesProductivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_productivities }\n end\n end",
"def forecast(city:, days: 3)\n result = api_call(path: '/data/2.5/forecast/daily', query: { q: city, cnt: days, units: 'metric' })\n days = result['list'].map.with_index do |day, i|\n { cloud_cover: day['clouds'],\n condition: day.dig('weather', 0, 'description').titleize,\n date: i.days.from_now.utc.to_date,\n humidity: day['humidity'],\n icon_url: icon_url(icon_id: day.dig('weather', 0, 'icon')),\n pressure: day['pressure'],\n rain: day['rain'],\n snow: day['snow'],\n temp_max: day.dig('temp', 'max'),\n temp_min: day.dig('temp', 'min'),\n wind_deg: day['deg'],\n wind_speed: wind_speed_in_kmh(day['speed']) }\n end\n { city: result.dig('city', 'name'),\n country_code: result.dig('city', 'country'),\n days: days }\n end",
"def forecast\n deck = data.decks.first\n Statistics.forecast(deck: deck.deck)\n end",
"def update_from_darksky(historical_dates=[Date.today-1], forecast=true)\n darksky_secret = ApiKey.where(:service => 'Darksky').first.key\n hydra = Typhoeus::Hydra.new\n requests = Hash.new\n forecast_request = nil\n\n logger.debug(\"Updating Station #{name} for dates: #{historical_dates}\")\n \n # Construct the HTTP requests to Darksky: one for each of the past days we care about, and one for today to get the forecast\n historical_dates.each do |d|\n endpoint = \"https://api.darksky.net/forecast/#{darksky_secret}/#{self.latitude},#{self.longitude},#{d.to_time.to_i}\"\n request = Typhoeus::Request.new(endpoint) \n hydra.queue(request)\n requests[d] = request\n end\n forecast_request = Typhoeus::Request.new(\"https://api.darksky.net/forecast/#{darksky_secret}/#{self.latitude},#{self.longitude}\")\n hydra.queue(forecast_request) if forecast\n\n # Run the whole lot of them!\n hydra.run\n\n # Parse out the observed precipitation from the historical queries\n reports = []\n requests.each_pair do |d, request|\n if request.response.timed_out?\n logger.error \"Request to Darksky timed out: #{request}\"\n next\n end\n if request.response.nil?\n logger.error \"No response from Darksky for request #{request}\"\n next\n end\n if request.response.code != 200\n logger.error \"Unable to fetch weather data from #{request.base_url}: #{request.response.code} #{request.response.status_message}\"\n next\n end\n\n # With error trapping done, let's parse the body and update the db with the report data.\n data = JSON.load(request.response.body)\n data['daily']['data'].each do |report|\n logger.debug(report)\n d = Time.at(report['time']).to_date\n datestamp = \"#{d.year}#{d.month.to_s.rjust(2,'0')}#{d.day.to_s.rjust(2,'0')}\"\n logger.debug(\"Using timestamp #{datestamp}\")\n # We want to update an existing row in place if we've previously computed one\n r = weather_reports.find_or_create_by(\n :latitude => self.latitude,\n :longitude => self.longitude,\n :date => datestamp,\n )\n \n \n # TODO: multiply by the actual number of hours in the time period.\n precip = report['precipIntensity'] # This is in inches per hour\n logger.debug(\"Extracted precipitation report: #{precip} from report #{report}\")\n r.precip = precip * 24.0\n logger.debug(\"Constructed WeatherReport: #{r}\")\n logger.debug(\"Coordinates: #{r.latitude},#{r.longitude}\")\n logger.debug(\"Datestamp: #{r.date}\")\n logger.debug(\"Recorded Precip: #{r.precip}\")\n \n r.save\n reports.push(r)\n end\n end\n\n # Add the forecast data as well\n forecasts = []\n if forecast\n logger.info(\"Parsing forecasts for station #{self}\")\n logger.debug(\"Got response: #{forecast_request.response}\")\n if forecast_request.response.timed_out?\n logger.error \"Request to Darksky timed out: #{forecast_request}\"\n return\n end\n if forecast_request.response.nil?\n logger.error \"No response from Darksky for request #{forecast_request}\"\n return\n end\n if forecast_request.response.code != 200\n logger.error \"Unable to fetch weather data from #{forecast_request.base_url}: #{forecast_request.response.code} #{forecast_request.response.message}\"\n return\n end\n\n logger.debug(\"Successful response from Darksky\")\n data = JSON.load(forecast_request.response.body)\n data['daily']['data'].each do |report|\n logger.debug(report)\n d = Time.at(report['time']).to_date\n datestamp = \"#{d.year}#{d.month.to_s.rjust(2,'0')}#{d.day.to_s.rjust(2,'0')}\"\n r = weather_reports.find_or_create_by(\n :latitude => self.latitude,\n :longitude => self.longitude,\n :date => datestamp,\n )\n r.precip = report['precipIntensity'] * 24.0 # The Darksky report gives us inches per hour\n\n logger.debug(\"Created forecast object: #{r}\")\n r.save\n forecasts.push(r)\n end\n end\n\n # TODO: add a column that we can record when this update was last run, for display on the webpage.\n {:reports => reports, :forecasts => forecasts}\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def monthIndex\n render json: Restaurant.restaurantsMonth\n end",
"def index\n @limit = params[:limit] || DEFAULT_MAX_RECORDS\n @offset = params[:offset] || 0\n @weather_measures = WeatherMeasure.all.order('created_at desc').limit(@limit).offset(@offset)\n @temperature_chart_data = @weather_measures.pluck(:created_at, :temperature).to_h \n @all_records_count = WeatherMeasure.all.count\n end",
"def index\n @series = Series.all\n end",
"def index\n @series = Series.all\n end",
"def index\n @series = Series.all\n end",
"def show\n @monthly_finance = MonthlyFinance.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_finance }\n end\n end",
"def index\n @sales_entries = SalesEntry.all\n end",
"def index\n render json: {seasons: @serial.seasons, series: @serial}\n end",
"def index\n @satellites = Satellite.all\n @sat_json = Satellite.includes(:barrels).map { |sat| sat.as_json.merge({barrels: sat.barrels.as_json}) }\n end",
"def index\n @live_stream_series = LiveStreamSeries.all\n respond_with(@live_stream_series)\n end",
"def getSeas()\n puts \" getting sea forecasts\"\n html = Net::HTTP.get(UrlHost, \"#{UrlPath}/#{@uri}\")\n \n #------------------------------------------------------------------\n # extract the juicy center\n #------------------------------------------------------------------\n prePattern = %r{<PRE>(.*)</PRE>}m\n match = prePattern.match(html)\n if (!match)\n @seas = \"<p>Unable to parse sea forecast.</p>\"\n return\n end\n \n html = match[1]\n \n #------------------------------------------------------------------\n # split the file at bolded terms; this will give us header/body/header/...\n #------------------------------------------------------------------\n sections = html.split(%r{<B>|</B>})\n\n #------------------------------------------------------------------\n # remove all the initial sections until we have a known header\n #------------------------------------------------------------------\n firstPattern = %r{<FONT .* COLOR=\"#800000\">}\n while (!firstPattern.match(sections.first))\n sections.shift\n end\n\n #------------------------------------------------------------------\n # now build the table, one row per 'day'\n #------------------------------------------------------------------\n html = \"\\n<table>\\n\"\n while (!sections.empty?)\n header, body, *sections = sections\n\n header.gsub!(%r{<.*?>},'')\n\n header = header.downcase.strip\n body = body.downcase.strip\n body = getWaveInfo(body)\n\n header = header.gsub(\" \",\" \")\n \n next if header.include?(\"night\")\n\n html += \"<tr><td><b>#{header}</b></td><td> </td><td>#{body}</tr>\\n\"\n end\n \n @seas = \"#{html}</table>\\n\"\n end",
"def show\n @sales_datum = SalesDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sales_datum }\n end\n end",
"def index\n render json: @fiestas\n end",
"def days\n @trainings = Training.all\n @activities = Activity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trainings }\n end\n end",
"def show\n @station = Station.where(number:@forecast.station_number).last\n end",
"def index\n @cal_month_sales = CalMonthSale.paginate(page: params[:page])\n end",
"def index\n @facility_totals = FacilityTotal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facility_totals }\n end\n end",
"def index\n @time_series = TimeSeries.meta_only.by_owner(@owner.id, current_user.id).sorted\n\n @css.push(\"time_series.css\")\n @js.push(\"search.js\")\n\n set_gon_datatables\n\n respond_to do |format|\n format.html\n format.json { render json: @time_series }\n end\n end",
"def fetch_six_day_forecast_at lat, lon\n app_id = Rails.application.credentials.open_weather_key\n todays_weather_response = Faraday.get(\"http://api.openweathermap.org/data/2.5/weather?units=imperial&lat=#{lat}&lon=#{lon}&appid=#{app_id}\")\n five_day_forecast_response = Faraday.get(\"http://api.openweathermap.org/data/2.5/forecast?units=imperial&lat=#{lat}&lon=#{lon}&appid=#{app_id}\")\n todays_weather = JSON.parse(todays_weather_response.body)\n five_day_forecast = JSON.parse(five_day_forecast_response.body)\n\n # This is the serialized version being sent to the client. It only contains relevant information. Just the location followed by the six-day forecast\n six_day_forecast_serialized = {\n :location => \"#{todays_weather[\"name\"]}, #{todays_weather[\"sys\"][\"country\"]}\",\n :forecast => [\n todays_weather[\"main\"][\"temp\"]\n ]\n }\n\n # Used to shift all frame of time to correct offset. Could not find any built-in methods to set a fixed offset.\n utc_offset = five_day_forecast[\"city\"][\"timezone\"]\n\n # Find the current day (tomorrow) and the day after relative to the client\n current_day = (Time.zone.now + utc_offset).beginning_of_day.tomorrow\n next_day = current_day.tomorrow\n\n # Set the loop up with the first measurement\n highest_high = nil\n\n # Create index for moving days\n day_index = 1\n\n five_day_forecast[\"list\"].each do |forecast|\n # Find current time by UTC and then offset with given offset to make sure the day ranges are correct to capture the correct high's regardless of timezone\n current_time = Time.zone.at(forecast[\"dt\"]+utc_offset)\n temp = forecast[\"main\"][\"temp\"]\n\n if (current_time >= current_day) and (current_time < next_day)\n if (!highest_high) or (temp > highest_high)\n six_day_forecast_serialized[:forecast][day_index] = temp \n highest_high = temp\n end\n elsif current_time >= next_day\n highest_high = temp\n day_index += 1\n six_day_forecast_serialized[:forecast][day_index] = temp \n current_day = current_day.tomorrow\n next_day = current_day.tomorrow\n end\n\n end\n\n six_day_forecast_serialized\n end",
"def darksky_response\n connect_darksky.get(\"/forecast/#{ENV[\"DARK_SKY_API_KEY\"]}/#{@lat},#{@lng}\")\n end",
"def index\n @finances = Finance.all\n end",
"def index\n @timecharts = Timechart.find(:all, order: \"stop_time DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timecharts }\n end\n end",
"def index\n begin\n start_time, end_time = get_start_time_and_end_time(params)\n longitude, latitude = get_longitude_and_latitude(params)\n fields = get_fields(params)\n if longitude and latitude\n q = WeatherLog.nearby(100, longitude, latitude)\n else\n q = WeatherLog.all\n end\n if start_time and end_time\n q = q.where(datetime: start_time..end_time)\n elsif start_time\n q = q.where(\"datetime >= ?\", start_time)\n elsif end_time\n q = q.where(\"datetime <= ?\", end_time)\n end\n\n @weather_logs = q.order(datetime: :asc).limit(2000)\n\n respond_to do |format|\n if fields\n format.json { render json: @weather_logs.as_json(only: fields)}\n else\n format.json { render json: @weather_logs.as_json(only: get_all_valid_fields)}\n end\n end\n rescue Exception => e\n respond_to do |format|\n format.json { render json: {status: \"Invalid Request #{e}\"} }\n end\n end\n end",
"def index\n if params[:q]\n url = \"http://api.worldweatheronline.com/premium/v1/tz.ashx?q=#{params[:q]}&format=json&key=2c46659bd90a41a0bcf132257162410\"\n @json = ActiveSupport::JSON.decode(open(url).read)\n else\n end\n end"
] |
[
"0.73036915",
"0.70815754",
"0.6934468",
"0.6887057",
"0.68293744",
"0.6797613",
"0.6792443",
"0.67614305",
"0.67052513",
"0.65584093",
"0.65034044",
"0.6501869",
"0.6458968",
"0.6439238",
"0.6426273",
"0.64123774",
"0.63653815",
"0.63632905",
"0.62917185",
"0.6263929",
"0.62511873",
"0.6234113",
"0.6222032",
"0.6215074",
"0.61923283",
"0.6165849",
"0.61650604",
"0.6155445",
"0.6150852",
"0.61249685",
"0.61249685",
"0.61227745",
"0.6117385",
"0.6102394",
"0.60567164",
"0.60257834",
"0.5997844",
"0.59835386",
"0.5932495",
"0.5921697",
"0.59131336",
"0.58861005",
"0.5876316",
"0.58561444",
"0.58528996",
"0.58193713",
"0.5801992",
"0.5797769",
"0.5791839",
"0.5772453",
"0.5749639",
"0.57488436",
"0.57472646",
"0.5732619",
"0.5726305",
"0.5725716",
"0.5723197",
"0.57220024",
"0.5719642",
"0.57050157",
"0.5693274",
"0.56875926",
"0.5686911",
"0.56849384",
"0.56776315",
"0.5668035",
"0.56498045",
"0.56441635",
"0.56367826",
"0.5633519",
"0.5631874",
"0.5623407",
"0.5608663",
"0.5598073",
"0.5595576",
"0.55799437",
"0.5566511",
"0.5560618",
"0.5560204",
"0.5560204",
"0.5560204",
"0.5558769",
"0.55583787",
"0.55507964",
"0.5549157",
"0.55405563",
"0.5533554",
"0.55308557",
"0.55168265",
"0.5504208",
"0.5502438",
"0.5499806",
"0.54990816",
"0.5497816",
"0.5493515",
"0.5493261",
"0.5486516",
"0.54856825",
"0.54737335",
"0.5472486"
] |
0.6081482
|
34
|
GET /sales_forecasts/1 GET /sales_forecasts/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @forecast_72s = Forecast72.all\n end",
"def show\n @forecast = Forecast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast }\n end\n end",
"def forecast(forecast_path)\r\n response = Curl.get(forecast_path) do |curl|\r\n curl.headers['Accept'] = 'application/json'\r\n end\r\n JSON.parse(response.body_str)\r\n end",
"def forecast(query)\n get_json(\"#{api_url}/forecast/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def set_sales_forecast\n @sales_forecast = SalesForecast.find(params[:id])\n end",
"def forecast\n render json: @current_user.forecast\n end",
"def index\n @forecasts = @user.forecasts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @forecasts }\n end\n end",
"def index\n @forecast_msizes = ForecastMsize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forecast_msizes }\n end\n end",
"def index\n @forecast_wsizes = ForecastWsize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forecast_wsizes }\n end\n end",
"def forecast(latitude, longitude, options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/forecast/#{@api_key}/#{latitude},#{longitude}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200\n end",
"def index\n @forecasts = Forecast.all\n @days = @forecasts.order(\"created_at desc\").pluck(:date).uniq\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end",
"def get_forecast_data\n result = RestClient.get(request_url)\n @xml = REXML::Document.new(result)\n end",
"def create\n @sales_forecast = SalesForecast.new(sales_forecast_params)\n\n respond_to do |format|\n if @sales_forecast.save\n format.html { redirect_to @sales_forecast, notice: 'Sales forecast was successfully created.' }\n format.json { render :show, status: :created, location: @sales_forecast }\n else\n format.html { render :new }\n format.json { render json: @sales_forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @expence_forecasts = ExpenceForecast.all\n end",
"def show\n @forecast_msize = ForecastMsize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast_msize }\n end\n end",
"def get_forecast\n @forecast = ForecastIO.forecast( lat, lng )\n end",
"def show\n @forecast = Forecast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @forecast }\n end\n end",
"def get_surf_data\n url = \"http://magicseaweed.com/api/#{ENV['MAGIC_SEAWEED_API_KEY']}/forecast/?spot_id=6128&units=UK\"\n uri = URI(url)\n\n response = Net::HTTP.get(uri)\n ActiveSupport::JSON.decode(response) if response != ''\n end",
"def set_forecast\n @forecast = Forecast.find(params[:id])\n end",
"def set_forecast\n @forecast = Forecast.find(params[:id])\n end",
"def new\n @forecast = Forecast.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forecast }\n end\n end",
"def weather\n # empty array dates is still fine, not a reason for 400 (happens for venues without courts)\n render json: {} and return if params.dig(:dates).blank?\n\n forecast = WeatherForecaster.call(venue, [*params.require(:dates)])\n json = forecast.transform_values do |value|\n value ? value.slice(*%w(icon temperature)) : nil\n end\n render json: json\n end",
"def forecast_array\n @forecast ||= HTTParty.get(\"http://api.openweathermap.org/data/2.5/forecast/daily?q=Seattle&cnt=3&units=imperial&mode=json\").parsed_response[\"list\"]\n end",
"def extended_forecast(query)\n get_json(\"#{api_url}/forecast10day/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def set_forecasting\n @forecasting = Forecasting.find(params[:id])\n end",
"def show\n @forecast_wsize = ForecastWsize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast_wsize }\n end\n end",
"def index\n @monthly_finances = MonthlyFinance.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @monthly_finances }\n # end\n end",
"def index\n @day_forecasts = DayForecast.where(\"forecast_datetime >= ?\", Time.current.beginning_of_day)\n @half_forecasts = HalfForecast.where(point_date: Config.last.half_forecast_point_date)\n end",
"def index\n @forecast_hours = ForecastHour.all\n end",
"def index\n\n require 'net/http'\n require 'json'\n\n @measures = Measure.all.order(\"created_at DESC\")\n weatherData\n\n end",
"def index\n @weather_station = WeatherStation.find(params[:weather_station_id])\n @meteo_data = []\n @meteo_data = @weather_station.meteo_datums.order('created_at desc').limit(100) unless @weather_station.blank?\n\n render 'api/v1/meteo_data/index', params: [@weather_station, @meteo_data]\n end",
"def forecast(loc)\n\n url = \"#{@base_url}/#{FORECAST_QUERY}/q/#{loc[0]},#{loc[1]}.json\" \n\n result = JSON.parse(open(url).read)\n\n return nil if result['response']['error'] \n return nil unless result['current_observation']\n\n obs = result['current_observation']\n loc = result['current_observation']['observation_location']\n fc = result['forecast']['simpleforecast']\n\n # puts 'Fetching for ' + obs['station_id']\n \n weather = WeatherStation.find_or_create_by_station_id(obs['station_id'])\n\n location = ObservationLocation.new\n\n location.full = loc['full']\n location.city = loc['city']\n location.state = loc['state']\n location.country = loc['country']\n location.country_iso3166 = loc['country_iso3166']\n location.loc = [loc['latitude'].to_f,loc['longitude'].to_f]\n location.elevation = loc['elevation']\n \n weather.observation_location = location\n\n weather.forecasts.clear\n\n fc['forecastday'].each do |f|\n\n forecast = Forecast.new\n\n date = DateTime.strptime(f['date']['epoch'].to_s,'%s')\n\n forecast.date = date\n forecast.conditions = f['conditions']\n forecast.pop = f['pop']\n forecast.high_c = f['high']['celsius']\n forecast.high_f = f['high']['fahrenheit']\n forecast.low_c = f['low']['celsius']\n forecast.low_f = f['low']['fahrenheit']\n\n forecast.qpf_day_mm = f['qpf_day']['mm']\n forecast.qpf_day_in = f['qpf_day']['in']\n forecast.qpf_allday_mm = f['qpf_allday']['mm']\n forecast.qpf_allday_in = f['qpf_allday']['in']\n forecast.qpf_night_mm = f['qpf_night']['mm']\n forecast.qpf_night_in = f['qpf_night']['in']\n\n forecast.snow_day_mm = f['snow_day']['mm']\n forecast.snow_day_in = f['snow_day']['in']\n forecast.snow_allday_mm = f['snow_allday']['mm']\n forecast.snow_allday_in = f['snow_allday']['in']\n forecast.snow_night_mm = f['snow_night']['mm']\n forecast.snow_night_in = f['snow_night']['in']\n\n forecast.wind_max_kph = f['maxwind']['kph'] \n forecast.wind_max_mph = f['maxwind']['mph'] \n forecast.wind_max_dir = f['maxwind']['dir'] \n forecast.wind_max_degrees = f['maxwind']['degrees'] \n\n forecast.wind_ave_kph = f['avewind']['kph'] \n forecast.wind_ave_mph = f['avewind']['mph'] \n forecast.wind_ave_dir = f['avewind']['dir'] \n forecast.wind_ave_degrees = f['avewind']['degrees'] \n\n forecast.humidity_ave = f['avehumidity']\n forecast.humidity_min = f['minhumidity']\n forecast.humidity_max = f['maxhumidity']\n\n weather.forecasts << forecast\n\n end\n\n weather.observation_time_rfc822 = obs['observation_time_rfc822']\n weather.local_time_rfc822 = obs['local_time_rfc822']\n weather.weather = obs['weather']\n weather.temp_f = obs['temp_f']\n weather.temp_c = obs['temp_c']\n weather.relative_humidity = obs['relative_humidity']\n weather.precip_today_metric = obs['precip_today_metric']\n\n return weather\n\n end",
"def index\n @dji_forecasts = DjiForecast.all.order(\"created_at desc\").paginate(:page => params[:page], :per_page => 15)\n end",
"def index\n @sales = @saleService.all_to_json().as_json;\n end",
"def index\n @sales = Sale.all\n\n render json: @sales\n end",
"def update\n respond_to do |format|\n if @sales_forecast.update(sales_forecast_params)\n format.html { redirect_to @sales_forecast, notice: 'Sales forecast was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_forecast }\n else\n format.html { render :edit }\n format.json { render json: @sales_forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def salesApi\n require 'uri'\n require 'net/http'\n require 'json'\n\n #Arrays for each category\n \n @frequency = Hash.new(0)\n\n url = URI(\"https://api.salesloft.com/v2/people.json\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n request[\"Authorization\"] = 'Bearer ' + ENV[\"API_KEY\"]\n\n response = http.request(request)\n \n @body = JSON.parse(response.body)['data']\n return @body\n end",
"def create\n @forecast = Forecast.new(params[:forecast])\n\n respond_to do |format|\n if @forecast.save\n format.html { redirect_to @forecast, notice: 'Forecast was successfully created.' }\n format.json { render json: @forecast, status: :created, location: @forecast }\n else\n format.html { render action: \"new\" }\n format.json { render json: @forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n \n @trends = Trend.order(\"as_of DESC\").limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trends }\n end\n\n end",
"def get_forecast!( params_hash={} )\n \n # Use last known search if no params given.\n params_hash[:location] ||= current_location\n params_hash[:days] ||= current_days\n \n # If it's a new forecast\n if params_hash[:location] != prev_location || params_hash[:days] != prev_days \n \n # Log the changes\n update_attributes( prev_location: current_location, prev_days: current_days, current_location: params_hash[:location], current_days: params_hash[:days] )\n \n end\n \n # Return forecast data\n self.class.get_forecast( params_hash )\n \n end",
"def weather_forecast\n city = self.city\n state = self.state\n ForecastFacade.forecast(city, state)\n end",
"def create\n @forecast = Forecast.new(forecast_params)\n\n respond_to do |format|\n if @forecast.save\n format.html { redirect_to @forecast, notice: 'Forecast was successfully created.' }\n format.json { render :show, status: :created, location: @forecast }\n else\n format.html { render :new }\n format.json { render json: @forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def questions\n @response = self.class.get(\"/data/2.5/forecast\", @options)\n end",
"def show\n @weather = ForecastIO.forecast(@location.latitude, @location.longitude)\n @current_weather = @weather['currently']\n @forecast = @weather['daily']['data']\n end",
"def index\n render json: WeatherDatum.all\n end",
"def city_weather\n self.class.get(\"/data/2.5/forecast\", @options)\n end",
"def show\n @station = Station.where(number:@forecast.station_number).last\n end",
"def brief_forecast(latitude, longitude, options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/brief_forecast/#{@api_key}/#{latitude},#{longitude}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200\n end",
"def index\n set_stations_initial_scope!\n\n sort_stations_by_given_distance!\n sort_stations_by_given_criteria!\n\n # Pagination:\n paginate_stations!\n\n # Associations 'current_forecasts' and 'last_measurement' are always eager\n # loaded... however, full data will only be included if using the 'include'\n # parameter:\n eager_load_associations!\n\n respond_to do |format|\n format.json { render json: @stations, fields: json_api_params[:fields], include: params[:include] }\n format.jsonapi { render json: @stations, fields: json_api_params[:fields], include: params[:include], key_transform: :dash }\n end\n end",
"def index \n local = params[:local]\n \n if (local.to_s.empty?)\n render json: 'Not found', status: 404 \n else\n params = {:query => local, :access_key => \"f613d33c4f74fc5b648685dc3428d345\"}\n conn = Faraday.get(\"http://api.weatherstack.com/current\", params) do |req|\n req.headers['Content-Type'] = 'application/json'\n end\n render json: conn.body \n end\n end",
"def show\n @sales_datum = SalesDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sales_datum }\n end\n end",
"def show\n @monthly_finance = MonthlyFinance.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_finance }\n end\n end",
"def series_get_all\n begin\n api = \"#{$config['sonarr']['api_url']}/series\"\n\n url = URI.parse(api)\n\n req = Net::HTTP::Get.new(url.path)\n req.add_field('Content-Type', 'application/json')\n req.add_field('X-Api-Key',$config['sonarr']['api_key'])\n\n res = Net::HTTP.new(url.host, url.port).start do |http|\n http.request(req)\n end\n\n json = JSON.parse(res.body)\n #if json.class.to_s == 'Array'\n # json.each do |row|\n # log_debug (\"#{row['title']}\")\n # end\n #end\n\n rescue => e\n log_debug \"failed #{e}\"\n end\n return json\n end",
"def index\n @search_logs = SearchLog.all\n require \"net/http\"\n require \"json\"\n require \"date\"\n @date = Date.today\n @year = params[:year] || @date.year\n year = @year.to_s \n @month = params[:month] || @date.month\n month = @month.to_s \n @day = params[:day] || @date.day\n dayy = @day.to_s \n @dateString = year + \"-\" + month + \"-\" + dayy \n currentDate = @date.to_s\n @zipCode = params[:q] || 20002\n zipCodeString = @zipCode.to_s\n @url = \"https://www.airnowapi.org/aq/forecast/zipCode/?format=application/json&zipCode=\"+ zipCodeString +\"&date=\"+ @dateString +\"&distance=25&API_KEY=E4115853-8D5F-498D-9233-69D2B8C7B6FC\"\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @output = JSON.parse(@response)\n end",
"def index\n @weather_events = WeatherEvent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weather_events }\n end\n end",
"def index\n @service_schedules = ServiceSchedule.all\n\n render json: @service_schedules\n end",
"def set_forecast_72\n @forecast_72 = Forecast72.find(params[:id])\n end",
"def index\n per_page = 50\n \n @service_centers = ServiceCenter.all\n @show_all = params[:show_all]\n @sc = params[:sc]\n @status = params[:status]\n @segment = params[:segment]\n \n @sales_forecasts = select_sales_forecasts_with_sorting\n \n @paginated_sales_forecasts = paginate(@sales_forecasts, per_page)\n end",
"def forecasts\n convertions = [[:date, :to_date], [:low, :to_i], [:high, :to_i], [:code, :to_i], :day, :text]\n item_attribute('yweather:forecast').collect do |forecast|\n translate! do_convertions(forecast, *convertions)\n end\n end",
"def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @series }\n end\n end",
"def regional_forecast(location_id)\n query(\"txt/wxfcs/regionalforecast/json/#{location_id}\")\n end",
"def index\n @fundamental_daily_position_stats = Fundamental::DailyPositionStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_daily_position_stats }\n end\n end",
"def monthIndex\n render json: Restaurant.restaurantsMonth\n end",
"def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @series }\n end\n end",
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def index\n json_response(Spot.all)\n end",
"def forecast(place)\n # add parenteses if a geoposition is provided\n if place =~ /^(-?\\d+\\.\\d+),\\s?(-?\\d+\\.\\d+)$/\n place = \"(#{place})\"\n end\n\n # make a query to the Yahoo! weather API\n response = @api.yql(\n get_yql_query(place, @options[:items].join(','))\n )\n\n # parse response to a simpler structure and return it\n formatted_response = transform_forecast_object(\n response.parsed_response['query']['results']['channel']\n )\n return formatted_response\n end",
"def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @series }\n end\n end",
"def daily_forecast(location)\n id = location_id[location.downcase.to_sym]\n puts id\n# Maybe call it weather_update to call at 00:01 every day, needs to iterate over each location\n url = \"http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/#{id}?res=3hourly&key=0da4e1ea-8681-47bc-a5f9-5ab535ff75f2\"\n resp = Net::HTTP.get_response(URI.parse(url))\n data = resp.body\n result = JSON.parse(data)\n tomorrow = result[\"SiteRep\"][\"DV\"][\"Location\"][\"Period\"][1][\"Rep\"]\n\n @temp_tomorrow=[]\n tomorrow.each do |f|\n @temp_tomorrow << f[\"F\"].to_i\n end\n @cloud_tomorrow=[]\n tomorrow.each do |f|\n @cloud_tomorrow << f[\"V\"].to_i\n end\n @rain_tomorrow=[]\n tomorrow.each do |f|\n @rain_tomorrow << f[\"Pp\"].to_i\n end\n @wind_tomorrow=[]\n tomorrow.each do |f|\n @wind_tomorrow << f[\"S\"].to_i\n end\n\n tomorrow = WeatherData.new \n tomorrow.date = [Date.today.next_day.year, Date.today.next_day.month, Date.today.next_day.day]\n tomorrow.location = location\n tomorrow.temperature = @temp_tomorrow\n tomorrow.rainfall = @rain_tomorrow\n tomorrow.wind = @wind_tomorrow\n tomorrow.cloud = @cloud_tomorrow\n tomorrow.save\nend",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financials }\n end\n end",
"def index\n @series = Serie.all\n end",
"def forecast\n deck = data.decks.first\n Statistics.forecast(deck: deck.deck)\n end",
"def series_get(id)\n begin\n api = \"#{$config['sonarr']['api_url']}/series/#{id}\"\n log_debug(api)\n uri = URI(api)\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json', 'X-Api-Key'=> $config['sonarr']['api_key'])\n \n json = {}\n json['id'] = id\n \n req.body = json.to_json\n res = http.request(req) \n json = JSON.parse(res.body)\n debug json\n rescue => e\n puts \"failed #{e}\"\n end\n end",
"def index\n @sales_productivities = SalesProductivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_productivities }\n end\n end",
"def getWeatherData\n @tempModel = Temp\n current_date = Date.today.strftime \"%Y-%m-%d\"\n \n response = RestClient.get(\"http://api.worldweatheronline.com/premium/v1/past-weather.ashx?key=#{ENV['WEATHER_API_KEY']}&q=30.404251,-97.849442&date=2020-06-05&enddate=#{current_date}&format=json\n \", headers={})\n jsonified_response = JSON.parse(response)\n \n # API response is parsed and inserted into DB by the model method postWeatherData\n @tempModel.postWeatherData(jsonified_response);\n puts current_date\n end",
"def destroy\n @sales_forecast.destroy\n respond_to do |format|\n format.html { redirect_to sales_forecasts_url, notice: 'Sales forecast was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @tv_series = TvSerie.all\n end",
"def index\n @holidays = Holiday.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holidays }\n end\n end",
"def getDate\n @sales = Sale.where(\"date = ?\", params[:date])\n render json: @sales\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def new\n @forecast_msize = ForecastMsize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forecast_msize }\n end\n end",
"def index\n weather_details\n @monthly_cashflow = MonthlyCashflow.new\n @monthly_cashflows = MonthlyCashflow.paginate(page: params[:page],per_page: 10)\n end",
"def destroy\n @forecast = Forecast.find(params[:id])\n @forecast.destroy\n\n respond_to do |format|\n format.html { redirect_to forecasts_url }\n format.json { head :ok }\n end\n end",
"def index\n @weather_station_alerts = WeatherStationAlert.all\n end",
"def set_forecast_snapshot\n @forecast_snapshot = ForecastSnapshot.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @forecast.update(forecast_params)\n format.html { redirect_to @forecast, notice: 'Forecast was successfully updated.' }\n format.json { render :show, status: :ok, location: @forecast }\n else\n format.html { render :edit }\n format.json { render json: @forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pre_sales = PreSale.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pre_sales }\n end\n end",
"def index\n @sales_histories = SalesHistory.all\n end",
"def show\n @daily_statistic = DailyStatistic.find(params[:id])\n\n render json: @daily_statistic\n end",
"def show\n @sale_day_total = SaleDayTotal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale_day_total }\n end\n end",
"def index\n @limit = params[:limit] || DEFAULT_MAX_RECORDS\n @offset = params[:offset] || 0\n @weather_measures = WeatherMeasure.all.order('created_at desc').limit(@limit).offset(@offset)\n @temperature_chart_data = @weather_measures.pluck(:created_at, :temperature).to_h \n @all_records_count = WeatherMeasure.all.count\n end",
"def dayIndex\n render json: Restaurant.restaurantsDay\n end",
"def index\n render json: @fiestas\n end",
"def overcastForecast \n \"overcastForecast\" \n end",
"def show\n @travel_chart = Travel::Chart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @travel_chart }\n end\n end",
"def new\n @forecast_wsize = ForecastWsize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forecast_wsize }\n end\n end",
"def daily_forecast(info)\n info[\"weather\"][0][\"description\"]\nend",
"def index\n @series = Series.all\n end",
"def index\n @series = Series.all\n end",
"def index\n @series = Series.all\n end"
] |
[
"0.72837394",
"0.7225123",
"0.7150389",
"0.69626546",
"0.69625044",
"0.68532974",
"0.68259215",
"0.68130034",
"0.66121113",
"0.6598987",
"0.65316457",
"0.65174276",
"0.6485646",
"0.6440357",
"0.6437726",
"0.64332515",
"0.64253724",
"0.6419338",
"0.6409399",
"0.6409399",
"0.6402763",
"0.63803476",
"0.63384044",
"0.6331457",
"0.6295161",
"0.6261179",
"0.6261089",
"0.6239452",
"0.62293845",
"0.62181205",
"0.6209024",
"0.6205391",
"0.61717933",
"0.6169286",
"0.6096508",
"0.60947967",
"0.6047938",
"0.6037991",
"0.6013294",
"0.59652144",
"0.5964099",
"0.5950992",
"0.5920407",
"0.59191245",
"0.5905123",
"0.58995926",
"0.58820575",
"0.58734953",
"0.5854315",
"0.5853632",
"0.58260036",
"0.5821793",
"0.5820966",
"0.5810945",
"0.5804341",
"0.5785999",
"0.57819945",
"0.57814896",
"0.57744133",
"0.57672596",
"0.57426953",
"0.5739876",
"0.5732019",
"0.5726253",
"0.5715426",
"0.57111186",
"0.5703743",
"0.56947166",
"0.56935924",
"0.56926864",
"0.569194",
"0.5685147",
"0.5681762",
"0.567638",
"0.5666196",
"0.5663338",
"0.56522083",
"0.5649251",
"0.5641342",
"0.563298",
"0.56297934",
"0.56280637",
"0.5625961",
"0.56214374",
"0.5621298",
"0.56121457",
"0.5608771",
"0.560721",
"0.5601632",
"0.5591027",
"0.55801314",
"0.557161",
"0.5568694",
"0.5564329",
"0.5563535",
"0.5555977",
"0.55505145",
"0.55458915",
"0.5544765",
"0.5544765",
"0.5544765"
] |
0.0
|
-1
|
POST /sales_forecasts POST /sales_forecasts.json
|
def create
@sales_forecast = SalesForecast.new(sales_forecast_params)
respond_to do |format|
if @sales_forecast.save
format.html { redirect_to @sales_forecast, notice: 'Sales forecast was successfully created.' }
format.json { render :show, status: :created, location: @sales_forecast }
else
format.html { render :new }
format.json { render json: @sales_forecast.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @forecast = Forecast.new(params[:forecast])\n\n respond_to do |format|\n if @forecast.save\n format.html { redirect_to @forecast, notice: 'Forecast was successfully created.' }\n format.json { render json: @forecast, status: :created, location: @forecast }\n else\n format.html { render action: \"new\" }\n format.json { render json: @forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @forecast = Forecast.new(forecast_params)\n\n respond_to do |format|\n if @forecast.save\n format.html { redirect_to @forecast, notice: 'Forecast was successfully created.' }\n format.json { render :show, status: :created, location: @forecast }\n else\n format.html { render :new }\n format.json { render json: @forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sales_forecast\n @sales_forecast = SalesForecast.find(params[:id])\n end",
"def sales_forecast_params\n params.require(:sales_forecast).permit(:service_center_id, :segment_id, :status_id, :area_id, :company, :division, :customer_name, :instrument, :price, :budget_id, :certainty_id, :reporting_date, :fixed_date, :order_date, :agent, :condition_text, :person_in_charge, :visible)\n end",
"def create\n @expence_forecast = ExpenceForecast.new(expence_forecast_params)\n\n respond_to do |format|\n if @expence_forecast.save\n format.html { redirect_to @expence_forecast, notice: 'Expence forecast was successfully created.' }\n format.json { render :show, status: :created, location: @expence_forecast }\n else\n format.html { render :new }\n format.json { render json: @expence_forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def forecast(forecast_path)\r\n response = Curl.get(forecast_path) do |curl|\r\n curl.headers['Accept'] = 'application/json'\r\n end\r\n JSON.parse(response.body_str)\r\n end",
"def create\n @forecast_72 = Forecast72.new(forecast_72_params)\n\n respond_to do |format|\n if @forecast_72.save\n format.html { redirect_to @forecast_72, notice: 'Forecast 72 was successfully created.' }\n format.json { render :show, status: :created, location: @forecast_72 }\n else\n format.html { render :new }\n format.json { render json: @forecast_72.errors, status: :unprocessable_entity }\n end\n end\n end",
"def forecast_params\n params.require(:forecast).permit(:station_number, :date, :hour, :next, {temperatures: []}, {wind_speeds: []}, {wind_directs: []}, {preasures: []}, {situations: []}, {precipitations: []}, {times_from: []}, {times_to: []})\n end",
"def index\n @forecast_72s = Forecast72.all\n end",
"def set_forecast\n @forecast = Forecast.find(params[:id])\n end",
"def set_forecast\n @forecast = Forecast.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @sales_forecast.update(sales_forecast_params)\n format.html { redirect_to @sales_forecast, notice: 'Sales forecast was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_forecast }\n else\n format.html { render :edit }\n format.json { render json: @sales_forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n store_location_for :user, request.url\n @forecast = Forecast.request(params[:forecast])\n debug_me = true\n end",
"def new\n @forecast = Forecast.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forecast }\n end\n end",
"def forecasting_params\n params.require(:forecasting).permit(:data, :name, :latitude, :longitude)\n end",
"def index\n @forecasts = Forecast.all\n @days = @forecasts.order(\"created_at desc\").pluck(:date).uniq\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end",
"def set_forecasting\n @forecasting = Forecasting.find(params[:id])\n end",
"def forecast(loc)\n\n url = \"#{@base_url}/#{FORECAST_QUERY}/q/#{loc[0]},#{loc[1]}.json\" \n\n result = JSON.parse(open(url).read)\n\n return nil if result['response']['error'] \n return nil unless result['current_observation']\n\n obs = result['current_observation']\n loc = result['current_observation']['observation_location']\n fc = result['forecast']['simpleforecast']\n\n # puts 'Fetching for ' + obs['station_id']\n \n weather = WeatherStation.find_or_create_by_station_id(obs['station_id'])\n\n location = ObservationLocation.new\n\n location.full = loc['full']\n location.city = loc['city']\n location.state = loc['state']\n location.country = loc['country']\n location.country_iso3166 = loc['country_iso3166']\n location.loc = [loc['latitude'].to_f,loc['longitude'].to_f]\n location.elevation = loc['elevation']\n \n weather.observation_location = location\n\n weather.forecasts.clear\n\n fc['forecastday'].each do |f|\n\n forecast = Forecast.new\n\n date = DateTime.strptime(f['date']['epoch'].to_s,'%s')\n\n forecast.date = date\n forecast.conditions = f['conditions']\n forecast.pop = f['pop']\n forecast.high_c = f['high']['celsius']\n forecast.high_f = f['high']['fahrenheit']\n forecast.low_c = f['low']['celsius']\n forecast.low_f = f['low']['fahrenheit']\n\n forecast.qpf_day_mm = f['qpf_day']['mm']\n forecast.qpf_day_in = f['qpf_day']['in']\n forecast.qpf_allday_mm = f['qpf_allday']['mm']\n forecast.qpf_allday_in = f['qpf_allday']['in']\n forecast.qpf_night_mm = f['qpf_night']['mm']\n forecast.qpf_night_in = f['qpf_night']['in']\n\n forecast.snow_day_mm = f['snow_day']['mm']\n forecast.snow_day_in = f['snow_day']['in']\n forecast.snow_allday_mm = f['snow_allday']['mm']\n forecast.snow_allday_in = f['snow_allday']['in']\n forecast.snow_night_mm = f['snow_night']['mm']\n forecast.snow_night_in = f['snow_night']['in']\n\n forecast.wind_max_kph = f['maxwind']['kph'] \n forecast.wind_max_mph = f['maxwind']['mph'] \n forecast.wind_max_dir = f['maxwind']['dir'] \n forecast.wind_max_degrees = f['maxwind']['degrees'] \n\n forecast.wind_ave_kph = f['avewind']['kph'] \n forecast.wind_ave_mph = f['avewind']['mph'] \n forecast.wind_ave_dir = f['avewind']['dir'] \n forecast.wind_ave_degrees = f['avewind']['degrees'] \n\n forecast.humidity_ave = f['avehumidity']\n forecast.humidity_min = f['minhumidity']\n forecast.humidity_max = f['maxhumidity']\n\n weather.forecasts << forecast\n\n end\n\n weather.observation_time_rfc822 = obs['observation_time_rfc822']\n weather.local_time_rfc822 = obs['local_time_rfc822']\n weather.weather = obs['weather']\n weather.temp_f = obs['temp_f']\n weather.temp_c = obs['temp_c']\n weather.relative_humidity = obs['relative_humidity']\n weather.precip_today_metric = obs['precip_today_metric']\n\n return weather\n\n end",
"def get_forecast_data\n result = RestClient.get(request_url)\n @xml = REXML::Document.new(result)\n end",
"def forecast_params\n farm_provider_id = params.delete('farm_provider_id')\n if farm_provider_id\n farm_provider = FarmProvider.find(farm_provider_id)\n end\n\n\n # NOTE AJA: have to permit! until rails supports permitting array of arrays\n params.require(:forecast)\n .permit!\n .transform_keys {|key|\n case key\n when 'provider_id' then 'forecast_provider_id'\n when 'provider_forecast_ref' then 'forecast_provider_forecast_ref'\n else\n key\n end\n }\n .tap {|p|\n # lookup the type model\n if p.keys.include?('type')\n type_name = p.delete('type')\n forecast_type = ForecastType.where(name: type_name).first()\n p['forecast_type_id'] = (forecast_type ? forecast_type.id : nil)\n end\n\n # support route posting to FarmProvider with farm_provider_farm_ref\n if farm_provider && p.keys.include?('farm_provider_farm_ref')\n provider_farm = farm_provider.farms.where(farm_provider_farm_ref: p.delete('farm_provider_farm_ref')).first()\n if (provider_farm)\n p['farm_id'] = provider_farm.id\n end\n end\n }\n end",
"def forecast(latitude, longitude, options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/forecast/#{@api_key}/#{latitude},#{longitude}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200\n end",
"def create\n @dji_forecast = DjiForecast.new(dji_forecast_params)\n\n respond_to do |format|\n if @dji_forecast.save\n format.html { redirect_to @dji_forecast, notice: 'Dodano prognozę.' }\n format.json { render :show, status: :created, location: @dji_forecast }\n else\n format.html { render :new }\n format.json { render json: @dji_forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def forecast(query)\n get_json(\"#{api_url}/forecast/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def forecasts\n convertions = [[:date, :to_date], [:low, :to_i], [:high, :to_i], [:code, :to_i], :day, :text]\n item_attribute('yweather:forecast').collect do |forecast|\n translate! do_convertions(forecast, *convertions)\n end\n end",
"def destroy\n @sales_forecast.destroy\n respond_to do |format|\n format.html { redirect_to sales_forecasts_url, notice: 'Sales forecast was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def forecast\n render json: @current_user.forecast\n end",
"def create\n data = reload(get_series('foods'), str(Date.strptime(params[:food].values.join(\"-\"))))\n saved = false\n get_series('foods').each do |s|\n #puts \"Updating series=#{s}\"\n data[s].each do |day|\n @food = for_date(day['dateTime'])\n @food.send(s.rpartition('/')[2] + '=', day['value'])\n\n # update from collection too\n logged_food = reload_range(['foods/log'], day['dateTime'], nil)\n # TODO refactor this into a lood instead of separate IFs\n if logged_food['summary']['carbs'].nil?\n @food.carbs = 0\n else\n @food.carbs = logged_food['summary']['carbs'].floor\n end\n if logged_food['summary']['protein'].nil?\n @food.protein = 0\n else\n @food.protein = logged_food['summary']['protein'].floor\n end\n if logged_food['summary']['fat'].nil?\n @food.fat = 0\n else\n @food.fat = logged_food['summary']['fat'].floor\n end\n if logged_food['summary']['fiber'].nil?\n @food.fiber = 0\n else\n @food.fiber = logged_food['summary']['fiber'].floor\n end\n if @food.caloriesIn.nil?\n @food.caloriesIn = 0\n end\n if @food.water.nil?\n @food.water = 0\n end\n\n saved = @food.save\n if not saved\n flash[:error] = @food.errors\n end\n end\n end\n\n respond_to do |format|\n flash[:success] = 'Food was successfully created.'\n format.html { redirect_to @food }\n format.json { render json: @food, status: :created, location: @food }\n end\n end",
"def forecast_params\n params.fetch(:forecast, {}).permit(:search)\n end",
"def create\n @sales_datum = SalesDatum.new(params[:sales_datum])\n\n respond_to do |format|\n if @sales_datum.save\n format.html { redirect_to @sales_datum, notice: 'Sales datum was successfully created.' }\n format.json { render json: @sales_datum, status: :created, location: @sales_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sales_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dji_forecast_params\n params.require(:dji_forecast).permit({close_nnet: []}, {close_arima: []}, {date: []})\n end",
"def index\n @forecasts = @user.forecasts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @forecasts }\n end\n end",
"def create\n @tv_series = TvSerie.new(tv_series_params)\n\n respond_to do |format|\n if @tv_series.save\n format.html { redirect_to @tv_series, notice: \"Tv serie was successfully created.\" }\n format.json { render :show, status: :created, location: @tv_series }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tv_series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def forecast_array\n @forecast ||= HTTParty.get(\"http://api.openweathermap.org/data/2.5/forecast/daily?q=Seattle&cnt=3&units=imperial&mode=json\").parsed_response[\"list\"]\n end",
"def index\n @forecast_msizes = ForecastMsize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forecast_msizes }\n end\n end",
"def update_from_darksky(historical_dates=[Date.today-1], forecast=true)\n darksky_secret = ApiKey.where(:service => 'Darksky').first.key\n hydra = Typhoeus::Hydra.new\n requests = Hash.new\n forecast_request = nil\n\n logger.debug(\"Updating Station #{name} for dates: #{historical_dates}\")\n \n # Construct the HTTP requests to Darksky: one for each of the past days we care about, and one for today to get the forecast\n historical_dates.each do |d|\n endpoint = \"https://api.darksky.net/forecast/#{darksky_secret}/#{self.latitude},#{self.longitude},#{d.to_time.to_i}\"\n request = Typhoeus::Request.new(endpoint) \n hydra.queue(request)\n requests[d] = request\n end\n forecast_request = Typhoeus::Request.new(\"https://api.darksky.net/forecast/#{darksky_secret}/#{self.latitude},#{self.longitude}\")\n hydra.queue(forecast_request) if forecast\n\n # Run the whole lot of them!\n hydra.run\n\n # Parse out the observed precipitation from the historical queries\n reports = []\n requests.each_pair do |d, request|\n if request.response.timed_out?\n logger.error \"Request to Darksky timed out: #{request}\"\n next\n end\n if request.response.nil?\n logger.error \"No response from Darksky for request #{request}\"\n next\n end\n if request.response.code != 200\n logger.error \"Unable to fetch weather data from #{request.base_url}: #{request.response.code} #{request.response.status_message}\"\n next\n end\n\n # With error trapping done, let's parse the body and update the db with the report data.\n data = JSON.load(request.response.body)\n data['daily']['data'].each do |report|\n logger.debug(report)\n d = Time.at(report['time']).to_date\n datestamp = \"#{d.year}#{d.month.to_s.rjust(2,'0')}#{d.day.to_s.rjust(2,'0')}\"\n logger.debug(\"Using timestamp #{datestamp}\")\n # We want to update an existing row in place if we've previously computed one\n r = weather_reports.find_or_create_by(\n :latitude => self.latitude,\n :longitude => self.longitude,\n :date => datestamp,\n )\n \n \n # TODO: multiply by the actual number of hours in the time period.\n precip = report['precipIntensity'] # This is in inches per hour\n logger.debug(\"Extracted precipitation report: #{precip} from report #{report}\")\n r.precip = precip * 24.0\n logger.debug(\"Constructed WeatherReport: #{r}\")\n logger.debug(\"Coordinates: #{r.latitude},#{r.longitude}\")\n logger.debug(\"Datestamp: #{r.date}\")\n logger.debug(\"Recorded Precip: #{r.precip}\")\n \n r.save\n reports.push(r)\n end\n end\n\n # Add the forecast data as well\n forecasts = []\n if forecast\n logger.info(\"Parsing forecasts for station #{self}\")\n logger.debug(\"Got response: #{forecast_request.response}\")\n if forecast_request.response.timed_out?\n logger.error \"Request to Darksky timed out: #{forecast_request}\"\n return\n end\n if forecast_request.response.nil?\n logger.error \"No response from Darksky for request #{forecast_request}\"\n return\n end\n if forecast_request.response.code != 200\n logger.error \"Unable to fetch weather data from #{forecast_request.base_url}: #{forecast_request.response.code} #{forecast_request.response.message}\"\n return\n end\n\n logger.debug(\"Successful response from Darksky\")\n data = JSON.load(forecast_request.response.body)\n data['daily']['data'].each do |report|\n logger.debug(report)\n d = Time.at(report['time']).to_date\n datestamp = \"#{d.year}#{d.month.to_s.rjust(2,'0')}#{d.day.to_s.rjust(2,'0')}\"\n r = weather_reports.find_or_create_by(\n :latitude => self.latitude,\n :longitude => self.longitude,\n :date => datestamp,\n )\n r.precip = report['precipIntensity'] * 24.0 # The Darksky report gives us inches per hour\n\n logger.debug(\"Created forecast object: #{r}\")\n r.save\n forecasts.push(r)\n end\n end\n\n # TODO: add a column that we can record when this update was last run, for display on the webpage.\n {:reports => reports, :forecasts => forecasts}\n end",
"def forecast_72_params\n params.require(:forecast_72).permit(:station_id_id, :pattern, :publish_time, :predict_time, :pm25, :pm10, :o3, :o3_8h, :co, :so2, :no2, :aqi)\n end",
"def create\n @series = Series.new(series_params)\n \n respond_to do |format|\n if @series.save\n format.html { redirect_to @series, notice: 'Series was successfully created.' }\n format.json { render :show, status: :created, location: @series }\n else\n format.html { render :new }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @series = Series.new(params[:series])\n\n respond_to do |format|\n if @series.save\n format.html { redirect_to @series, notice: 'Series se ha creado con éxito.' }\n format.json { render json: @series, status: :created, location: @series }\n else\n format.html { render action: \"new\" }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @series = Series.new(series_params)\n\n respond_to do |format|\n if @series.save\n format.html { redirect_to @series, notice: 'Series was successfully created.' }\n format.json { render action: 'show', status: :created, location: @series }\n else\n format.html { render action: 'new' }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tv_series = TvSeries.new(tv_series_params)\n\n respond_to do |format|\n if @tv_series.save\n format.html { redirect_to root_path, notice: 'Сериал создан!' }\n format.json { render :index, status: :created, location: root_path }\n else\n format.html { render :new }\n format.json { render json: @tv_series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @forecast_wsizes = ForecastWsize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forecast_wsizes }\n end\n end",
"def index\n @expence_forecasts = ExpenceForecast.all\n end",
"def weather\n # empty array dates is still fine, not a reason for 400 (happens for venues without courts)\n render json: {} and return if params.dig(:dates).blank?\n\n forecast = WeatherForecaster.call(venue, [*params.require(:dates)])\n json = forecast.transform_values do |value|\n value ? value.slice(*%w(icon temperature)) : nil\n end\n render json: json\n end",
"def daily_forecast(location)\n id = location_id[location.downcase.to_sym]\n puts id\n# Maybe call it weather_update to call at 00:01 every day, needs to iterate over each location\n url = \"http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/#{id}?res=3hourly&key=0da4e1ea-8681-47bc-a5f9-5ab535ff75f2\"\n resp = Net::HTTP.get_response(URI.parse(url))\n data = resp.body\n result = JSON.parse(data)\n tomorrow = result[\"SiteRep\"][\"DV\"][\"Location\"][\"Period\"][1][\"Rep\"]\n\n @temp_tomorrow=[]\n tomorrow.each do |f|\n @temp_tomorrow << f[\"F\"].to_i\n end\n @cloud_tomorrow=[]\n tomorrow.each do |f|\n @cloud_tomorrow << f[\"V\"].to_i\n end\n @rain_tomorrow=[]\n tomorrow.each do |f|\n @rain_tomorrow << f[\"Pp\"].to_i\n end\n @wind_tomorrow=[]\n tomorrow.each do |f|\n @wind_tomorrow << f[\"S\"].to_i\n end\n\n tomorrow = WeatherData.new \n tomorrow.date = [Date.today.next_day.year, Date.today.next_day.month, Date.today.next_day.day]\n tomorrow.location = location\n tomorrow.temperature = @temp_tomorrow\n tomorrow.rainfall = @rain_tomorrow\n tomorrow.wind = @wind_tomorrow\n tomorrow.cloud = @cloud_tomorrow\n tomorrow.save\nend",
"def expence_forecast_params\n params.require(:expence_forecast).permit(:january, :february, :march, :april, :may, :june, :july, :august, :september, :october, :november, :december, :next_year, :next_two_years, :next_three_years, :next_four_years, :next_five_years, :subproject_id)\n end",
"def create\n data = reload(get_series('activities'), str(Date.strptime(params[:activity].values.join(\"-\"))))\n saved = false\n get_series('activities').each do |s|\n puts \"Updating series=#{s}\"\n data[s].each do |day|\n @activity = for_date(day['dateTime'])\n @activity.send(s.partition('/')[2] + '=', day['value'])\n saved = @activity.save\n if not saved\n flash[:error] = @activity.errors\n end\n end\n end\n\n respond_to do |format|\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to @activity }\n format.json { render json: @activity, status: :created, location: @activity }\n end\n end",
"def show\n @forecast = Forecast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast }\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n\n if @sale.save\n render json: @sale, status: :created, location: @sale\n else\n render json: @sale.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @forecast = Forecast.find(params[:id])\n @forecast.destroy\n\n respond_to do |format|\n format.html { redirect_to forecasts_url }\n format.json { head :ok }\n end\n end",
"def get_forecast\n @forecast = ForecastIO.forecast( lat, lng )\n end",
"def destroy\n @forecast.destroy\n respond_to do |format|\n format.html { redirect_to forecasts_url, notice: 'Forecast was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @sales_history = SalesHistory.new(sales_history_params)\n\n respond_to do |format|\n if @sales_history.save\n format.html { redirect_to @sales_history, notice: 'Sales history was successfully created.' }\n format.json { render :show, status: :created, location: @sales_history }\n else\n format.html { render :new }\n format.json { render json: @sales_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @forecast.update(forecast_params)\n format.html { redirect_to @forecast, notice: 'Forecast was successfully updated.' }\n format.json { render :show, status: :ok, location: @forecast }\n else\n format.html { render :edit }\n format.json { render json: @forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n data = reload(get_series('sleep'), str(Date.strptime(params[:sleep].values.join(\"-\"))))\n saved = false\n get_series('sleep').each do |s|\n data[s].each do |day|\n logger.debug \"data=#{day} date=#{day['dateTime']} value=#{day['value']}\"\n @sleep = for_date(day['dateTime'])\n\t# get variable name from last part of series\n @sleep.send(s.rpartition('/')[2] + '=', day['value'])\n saved = @sleep.save\n if not saved\n flash[:error] = @sleep.errors\n end\n end\n end\n \n respond_to do |format|\n flash[:success] = 'Sleep was successfully created.'\n format.html { redirect_to sleeps_path }\n format.json { render :json => sleeps_path, :status => :created, :location => sleeps_path }\n end\n end",
"def set_forecast\n @forecast = Location.where(zipcode: params[:zipcode]).first.try(:forecast)\n if @forecast.blank?\n @forecast = Forecast.new(search: params[:zipcode])\n end\n end",
"def index\n @dji_forecasts = DjiForecast.all.order(\"created_at desc\").paginate(:page => params[:page], :per_page => 15)\n end",
"def index\n @sales = @saleService.all_to_json().as_json;\n end",
"def create\n @forecast_hour = ForecastHour.new(forecast_hour_params)\n\n respond_to do |format|\n if @forecast_hour.save\n format.html { redirect_to @forecast_hour, notice: 'Forecast hour was successfully created.' }\n format.json { render :show, status: :created, location: @forecast_hour }\n else\n format.html { render :new }\n format.json { render json: @forecast_hour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def salesApi\n require 'uri'\n require 'net/http'\n require 'json'\n\n #Arrays for each category\n \n @frequency = Hash.new(0)\n\n url = URI(\"https://api.salesloft.com/v2/people.json\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n request[\"Authorization\"] = 'Bearer ' + ENV[\"API_KEY\"]\n\n response = http.request(request)\n \n @body = JSON.parse(response.body)['data']\n return @body\n end",
"def new\n @forecast_msize = ForecastMsize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forecast_msize }\n end\n end",
"def new\n @forecast_wsize = ForecastWsize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forecast_wsize }\n end\n end",
"def snowfall_params\n params.require(:snowfall).permit(:title, :location, :amount, :temp)\n end",
"def create\n @meteo_datum = MeteoDatum.new(meteodatum_params)\n @meteo_datum.weather_station_id = params[:weather_station_id]\n\n if @meteo_datum.save\n render json: @meteo_datum, status: :created\n else\n render json: @meteo_datum.errors, status: :unprocessable_entity\n end\n end",
"def create\n @sale_day_total = SaleDayTotal.new(params[:sale_day_total])\n\n respond_to do |format|\n if @sale_day_total.save\n format.html { redirect_to @sale_day_total, notice: 'Sale day total was successfully created.' }\n format.json { render json: @sale_day_total, status: :created, location: @sale_day_total }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sale_day_total.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trend = Trend.new(params[:trend])\n\n respond_to do |format|\n if @trend.save\n format.html { redirect_to @trend, :notice => 'Trend was successfully created.' }\n format.json { render :json => @trend, :status => :created, :location => @trend }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @trend.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_forecast!( params_hash={} )\n \n # Use last known search if no params given.\n params_hash[:location] ||= current_location\n params_hash[:days] ||= current_days\n \n # If it's a new forecast\n if params_hash[:location] != prev_location || params_hash[:days] != prev_days \n \n # Log the changes\n update_attributes( prev_location: current_location, prev_days: current_days, current_location: params_hash[:location], current_days: params_hash[:days] )\n \n end\n \n # Return forecast data\n self.class.get_forecast( params_hash )\n \n end",
"def create\n @sales_term = SalesTerm.new(params[:sales_term])\n\n respond_to do |format|\n if @sales_term.save\n format.html { redirect_to @sales_term, notice: 'Sales Term was successfully created.' }\n format.json { render json: @sales_term, status: :created, location: @sales_term }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sales_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_forecast_72\n @forecast_72 = Forecast72.find(params[:id])\n end",
"def create\n @trend = Trend.new(params[:trend])\n\n respond_to do |format|\n if @trend.save\n format.html { redirect_to @trend, notice: 'Trend was successfully created.' }\n format.json { render json: @trend, status: :created, location: @trend }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @forecast_msize = ForecastMsize.new(params[:forecast_msize])\n\n respond_to do |format|\n if @forecast_msize.save\n format.html { redirect_to [:admin,@forecast_msize], notice: 'Forecast msize was successfully created.' }\n format.json { render json: [:admin,@forecast_msize], status: :created, location: @forecast_msize }\n else\n format.html { render action: \"new\" }\n format.json { render json: @forecast_msize.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_to_historical(data_hash, title_number)\n\n response = rest_post_call($HISTORIAN_URL + '/' + title_number, data_hash.to_json)\n\n if (response.code != '200') then\n raise \"Failed to create the historical data: \" + response.body\n end\n\n return response.body\nend",
"def create\n @cal_month_sale = CalMonthSale.new(cal_month_sale_params)\n\n respond_to do |format|\n if @cal_month_sale.save\n format.html { redirect_to @cal_month_sale, notice: 'Cal month sale was successfully created.' }\n format.json { render :show, status: :created, location: @cal_month_sale }\n else\n format.html { render :new }\n format.json { render json: @cal_month_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def forecast\n # @greeting = \"Hi\"\n # @user = params[:user]\n # data = Weather.call(@user.latitude, @user.longitude)\n # @forecast = Forecast.new(data)\n # @tomorrow_best_time = @forecast.best_tomorrow_hourly(@user)\n # mail(to: @user.email, subject: 'Weather or Not: Best time for tomorrow to go outside')\n # # mail to: \"to@example.org\"\n end",
"def create\n @series = Series.new(params[:series])\n if @series.save\n flash[:notice] = t('successfully_created', :default => 'Series was successfully created.')\n redirect_to(@series)\n else\n render :action => \"new\"\n end\n end",
"def create\n @new_series = ConventionSeries.new(convention_series_params)\n authorize @new_series\n if @new_series.save\n flash[:notice] = \"Series created successfully\"\n redirect_to convention_series_path(@new_series)\n else\n flash[:alert] = \"Error creating series\"\n @series = ConventionSeries.all\n render :index\n end\n end",
"def index\n @day_forecasts = DayForecast.where(\"forecast_datetime >= ?\", Time.current.beginning_of_day)\n @half_forecasts = HalfForecast.where(point_date: Config.last.half_forecast_point_date)\n end",
"def weather_forecast\n city = self.city\n state = self.state\n ForecastFacade.forecast(city, state)\n end",
"def create\n @trending = Trending.new(trending_params)\n\n respond_to do |format|\n if @trending.save\n format.html { redirect_to @trending, notice: 'Trending was successfully created.' }\n format.json { render :show, status: :created, location: @trending }\n else\n format.html { render :new }\n format.json { render json: @trending.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_forecast_snapshot\n @forecast_snapshot = ForecastSnapshot.find(params[:id])\n end",
"def index\n @monthly_finances = MonthlyFinance.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @monthly_finances }\n # end\n end",
"def api_v11_timeseries_post(opts = {})\n api_v11_timeseries_post_with_http_info(opts)\n return nil\n end",
"def forecast\n deck = data.decks.first\n Statistics.forecast(deck: deck.deck)\n end",
"def get_surf_data\n url = \"http://magicseaweed.com/api/#{ENV['MAGIC_SEAWEED_API_KEY']}/forecast/?spot_id=6128&units=UK\"\n uri = URI(url)\n\n response = Net::HTTP.get(uri)\n ActiveSupport::JSON.decode(response) if response != ''\n end",
"def create\n @travel_chart = Travel::Chart.new(params[:travel_chart])\n\n respond_to do |format|\n if @travel_chart.save\n format.html { redirect_to @travel_chart, notice: 'Travel chart was successfully created.' }\n format.json { render json: @travel_chart, status: :created, location: @travel_chart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @travel_chart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Series form passes in a series title string that needs to be mapped\n @series = Series.new(series_params)\n respond_to do |format|\n if @series.save\n format.html { redirect_to @series, notice: 'Series was successfully created.' }\n format.json { render :show, status: :created, location: @series }\n else\n format.html { render :new_physical_object }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trends\n data = generate_data(data_factory)\n respond_with data\n end",
"def create\n @forecast_wsize = ForecastWsize.new(params[:forecast_wsize])\n\n respond_to do |format|\n if @forecast_wsize.save\n format.html { redirect_to [:admin,@forecast_wsize], notice: 'Forecast wsize was successfully created.' }\n format.json { render json: @forecast_wsize, status: :created, location: @forecast_wsize }\n else\n format.html { render action: \"new\" }\n format.json { render json: @forecast_wsize.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_batch\n all_months.each do |month|\n cash_flow = find_or_build_cash_flow(month, @category.id)\n\n cash_flow.planned = cash_flow_params[:value]\n cash_flow.save!\n end\n\n render json: { success: true }, status: :created\n end",
"def index\n @forecast_hours = ForecastHour.all\n end",
"def index\n @weather_station = WeatherStation.find(params[:weather_station_id])\n @meteo_data = []\n @meteo_data = @weather_station.meteo_datums.order('created_at desc').limit(100) unless @weather_station.blank?\n\n render 'api/v1/meteo_data/index', params: [@weather_station, @meteo_data]\n end",
"def create\n @daily_sale = DailySale.new(daily_sale_params)\n\n respond_to do |format|\n if @daily_sale.save\n format.html { redirect_to new_daily_sale_path(page: page), notice: 'Daily Sale was successfully created.' }\n format.json { render :show, status: :created, location: @daily_sale }\n else\n format.html { render :new }\n format.json { render json: @daily_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getForecast(location, today)\n forecasts = location.forecasts\n\n # for each forecast, set the weekday, predicted high temp and predicted low temp\n forecasts.each do |forecast|\n weekday = forecast['date']\n day = weekday.strftime('%A')\n weather = forecast['text'].downcase\n predHigh = forecast['high'].to_i\n predLow = forecast['low'].to_i\n\n dayNum = weekday.strftime('%w')\n\n # set the correct day of the week in the forecast using a conditional statement\n if dayNum == today\n weekday = \"Today\"\n elsif dayNum == today + 1 || dayNum == today -6\n weekday \"Tomorrow\"\n else\n weekday = day\n end\n\n puts \"#{weekday}'s forecast is #{weather} with a high of #{predHigh} ˚C and a low of #{predLow} ˚C.\"\n end\nend",
"def scrape\n\t\turi = URI.parse(@url)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\thttp.use_ssl = false\n\t\t#Make a GET request to the given url\n\t\tresponse = http.send_request('GET', @request_url)\n\t\t# Parse the response body\n\t\tforecast = JSON.parse(response.body)\n\t\tforecast[\"response\"][\"results\"].each do |article|\n\t\t\tif date_valid?(article[\"webPublicationDate\"])\n\t\t\t\tcreate_article(article[\"type\"], article[\"sectionId\"],\n\t\t\t\t\tarticle[\"webTitle\"], article[\"webPublicationDate\"],\n\t\t\t\t\tarticle[\"id\"], article[\"webUrl\"], article[\"apiUrl\"],\n\t\t\t\t\tarticle[\"sectionName\"])\n\t\t\tend\n\t\tend\n\t\t@articles\n\tend",
"def extended_forecast(query)\n get_json(\"#{api_url}/forecast10day/q/#{parse_query(query)}.#{@options[:format]}\")\n end",
"def create\n @step = @trip.steps.new(step_params)\n\n @locations = JSON params['locations']\n\n respond_to do |format|\n if @step.valid?\n if @step.save\n if @step.have_updated_forecast? # return true or false\n format.html { redirect_to @trip, notice: 'Step was successfully created. Updated forecast available.' }\n format.json { render action: 'show', status: :created, location: @step }\n else\n if @step.should_make_forecast?\n if @step.make_forecast == true # return true , false or nil\n format.html { redirect_to @trip, notice: 'Step was successfully created. New forecast requested.' }\n format.json { render action: 'show', status: :created, location: @step }\n else @step.make_forecast == false\n format.html { \n flash.now[:notice] = \"Cannot make forecast for #{@step.location}. City not found!\" \n render action: 'new' }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @trip, notice: 'Step was successfully created. No forecast available for the arrival.' }\n format.json { render action: 'show', status: :created, location: @step } \n end \n end\n else\n format.html { render action: 'new' }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n else\n format.html { \n flash.now[:notice] = \"Cannot make forecast for #{@step.location}. Arrive on should be in the past!\" \n render action: 'new' }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end\n \n end\n\n end",
"def create\n @webservice = Webservice.find(params[:webservice_id])\n @rest_api = @webservice.rest_apis.create(rest_api_params)\n redirect_to webservice_path(@webservice)\n end",
"def series_params\n params.require(:series).permit(:name, :description, :logo, :feeds_id, :calendar_id)\n end",
"def create\n @series = Series.new(params[:series])\n @series.normalize_start_time\n @series.type=determine_series_type(params[:series][:type])\n\n respond_to do |format|\n if @series.save\n flash[:notice] = 'Serie erfolgreich erzeugt.'\n format.html { redirect_to(@series) }\n format.xml { render :xml => @series, :status => :created, :location => @series }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @series.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @forecast = Forecast.find(params[:id])\n\n respond_to do |format|\n if @forecast.update_attributes(params[:forecast])\n format.html { redirect_to @forecast, notice: 'Forecast was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_datafactory(name) \n\n factory_create = {\n \"location\": \"centralus\"\n }\n\n response = HTTParty.put(\"https://management.azure.com/subscriptions/#{subscriptionId}/resourceGroups/#{resourceGroupName}/providers/Microsoft.DataFactory/factories/#{name}?api-version=2018-06-01\", {\n\n body: factory_create.to_json,\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Content-Type\" => 'application/json', \n \"Accept\" => '*/*',\n \"Cache-Control\" => 'no-cache',\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n \n verify: true,\n })\n\n return JSON.parse response.read_body\n end"
] |
[
"0.69442296",
"0.68253803",
"0.6629742",
"0.6359097",
"0.61735255",
"0.6083963",
"0.60762334",
"0.6058022",
"0.5992738",
"0.5916345",
"0.5916345",
"0.59101844",
"0.5834936",
"0.5818286",
"0.5809778",
"0.5800901",
"0.5776947",
"0.57012445",
"0.56845057",
"0.5681311",
"0.56728494",
"0.56597394",
"0.56432074",
"0.5643057",
"0.5624123",
"0.5623868",
"0.5552254",
"0.554979",
"0.55329525",
"0.5502207",
"0.54994875",
"0.5499103",
"0.5497443",
"0.5494672",
"0.5478588",
"0.54454815",
"0.54410046",
"0.5425794",
"0.53788906",
"0.53785723",
"0.5354775",
"0.534992",
"0.5328179",
"0.530585",
"0.53014636",
"0.52915573",
"0.5287398",
"0.52675337",
"0.5202252",
"0.5202174",
"0.5201093",
"0.51960975",
"0.5194209",
"0.51929027",
"0.5189889",
"0.518716",
"0.5178844",
"0.51645565",
"0.5154401",
"0.5152563",
"0.51495606",
"0.5144518",
"0.5142224",
"0.5138682",
"0.51203114",
"0.51125824",
"0.50954396",
"0.5092432",
"0.5087023",
"0.5082455",
"0.50815725",
"0.507829",
"0.5077095",
"0.50739694",
"0.50586927",
"0.50552773",
"0.50435543",
"0.5042667",
"0.5037019",
"0.5023252",
"0.5018935",
"0.50181156",
"0.5016017",
"0.5014337",
"0.499719",
"0.49966097",
"0.49938926",
"0.49930793",
"0.49891716",
"0.49841776",
"0.49787596",
"0.496957",
"0.49647364",
"0.49640748",
"0.49550515",
"0.49195436",
"0.49183026",
"0.49168226",
"0.491523",
"0.49076998"
] |
0.7500896
|
0
|
PATCH/PUT /sales_forecasts/1 PATCH/PUT /sales_forecasts/1.json
|
def update
respond_to do |format|
if @sales_forecast.update(sales_forecast_params)
format.html { redirect_to @sales_forecast, notice: 'Sales forecast was successfully updated.' }
format.json { render :show, status: :ok, location: @sales_forecast }
else
format.html { render :edit }
format.json { render json: @sales_forecast.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @forecast = Forecast.find(params[:id])\n\n respond_to do |format|\n if @forecast.update_attributes(params[:forecast])\n format.html { redirect_to @forecast, notice: 'Forecast was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @forecast.update(forecast_params)\n format.html { redirect_to @forecast, notice: 'Forecast was successfully updated.' }\n format.json { render :show, status: :ok, location: @forecast }\n else\n format.html { render :edit }\n format.json { render json: @forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @forecast_72.update(forecast_72_params)\n format.html { redirect_to @forecast_72, notice: 'Forecast 72 was successfully updated.' }\n format.json { render :show, status: :ok, location: @forecast_72 }\n else\n format.html { render :edit }\n format.json { render json: @forecast_72.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sales_forecast\n @sales_forecast = SalesForecast.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @expence_forecast.update(expence_forecast_params)\n format.html { redirect_to @expence_forecast, notice: 'Expence forecast was successfully updated.' }\n format.json { render :show, status: :ok, location: @expence_forecast }\n else\n format.html { render :edit }\n format.json { render json: @expence_forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @forecast = Forecast.find(params[:id])\n \n if @forecast.user.id == @user.id\n respond_to do |format|\n if @forecast.update_attributes(params[:forecast])\n flash[:notice] = 'Forecast was successfully updated.'\n format.html { redirect_to(\"/#{@user.nick}/forecasts\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @forecast.errors, :status => :unprocessable_entity }\n end\n end \n else\n redirect_to '/'\n end\n end",
"def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series])\n format.html { redirect_to @series, notice: 'Series was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series])\n format.html { redirect_to @series, notice: 'Series se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tv_series.update(tv_series_params)\n format.html { redirect_to @tv_series, notice: \"Tv serie was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tv_series }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tv_series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @series.update(series_params)\n format.html { redirect_to @series, notice: 'Series was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @series.update(series_params)\n format.html { redirect_to @series, notice: 'Series was successfully updated.' }\n format.json { render :show, status: :ok, location: @series }\n else\n format.html { render :edit }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @series.update(series_params)\n format.html { redirect_to @series, notice: 'Series was successfully updated.' }\n format.json { render :show, status: :ok, location: @series }\n else\n format.html { render :edit }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @monthly_finance = MonthlyFinance.find(params[:id])\n respond_to do |format|\n if @monthly_finance.update_attributes(params[:monthly_finance])\n format.html { redirect_to @monthly_finance, notice: 'Monthly finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monthly_finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dji_forecast.update(dji_forecast_params)\n format.html { redirect_to @dji_forecast, notice: 'Zmodyfikowano prognozę.' }\n format.json { render :show, status: :ok, location: @dji_forecast }\n else\n format.html { render :edit }\n format.json { render json: @dji_forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @forecast_hour.update(forecast_hour_params)\n format.html { redirect_to @forecast_hour, notice: 'Forecast hour was successfully updated.' }\n format.json { render :show, status: :ok, location: @forecast_hour }\n else\n format.html { render :edit }\n format.json { render json: @forecast_hour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tv_series.update(tv_series_params)\n format.html { redirect_to root_path, notice: 'Сериал отредактирован!' }\n format.json { render :index, status: :ok, location: root_path }\n else\n format.html { render :edit }\n format.json { render json: @tv_series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @series.update(series_params)\n format.html { redirect_to @series, notice: \"La mêlée du #{Series.date} a été modifiée.\" }\n # format.json { render :show, status: :ok, location: @series }\n else\n format.html { render :edit, status: :unprocessable_entity }\n # format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_forecast\n @forecast = Forecast.find(params[:id])\n end",
"def set_forecast\n @forecast = Forecast.find(params[:id])\n end",
"def update\n @sales_datum = SalesDatum.find(params[:id])\n\n respond_to do |format|\n if @sales_datum.update_attributes(params[:sales_datum])\n format.html { redirect_to @sales_datum, notice: 'Sales datum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @travel_chart = Travel::Chart.find(params[:id])\n\n respond_to do |format|\n if @travel_chart.update_attributes(params[:travel_chart])\n format.html { redirect_to @travel_chart, notice: 'Travel chart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @travel_chart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @cal_month_sale.update(cal_month_sale_params)\n format.html { redirect_to @cal_month_sale, notice: 'Cal month sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @cal_month_sale }\n else\n format.html { render :edit }\n format.json { render json: @cal_month_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def set_forecasting\n @forecasting = Forecasting.find(params[:id])\n end",
"def update\n @forecast_msize = ForecastMsize.find(params[:id])\n\n respond_to do |format|\n if @forecast_msize.update_attributes(params[:forecast_msize])\n format.html { redirect_to [:admin,@forecast_msize], notice: 'Forecast msize was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forecast_msize.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n travel = Travel.find(params[:id])\n if travel.update(travel_params)\n render json: travel, status: 200\n else\n render json: travel.errors, status: 422\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @sale = Sale.find(params[:id])\n\n if @sale.update(sale_params)\n head :no_content\n else\n render json: @sale.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @microfinance_service_provider_typology.update(microfinance_service_provider_typology_params)\n format.html { redirect_to @microfinance_service_provider_typology, notice: 'Microfinance service provider typology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @microfinance_service_provider_typology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def set_forecast_72\n @forecast_72 = Forecast72.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @recreation_service_typology.update(recreation_service_typology_params)\n format.html { redirect_to @recreation_service_typology, notice: 'Recreation service typology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recreation_service_typology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @sales_history.update(sales_history_params)\n format.html { redirect_to @sales_history, notice: 'Sales history was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_history }\n else\n format.html { render :edit }\n format.json { render json: @sales_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series].merge({:version_attributes=>{},:thumbnail_attributes=>{:name=>params[:series][:name],:original_link=>params[:series][:thumbnail_link],:remote_image_url=>params[:series][:thumbnail_link]} }))\n format.html { redirect_to @series, :notice => 'Series was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @series.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @sales_term = SalesTerm.find(params[:id])\n\n respond_to do |format|\n if @sales_term.update_attributes(params[:sales_term])\n format.html { redirect_to @sales_term, notice: 'Sales term was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def update\n @feedstock = Feedstock.find(params[:id])\n\n respond_to do |format|\n if @feedstock.update_attributes(params[:feedstock])\n format.html { redirect_to @feedstock, notice: 'Estoque atualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedstock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def update\n respond_to do |format|\n if @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_set = chart.data_sets.find(params[:id])\n \tdata_set.update_attributes(params[:data_set])\n\n respond_with(data_set) do |format|\n if data_set.valid?\n format.json { render json: { success: true, data_sets: data_set } }\n else\n format.json { render json: { success: false, errors: data_set.errors } }\n end\n end\n end",
"def create\n @sales_forecast = SalesForecast.new(sales_forecast_params)\n\n respond_to do |format|\n if @sales_forecast.save\n format.html { redirect_to @sales_forecast, notice: 'Sales forecast was successfully created.' }\n format.json { render :show, status: :created, location: @sales_forecast }\n else\n format.html { render :new }\n format.json { render json: @sales_forecast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_frequency_period.update(api_v1_frequency_period_params)\n format.html { redirect_to @api_v1_frequency_period, notice: 'Frequency period was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_frequency_period }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_frequency_period.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sales_coffee.update(sales_coffee_params)\n format.html { redirect_to @sales_coffee, notice: \"Sales coffee was successfully updated.\" }\n format.json { render :show, status: :ok, location: @sales_coffee }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sales_coffee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @series_type = SeriesType.find(params[:id])\n\n respond_to do |format|\n if @series_type.update_attributes(params[:series_type])\n format.html { redirect_to @series_type, notice: 'Series type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @series_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @farm_practice_typology.update(farm_practice_typology_params)\n format.html { redirect_to @farm_practice_typology, notice: 'Farm practice typology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @farm_practice_typology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @future_ticker.update(future_ticker_params)\n format.html { redirect_to @future_ticker, notice: 'Future ticker was successfully updated.' }\n format.json { render :show, status: :ok, location: @future_ticker }\n else\n format.html { render :edit }\n format.json { render json: @future_ticker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flight_schedule = FlightSchedule.find(params[:id])\n\n respond_to do |format|\n if @flight_schedule.update_attributes(params[:flight_schedule])\n format.html { redirect_to @flight_schedule, notice: 'Flight schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flight_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n if @calificacion_servicio.update_attributes(params[:calificacion_servicio])\n format.html { redirect_to @calificacion_servicio, notice: 'Calificacion servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calificacion_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n if @historical.update_attributes(params[:historical])\n format.html { redirect_to @historical, notice: 'Historical was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scheduled_service = ScheduledService.find(params[:id])\n\n respond_to do |format|\n if @scheduled_service.update_attributes(params.require(:scheduled_service).permit(:mileage, :sdate, :service_schedule_id))\n format.html { redirect_to scheduled_services_url,\n notice: 'ScheduledService was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scheduled_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @predict_chart.update(predict_chart_params)\n format.html { redirect_to @predict_chart, notice: 'Predict chart was successfully updated.' }\n format.json { render :show, status: :ok, location: @predict_chart }\n else\n format.html { render :edit }\n format.json { render json: @predict_chart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @weather_test.update(weather_test_params)\n format.html { redirect_to @weather_test, notice: 'Weather test was successfully updated.' }\n format.json { render :show, status: :ok, location: @weather_test }\n else\n format.html { render :edit }\n format.json { render json: @weather_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @service.update(service_params)\n render json: @service, status: :ok, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @trending.update(trending_params)\n format.html { redirect_to @trending, notice: 'Trending was successfully updated.' }\n format.json { render :show, status: :ok, location: @trending }\n else\n format.html { render :edit }\n format.json { render json: @trending.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @service_history = ServiceHistory.find(params[:id])\n\n if @service_history.update(service_history_params)\n head :no_content\n else\n render json: @service_history.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @foo10.update(foo10_params)\n format.html { redirect_to @foo10, notice: \"Foo10 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @foo10 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @foo10.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trend = Trend.find(params[:id])\n\n respond_to do |format|\n if @trend.update_attributes(params[:trend])\n format.html { redirect_to @trend, notice: 'Trend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bookseries.update(bookseries_params)\n format.html { redirect_to @bookseries, notice: 'Bookseries was successfully updated.' }\n format.json { render :show, status: :ok, location: @bookseries }\n else\n format.html { render :edit }\n format.json { render json: @bookseries.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n @trend = Trend.find(params[:id])\n\n respond_to do |format|\n if @trend.update_attributes(params[:trend])\n format.html { redirect_to @trend, :notice => 'Trend was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @trend.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend",
"def update\n respond_to do |format|\n if @scarf.update(scarf_params)\n format.html { redirect_to @scarf, notice: 'Scarf was successfully updated.' }\n format.json { render :show, status: :ok, location: @scarf }\n else\n format.html { render :edit }\n format.json { render json: @scarf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @series = Series.find(params[:id])\n \n respond_to do |format|\n params[:series][:type]=determine_series_type(params[:series][:type])\n if @series.update_attributes(params[:series])\n flash[:notice] = 'Serie erfolgreich gespeichert.'\n format.html { redirect_to(series_url(@series)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @series.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @flight = Flight.find(params[:id])\n\n if @flight.update(params[:flight])\n head :no_content\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @rest.update(rest_params)\n format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }\n format.json { render :show, status: :ok, location: @rest }\n else\n format.html { render :edit }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spltrain.update(spltrain_params)\n format.html { redirect_to @spltrain, notice: 'Spltrain was successfully updated.' }\n format.json { render :show, status: :ok, location: @spltrain }\n else\n format.html { render :edit }\n format.json { render json: @spltrain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @point_of_sale.update(point_of_sale_params)\n format.json { render :show, status: :ok, location: @point_of_sale }\n else\n format.json { render json: @point_of_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def update\n respond_to do |format|\n if @business_sale.update(business_sale_params)\n format.html { redirect_to @business_sale, notice: 'Business sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @business_sale }\n else\n format.html { render :edit }\n format.json { render json: @business_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @finance_inflow = FinanceInflow.find(params[:id])\n\n respond_to do |format|\n if @finance_inflow.update_attributes(params[:finance_inflow])\n format.html { redirect_to @finance_inflow, notice: 'Finance inflow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finance_inflow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sale_day_total = SaleDayTotal.find(params[:id])\n\n respond_to do |format|\n if @sale_day_total.update_attributes(params[:sale_day_total])\n format.html { redirect_to @sale_day_total, notice: 'Sale day total was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale_day_total.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sales_forecast_params\n params.require(:sales_forecast).permit(:service_center_id, :segment_id, :status_id, :area_id, :company, :division, :customer_name, :instrument, :price, :budget_id, :certainty_id, :reporting_date, :fixed_date, :order_date, :agent, :condition_text, :person_in_charge, :visible)\n end",
"def update\n service.update(service_params)\n\n respond_with(service)\n end",
"def update\n respond_to do |format|\n if @food_truck.update(food_truck_params)\n format.html { redirect_to @food_truck, notice: 'Food truck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @food_truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sales_channel_api = SalesChannelApi.find(params[:id])\n\n respond_to do |format|\n if @sales_channel_api.update_attributes(params[:sales_channel_api])\n format.html { redirect_to @sales_channel_api, :notice => 'Sales channel api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sales_channel_api.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n json_response(@food_item.update!(food_item_params))\n end",
"def update\n respond_to do |format|\n if @fabricsofaset.update(fabricsofaset_params)\n format.html { redirect_to @fabricsofaset, notice: 'Fabricsofaset was successfully updated.' }\n format.json { render :show, status: :ok, location: @fabricsofaset }\n else\n format.html { render :edit }\n format.json { render json: @fabricsofaset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end",
"def update\n get_credentials\n begin\n response = resource[\"/update/#{app}\"].post(:apikey => @credentials[1], :frequency => options[:frequency])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def update\n #@title = @header = \"Изменение торговой марки\"\n respond_to do |format|\n if @boat_series.update(boat_series_params)\n #format.html { redirect_to @boat_series, notice: 'Торговая марка успешно изменена' }\n format.json { render json: @boat_series.to_json }\n else\n #format.html { render :edit }\n format.json { render json: @boat_series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stoff.update(stoff_params)\n format.html { redirect_to @stoff }\n format.json { render :show, status: :ok, location: @stoff }\n else\n format.html { render :edit }\n format.json { render json: @stoff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @finance = Finance.find(params[:id])\n\n respond_to do |format|\n if @finance.update_attributes(params[:finance])\n format.html { redirect_to @finance, notice: 'Finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @monthly_summary.update(monthly_summary_params)\n format.html { redirect_to @monthly_summary, notice: 'Monthly summary was successfully updated.' }\n format.json { render :show, status: :ok, location: @monthly_summary }\n else\n format.html { render :edit }\n format.json { render json: @monthly_summary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @forecast_wsize = ForecastWsize.find(params[:id])\n\n respond_to do |format|\n if @forecast_wsize.update_attributes(params[:forecast_wsize])\n format.html { redirect_to [:admin,@forecast_wsize], notice: 'Forecast wsize was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forecast_wsize.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n price_schedule_params[:basis] = price_schedule_params[:basis].to_i\n price_schedule_params[:break_type] = price_schedule_params[:break_type].to_i\n price_schedule_params[:qualifier] = price_schedule_params[:qualifier].to_i\n price_schedule_params[:fee_calculation_type] = price_schedule_params[:fee_calculation_type].to_i\n price_schedule_params[:usual_customary_calculation] = price_schedule_params[:usual_customary_calculation].to_i\n price_schedule_params[:customer_assigned_schedule] = price_schedule_params[:customer_assigned_schedule].to_i\n price_schedule_params[:percentage_fee_type] = price_schedule_params[:percentage_fee_type].to_i\n price_schedule_params[:amount_fee_type] = price_schedule_params[:amount_fee_type].to_i\n\n respond_to do |format|\n if @price_schedule.update(price_schedule_params)\n format.html { redirect_to @price_schedule, notice: 'Price Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @price_schedule }\n else\n format.html { render :edit }\n format.json { render json: @price_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meteorological_data = MeteorologicalData.find(params[:id])\n\n respond_to do |format|\n if @meteorological_data.update_attributes(params[:meteorological_data])\n format.html { redirect_to(@meteorological_data, :notice => 'MeteorologicalData was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meteorological_data.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sixmonth_customer = SixmonthCustomer.find(params[:id])\n\n respond_to do |format|\n if @sixmonth_customer.update_attributes(params[:sixmonth_customer])\n format.html { redirect_to action: :index }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sixmonth_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @snowfall.update(snowfall_params)\n format.html { redirect_to @snowfall, notice: 'Snowfall was successfully updated.' }\n format.json { render :show, status: :ok, location: @snowfall }\n else\n format.html { render :edit }\n format.json { render json: @snowfall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @star_fact = Star::Fact.find(params[:id])\n\n respond_to do |format|\n if @star_fact.update_attributes(params[:star_fact])\n format.html { redirect_to @star_fact, notice: 'Fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @star_fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @step.update(step_params)\n if @step.have_updated_forecast? # return true or false\n format.html { redirect_to [@trip, @step], notice: 'Step was successfully updated. Update forecast available.' }\n format.json { head :no_content }\n else\n if @step.make_forecast # return true or nil\n format.html { redirect_to [@trip, @step], notice: 'Step was successfully updated.New forecast requested.' }\n format.json { head :no_content }\n else\n format.html { \n flash.now[:notice] = \"Cannot make forecast for #{@step.location}. City not found!\" \n render action: 'edit' \n }\n format.json { render json: @step.errors, status: :unprocessable_entity } \n end\n end\n else\n format.html { render action: 'edit' }\n format.json { render json: @step.errors, status: :unprocessable_entity }\n end \n end\n\n end",
"def update\n respond_to do |format|\n if @sales_item.update(sales_item_params)\n format.html { redirect_to @sales_item, notice: 'Sales item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sales_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @socio_serasa.update(socio_serasa_params)\n format.html { redirect_to @socio_serasa, notice: 'Socio serasa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_serasa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end"
] |
[
"0.6864185",
"0.68214816",
"0.66747314",
"0.646551",
"0.6364731",
"0.6133831",
"0.6068756",
"0.6066065",
"0.59763414",
"0.59639233",
"0.590987",
"0.590987",
"0.58810806",
"0.58525234",
"0.5852201",
"0.583067",
"0.5807908",
"0.57937044",
"0.5747408",
"0.5747408",
"0.57401156",
"0.57378644",
"0.57280064",
"0.57064307",
"0.57034445",
"0.56925935",
"0.5678371",
"0.5656447",
"0.56428105",
"0.564158",
"0.5634544",
"0.5603022",
"0.5598259",
"0.55959207",
"0.5577488",
"0.55693614",
"0.55655295",
"0.5541165",
"0.55314296",
"0.5531153",
"0.55262613",
"0.552615",
"0.5526023",
"0.5520561",
"0.5520133",
"0.5515374",
"0.55079013",
"0.5501956",
"0.54997134",
"0.5498569",
"0.5495048",
"0.5488297",
"0.54865324",
"0.54812264",
"0.54794383",
"0.5476839",
"0.5475336",
"0.54723185",
"0.54669875",
"0.5466495",
"0.5464694",
"0.54627335",
"0.5459205",
"0.54578406",
"0.54530084",
"0.5451489",
"0.54458314",
"0.54387164",
"0.543754",
"0.5435357",
"0.5432756",
"0.5421579",
"0.54187465",
"0.5417688",
"0.5415305",
"0.54148686",
"0.54117155",
"0.54059565",
"0.5404919",
"0.54042333",
"0.5403604",
"0.5402522",
"0.54017526",
"0.5397959",
"0.5397226",
"0.53922886",
"0.53918666",
"0.5389087",
"0.5389015",
"0.53876305",
"0.5381281",
"0.5379418",
"0.537175",
"0.53698784",
"0.5366868",
"0.53663075",
"0.5365798",
"0.5358258",
"0.53579736",
"0.53557885"
] |
0.73310417
|
0
|
DELETE /sales_forecasts/1 DELETE /sales_forecasts/1.json
|
def destroy
@sales_forecast.destroy
respond_to do |format|
format.html { redirect_to sales_forecasts_url, notice: 'Sales forecast was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @forecast = Forecast.find(params[:id])\n @forecast.destroy\n\n respond_to do |format|\n format.html { redirect_to forecasts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @forecast_72.destroy\n respond_to do |format|\n format.html { redirect_to forecast_72s_url, notice: 'Forecast 72 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forecast.destroy\n respond_to do |format|\n format.html { redirect_to forecasts_url, notice: 'Forecast was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expence_forecast.destroy\n respond_to do |format|\n format.html { redirect_to expence_forecasts_url, notice: 'Expence forecast was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dji_forecast.destroy\n respond_to do |format|\n format.html { redirect_to dji_forecasts_url, notice: 'Usunięto prognozę.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_datum = SalesDatum.find(params[:id])\n @sales_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_sale.destroy\n respond_to do |format|\n format.html { redirect_to daily_sales_url, notice: 'Daily sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monthly_finance = MonthlyFinance.find(params[:id])\n @monthly_finance.destroy\n\n respond_to do |format|\n format.html { redirect_to monthly_finances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forecast_msize = ForecastMsize.find(params[:id])\n @forecast_msize.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_forecast_msizes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @time_series.destroy\n\n respond_to do |format|\n format.html { redirect_to time_series_index_url(@owner), flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.time_series.one'))} }\n format.json { head :no_content }\n end\n end",
"def destroy\n @travel_chart = Travel::Chart.find(params[:id])\n @travel_chart.destroy\n\n respond_to do |format|\n format.html { redirect_to travel_charts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forecast_hour.destroy\n respond_to do |format|\n format.html { redirect_to forecast_hours_url, notice: 'Forecast hour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale_day_total = SaleDayTotal.find(params[:id])\n @sale_day_total.destroy\n\n respond_to do |format|\n format.html { redirect_to sale_day_totals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @series = Series.find(params[:id])\n @series.destroy\n\n respond_to do |format|\n format.html { redirect_to series_index_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @series = Series.find(params[:id])\n @series.destroy\n\n respond_to do |format|\n format.html { redirect_to series_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @series.destroy\n respond_to do |format|\n format.html { redirect_to series_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forecast_wsize = ForecastWsize.find(params[:id])\n @forecast_wsize.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_forecast_wsizes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @historical = Historical.find(params[:id])\n @historical.destroy\n\n respond_to do |format|\n format.html { redirect_to historicals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @station_daily.destroy\n respond_to do |format|\n format.html { redirect_to station_dailies_url, notice: 'Station daily was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recreation_service_typology.destroy\n respond_to do |format|\n format.html { redirect_to recreation_service_typologies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_history.destroy\n respond_to do |format|\n format.html { redirect_to sales_histories_url, notice: 'Sales history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weather_test.destroy\n respond_to do |format|\n format.html { redirect_to weather_tests_url, notice: 'Weather test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_total.destroy\n respond_to do |format|\n format.html { redirect_to daily_totals_url, notice: 'Daily total was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_item.destroy\n respond_to do |format|\n format.html { redirect_to sales_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_inventory = DailyInventory.find(params[:id])\n @daily_inventory.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_inventories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dataset_datum.destroy\n respond_to do |format|\n format.html { redirect_to dataset_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cal_month_sale.destroy\n respond_to do |format|\n format.html { redirect_to cal_month_sales_url, notice: 'Cal month sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_daily = VehicleDaily.find(params[:id])\n @vehicle_daily.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicle_dailies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @service_station = ServiceStation.find(params[:id])\n @service_station.destroy\n\n respond_to do |format|\n format.html { redirect_to service_stations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @temperature_sensor = TemperatureSensor.find(params[:id])\n @temperature_sensor.destroy\n\n respond_to do |format|\n format.html { redirect_to temperature_sensors_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @series.destroy\n respond_to do |format|\n format.html { redirect_to series_index_url, notice: 'Series was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seo_datum = SeoDatum.find(params[:id])\n @seo_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to seo_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monthly_summary.destroy\n respond_to do |format|\n format.html { redirect_to monthly_summaries_url, notice: 'Monthly summary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @series.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trend = Trend.find(params[:id])\n @trend.destroy\n\n respond_to do |format|\n format.html { redirect_to trends_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point_of_sale.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @tv_series.destroy\n respond_to do |format|\n format.html { redirect_to tv_series_url, notice: \"Tv serie was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @weather_station_alert.destroy\n # respond_to do |format|\n # format.html { redirect_to weather_station_alerts_url, notice: 'Weather station alert was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @daily_data_payment.destroy\n respond_to do |format|\n format.html { redirect_to daily_data_payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @series = Series.find(params[:id])\n @series.destroy\n\n respond_to do |format|\n format.html { redirect_to(series_index_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @finance_inflow = FinanceInflow.find(params[:id])\n @finance_inflow.destroy\n\n respond_to do |format|\n format.html { redirect_to finance_inflows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trend = Trend.find(params[:id])\n @trend.destroy\n\n respond_to do |format|\n format.html { redirect_to trends_url }\n format.json { head :ok }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @skydatum = Skydatum.find(params[:id])\n @skydatum.destroy\n\n respond_to do |format|\n format.html { redirect_to skydata_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weather_measure.destroy\n respond_to do |format|\n format.html { redirect_to weather_measures_url, notice: 'Weather measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foodlog = Foodlog.find(params[:id])\n @foodlog.destroy\n\n respond_to do |format|\n format.html { redirect_to foodlogs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @timechart = Timechart.find(params[:id])\n @timechart.destroy\n\n respond_to do |format|\n format.html { redirect_to timecharts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n# @chart = Chart.find(params[:id])\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to charts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedstock = Feedstock.find(params[:id])\n @feedstock.destroy\n\n respond_to do |format|\n format.html { redirect_to feedstocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_intake.destroy\n respond_to do |format|\n format.html { redirect_to daily_intakes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @series_statement.destroy\n\n respond_to do |format|\n format.html { redirect_to series_statements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @microfinance_service_provider_typology.destroy\n respond_to do |format|\n format.html { redirect_to microfinance_service_provider_typologies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_step.destroy\n respond_to do |format|\n format.html { redirect_to daily_steps_url, notice: 'Daily step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_graph.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_graphs_url, notice: 'Graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_movement.destroy\n respond_to do |format|\n format.html { redirect_to daily_movements_url, notice: 'Daily movement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tv_series.destroy\n respond_to do |format|\n format.html { redirect_to tv_series_index_url, notice: 'Сериал удален!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weather_event = WeatherEvent.find(params[:id])\n @weather_event.destroy\n\n respond_to do |format|\n format.html { redirect_to weather_events_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rescue_time_chart.destroy\n respond_to do |format|\n format.html { redirect_to rescue_time_charts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weather_item = WeatherItem.find(params[:id])\n @weather_item.destroy\n\n respond_to do |format|\n format.html { redirect_to weather_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale = Sale.find(params[:id])\n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale = Sale.find(params[:id])\n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weather_log.destroy\n respond_to do |format|\n format.html { redirect_to weather_logs_url, notice: 'Weather log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @observations.destroy\n respond_to do |format|\n format.html { redirect_to observations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datapoint.destroy\n respond_to do |format|\n format.html { redirect_to datapoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foodhistory.destroy\n respond_to do |format|\n format.html { redirect_to foodhistories_url, notice: 'Foodhistory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asos_datum.destroy\n respond_to do |format|\n format.html { redirect_to asos_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fundamental_daily_position_stat = Fundamental::DailyPositionStat.find(params[:id])\n @fundamental_daily_position_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_daily_position_stats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @weather = Weather.find(params[:id])\n @weather.destroy\n\n respond_to do |format|\n format.html { redirect_to weathers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weather = Weather.find(params[:id])\n @weather.destroy\n\n respond_to do |format|\n format.html { redirect_to weathers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weather = Weather.find(params[:id])\n @weather.destroy\n\n respond_to do |format|\n format.html { redirect_to weathers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedules_history = SchedulesHistory.find(params[:id])\n @schedules_history.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @performance_chart.destroy\n respond_to do |format|\n format.html { redirect_to performance_charts_url, notice: 'Performance chart was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_frequency_period.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_frequency_periods_url, notice: 'Frequency period was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale = Sale.find(params[:id])\n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sale = Sale.find(params[:id])\n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @period_milk_production.destroy\n respond_to do |format|\n format.html { redirect_to period_milk_productions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sensor_data.destroy\n respond_to do |format|\n format.html { redirect_to sensor_data_url, notice: 'Sensor data was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asos_station.destroy\n respond_to do |format|\n format.html { redirect_to asos_stations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @finance = Finance.find(params[:id])\n @finance.destroy\n\n respond_to do |format|\n format.html { redirect_to finances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @everyday.destroy\n respond_to do |format|\n format.html { redirect_to everydays_url, notice: 'Everyday was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @total_stock = TotalStock.find(params[:id])\n @total_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to total_stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_truck.destroy\n respond_to do |format|\n format.html { redirect_to food_trucks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @finance_item.destroy\n respond_to do |format|\n format.html { redirect_to finance_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nfl_weather.destroy\n respond_to do |format|\n format.html { redirect_to nfl_weathers_url, notice: 'Nfl weather was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_station = LineStation.find(params[:id])\n @line_station.destroy\n\n respond_to do |format|\n format.html { redirect_to line_stations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @revenue_model.destroy\n respond_to do |format|\n format.html { redirect_to revenue_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_statistic = DailyStatistic.find(params[:id])\n @daily_statistic.destroy\n\n head :no_content\n end",
"def destroy\n @sensor.destroy\n respond_to do |format|\n format.html { redirect_to sensors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sensor.destroy\n respond_to do |format|\n format.html { redirect_to sensors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socioeconomic.destroy\n respond_to do |format|\n format.html { redirect_to socioeconomics_url, notice: 'Socioeconomic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @economic.destroy\n respond_to do |format|\n format.html { redirect_to economics_url, notice: 'Economic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @traffic = Traffic.find(params[:id])\n @traffic.destroy\n\n respond_to do |format|\n format.html { redirect_to traffics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_sale.destroy\n respond_to do |format|\n format.html { redirect_to business_sales_url, notice: 'Business sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @yummy_tummy_day_order = YummyTummyDayOrder.find(params[:id])\n @yummy_tummy_day_order.destroy\n\n respond_to do |format|\n format.html { redirect_to yummy_tummy_day_orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historial_odt = HistorialOdt.find(params[:id])\n @historial_odt.destroy\n\n respond_to do |format|\n format.html { redirect_to historial_odts_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7497344",
"0.73701215",
"0.7358787",
"0.6998041",
"0.6994285",
"0.6930154",
"0.669101",
"0.6631623",
"0.66190374",
"0.66118467",
"0.6590123",
"0.65862006",
"0.65787464",
"0.657814",
"0.6571346",
"0.6561142",
"0.6542617",
"0.6515782",
"0.65096706",
"0.65055996",
"0.6499015",
"0.6496367",
"0.6478628",
"0.6470242",
"0.64690924",
"0.6468888",
"0.64598787",
"0.6426695",
"0.6410919",
"0.6406009",
"0.64022684",
"0.6401913",
"0.63943",
"0.6388863",
"0.6381972",
"0.6378567",
"0.63776684",
"0.63742995",
"0.6372401",
"0.63698184",
"0.63694644",
"0.63668215",
"0.6363707",
"0.63629127",
"0.63626987",
"0.6359175",
"0.63528246",
"0.63517416",
"0.63500553",
"0.6345889",
"0.6344157",
"0.6338616",
"0.6338314",
"0.63377136",
"0.6336052",
"0.63349307",
"0.63344973",
"0.6331344",
"0.6329475",
"0.6326588",
"0.6323678",
"0.6323678",
"0.6321478",
"0.632023",
"0.6319429",
"0.63168085",
"0.63115567",
"0.6310493",
"0.63101476",
"0.6305743",
"0.63036895",
"0.63036895",
"0.63036895",
"0.6301559",
"0.6299728",
"0.6288629",
"0.6287929",
"0.6287929",
"0.6282166",
"0.6279743",
"0.62784904",
"0.6278437",
"0.627836",
"0.6278032",
"0.62763923",
"0.62747145",
"0.6272287",
"0.6271834",
"0.6270905",
"0.6268121",
"0.62673175",
"0.6266513",
"0.626413",
"0.626413",
"0.62616646",
"0.6260396",
"0.6260321",
"0.6259265",
"0.62575835",
"0.6254765"
] |
0.7614303
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.